I have an example function my_mouse_callback that works with IplImage *:
void my_mouse_callback(int event, int x, int y, int flags, void* param) { IplImage* image = (IplImage*) param; switch( event ) { case CV_EVENT_LBUTTONDOWN: drawing_box = true; box = cvRect(x, y, 0, 0); break; ... draw_box(image, box); break; }
which is implemented in main as follows:
cvSetMouseCallback(Box Example,my_mouse_callback,(void*) image);
The problem is that in my code I use a Mat object and it cannot be passed to the setMouseCallback function.
I am looking for a solution that does not include passing Mat in IplImage *.
Or, if there is no solution, how can I convert Mat to IplImage * correctly?
I tried this already with this code from the opencv documentation:
Mat I; IplImage* pI = &I.operator IplImage();
and it didn’t work.
source share