Ask Your Question
2

Mouse cursor disappears

asked Jan 3 '16

Nbb gravatar image

updated Nov 16 '0

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

Preview: (hide)

1 answer

Sort by » oldest newest most voted
2

answered Jan 3 '16

updated Jan 3 '16

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();
}
Preview: (hide)

Comments

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

Nbb gravatar imageNbb (Jan 7 '16)edit

Question Tools

1 follower

Stats

Asked: Jan 3 '16

Seen: 1,040 times

Last updated: Jan 03 '16