Ask Your Question
2

Mouse cursor disappears

asked 2016-01-03 10:18:20 -0600

Nbb gravatar image

updated 2020-11-16 16:33:47 -0600

Hello,

I am reading in a video of size 1280 x 780 and then I copy it over to a newly created Mat of 1920 x 1080 filled with the value 127. Why is it that the mouse cursor disappears when I move it out of the video region ? The cursor disappears when I move it into the gray region (picture below). The black region is the video. image description

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-01-03 13:37:59 -0600

updated 2016-01-03 13:45:26 -0600

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();
}
edit flag offensive delete link more

Comments

Thanks ! Was trying to create my own UI. Didnt know about this.

Nbb gravatar imageNbb ( 2016-01-07 01:58:28 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-01-03 10:18:20 -0600

Seen: 1,016 times

Last updated: Jan 03 '16