1 | initial version |
What you basically do is creating a void* to the image, then inside your handler you do
void onMouse(int event, int x, int y, int flags, void* param)
{
Mat src;
src = *((Mat*)param);
...
and in source code you do
setMouseCallback("source", onMouse, &src);
2 | No.2 Revision |
What you basically do is creating a void* to the image, then inside your handler you do
void onMouse(int event, int x, int y, int flags, void* param)
{
Mat src;
src = *((Mat*)param);
...
and in source code you do
setMouseCallback("source", onMouse, &src);
or if you really do not care about copies and optimized code, just make a global Mat
element and address it from everywhere. Thats how the tutorials do it.