Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

pack anything required into a struct.

struct MouseParams
    Mat img;
    Point pt;
    int lucky;

static void onMouse( int event, int x, int y, int, void* param)
    // Mount back the parameters
    MouseParams* mp = (MouseParams*)param;
    Mat & img = mp->img;
    mp->pt = Point(x,y);
    // ...    


int main() 
    MouseParams mp;
    setMouseCallback("draw mask", onMouse, (void*)&mp);