Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Callback parameters not being updated

Hi

i am using the setMouseCallback, same usage as https://answers.opencv.org/question/32888/passing-multiple-parameters-with-the-setmousecallback-function/.it My structure is as follows:

struct cbParams_t { Point pSingle; vector<point> pUpAndpDown; Mat cropped; int count; cbParams_t() : pSingle(), pUpAndpDown(), croppedCloth(), count() {} } ;

But for some reason count seems to not be updated, the code:

cbParams_t cbParams; setMouseCallback( "Img2", onMouseImg2, &cbParams ); //1

Inside the callback: static void onMouseImg2(int event, int i, int j, int flags, void* param) ... cbParams_t * pCbParams = (cbParams_t ) param; int * pCount = &(pCbParams->count); ... ( pCount ) ++;

And painfully, count is still set to 0

Best regards.

Callback parameters not being updated

Hi

i am using the setMouseCallback, same usage as https://answers.opencv.org/question/32888/passing-multiple-parameters-with-the-setmousecallback-function/.it My structure is as follows:

struct cbParams_t { Point pSingle; vector<point> pUpAndpDown; Mat cropped; int count; cbParams_t() : pSingle(), pUpAndpDown(), croppedCloth(), cropped(), count() {} } ;

But for some reason count seems to not be updated, the code:

cbParams_t cbParams; setMouseCallback( "Img2", onMouseImg2, &cbParams ); //1

Inside the callback: static void onMouseImg2(int event, int i, int j, int flags, void* param) ... cbParams_t * pCbParams = (cbParams_t ) param; int * pCount = &(pCbParams->count); ... ( pCount ) ++;

And painfully, count is still set to 0

Best regards.

Callback parameters not being updated

Hi

i am using the setMouseCallback, same usage as https://answers.opencv.org/question/32888/passing-multiple-parameters-with-the-setmousecallback-function/.it My structure But for some reason one of the fields is as follows:not updated inside the callback The code:

 struct cbParams_t
 {
     Point pSingle;
    vector<point>     vector<Point> pUpAndpDown;
     Mat cropped;
croppedCloth;
        int count;
     cbParams_t() : pSingle(), pUpAndpDown(), cropped(), croppedCloth(), count() {}
 } ;

But for some reason count seems to not be updated, the code:

; // registering the callback: cbParams_t cbParams; setMouseCallback( "Img2", onMouseImg2, &cbParams ); //1

Inside ) // inside the callback: static void onMouseImg2(int event, int i, int j, int flags, void* param) ... { cbParams_t * pCbParams = (cbParams_t ) param; *) param ; int * pCount = &(pCbParams->count); ... ( (* pCount ) ++;

And painfully, ++; ... } // but when i come back inside the callback count is still set to 0

not incremented

Best regards.