Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

apple users always suspect, that it's about their funny little boxes, but here - not so.

your mouse handler expects to be passed an image via the void* param, but you fail to give it an image

so, that should be:

cv::setMouseCallback(ORIGINAL_WINDOW_NAME, MouseHandler::onMouse, (void*)(&image));

you also should check for invalid pointers:

void  MouseHandler::onMouse(int event, int x, int y, int, void *param) {
    std::cout << "Mouse event fired!" << std::endl;
    if (!param) {
        std::cout << "there is no image !!" << std::endl;
        return;
    }
    cv::Mat *im = static_cast<cv::Mat *>(param);
    ....