Ask Your Question

Revision history [back]

yes mouse cursor is invisible on gray ( Scalar( 127, 127, 127) )

i think you will understand the reason if you try the code below and move mouse on the gradient image.

Cursor becomes white over dark pixels and becomes black over light pixels. the algorithm fails on gray pixels.

#include "highgui.hpp"

using namespace cv;
using namespace std;

int main( int argc, char** argv )
{
    vector<uchar> testVector;

    for( int i = 0; i < 65536; i++)
    {
        testVector.push_back( i % 256 );
    }

    Mat testMat = Mat( testVector ).reshape( 0, 256 );

    imshow("Black to White Gradient",testMat);
    waitKey();
}

yes mouse cursor is invisible on gray ( Scalar( 127, 127, 127) )

i think you will understand the reason if you try the code below and move mouse on the gradient image.

representative image

image description

Cursor becomes white over dark pixels and becomes black over light pixels. the algorithm fails on gray pixels.

#include "highgui.hpp"

using namespace cv;
using namespace std;

int main( int argc, char** argv )
{
    vector<uchar> testVector;

    for( int i = 0; i < 65536; i++)
    {
        testVector.push_back( i % 256 );
    }

    Mat testMat = Mat( testVector ).reshape( 0, 256 );

    imshow("Black to White Gradient",testMat);
    waitKey();
}