I am trying to integrate some OpenCV features into my application. I currently have a code configured using DirectShow to receive a video from my camera, which is then displayed in the MFC window. This code cannot be changed or deleted.
The code works fine, but regardless of location, I put the following line of code:
IplImage *img = cvLoadImage("C:/well.jpg");
The webcam cannot initialize correctly and breaks the program.
I get FAILED HRESULT at:
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)
More specifically, at some point in my code, I Call CDialog :: doModal (), which then lands on CoInitializeEx (), and thus the program crashes.
Does anyone know what is going on here?
source share