Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you can just pass your image to the callback-function, and draw your circle there:

void onmouse(int event, int x, int y, int flags, void* param)
        Mat &img = *((Mat*)(param)); // 1st cast it back, then deref

int main()
    Mat img;
    namedWindow("My window", 1); 
    setMouseCallback("My window", onmouse, &img); // pass address of img here
    // ...

(some sidenotes:)

  • please don't use polish var-names, or comments, as people in the rest of the world can't read it.
  • please don't mix the c++ api with older c-functions ( cvSetMousCallback, etc )