Hello,
I have an Opencv project and an Irrlicht one wich are working well but as soon as I mixed them it doesn't work any more.
There isn't any error at compilation or execution but programm stay indefinitely on OpenCV functions. Moreover, I tried some snippets using Opencv and Irrlicht and the same issue happens
for example :
int main(int argc, char** argv )
{
irr::IrrlichtDevice *device = irr::createDevice( // creation device
irr::video::EDT_OPENGL, // l'API est OpenGL
irr::core::dimension2d<irr::u32>(800,600), // taille de la fenetre 800x600
32, false, true, false, 0);
irr::video::IVideoDriver* driver =
device->getVideoDriver(); // creation driver
irr::scene::ISceneManager *sceneManager =
device->getSceneManager ();
VideoCapture cap(0);
if ( !cap.isOpened() ) // if not success, exit program
{
cout << "Cannot open the web cam" << endl;
return -1;
}
while(device->run())
{
std::cout<<"Step 1 : OpenCv "<<std::endl;
Mat img;
cap.read(img);
driver->beginScene(true,false,SColor(255,100,101,140));
driver->endScene();
std::cout<<"Step 2 : Irrlicht"<<std::endl;
}
device->drop();
return 0;
}
When this code is executed, it never goes throught Step 2. Is there something I am doing wrong ?
Thank you for your advices
Charles
OpenCV
Re: OpenCV
From what I read, you said that the video capture is in infinite loop.
So, there is no reason it will go to Irrlicht rendering code.
So, there is no reason it will go to Irrlicht rendering code.
Re: OpenCV
Yes, I want at each loop read a frame, extract some information from it and then use irrlicht to render.
I don't understand what is wrong ? I already use the read() function in loop for opencv application and it works.
Even if I put this function out the loop, my program will stay on this function wherase it works when there is no irrlicht.
I am afraid this issue come from my computer or maybe it is because I am using a virtualbox. I am sure that what I want to do is possible because I found examples but even them I can't make them work.
Of course, I did research on the web and I found a similar issue but no answer
I don't understand what is wrong ? I already use the read() function in loop for opencv application and it works.
Even if I put this function out the loop, my program will stay on this function wherase it works when there is no irrlicht.
I am afraid this issue come from my computer or maybe it is because I am using a virtualbox. I am sure that what I want to do is possible because I found examples but even them I can't make them work.
Of course, I did research on the web and I found a similar issue but no answer
Re: OpenCV
Did you step through with a debugger to see where exactly it hangs?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: OpenCV
No,
I havn't many experience with debbuger.
What kind of informations should I search with debbuger ?
Maybe I should try without virtualbox to be sure this isn't the reason of my trouble.
Thank you for your answer.
I havn't many experience with debbuger.
What kind of informations should I search with debbuger ?
Maybe I should try without virtualbox to be sure this isn't the reason of my trouble.
Thank you for your answer.
Last edited by Charles on Tue Jun 02, 2015 6:11 pm, edited 2 times in total.
Re: OpenCV
Get familiar with a debugger, it's easy to learn and worth it! Programmers spend a lot of time in it. And then you can just step through your program line by line and see exactly what your program does. Most IDE's come with a debugger integrated. For example if you are workin in VS you can set a breakpoint in the first line (with F9), run the app in your debugger (F5) and then you can step through your app line-by-line (F10 for each line) and see exactly where it stops (if you use C::B - it works just the same, only using other function keys for the debugger).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: OpenCV
Ok.
I'll try it very soon.
When I am using the qtcreator debugger I reveive two error messages :
libv4l2: error got 4 consecutive frame decode errors, last error: VIDIOC_DQBUF: Erreur d'entrée/
and
(Control:2366): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
The app stay at my opencv read function but it seem it would be the same for any opencv function.
I'll try it very soon.
When I am using the qtcreator debugger I reveive two error messages :
libv4l2: error got 4 consecutive frame decode errors, last error: VIDIOC_DQBUF: Erreur d'entrée/
and
(Control:2366): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
The app stay at my opencv read function but it seem it would be the same for any opencv function.
Re: OpenCV
It's working with visual Studio 2010.
I suppose the issue came from my virutalbox.
Thank you for your help
I suppose the issue came from my virutalbox.
Thank you for your help