Return RGB values of the the current Pixel ?
How to return the RGB values of the current Pixel i stop on it by the mouse cursor??
My Code:
#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <iostream>
void mouseEvent(int evt, int x, int y, int flags, void* param){
evt==CV_EVENT_MOUSEMOVE;
printf("Current Position: x= %d y= %d\n",x,y);
}
int main()
{
cvNamedWindow("rgb");
CvCapture*capture =cvCaptureFromCAM(0);
IplImage* rgb ;
while(1){
rgb= cvQueryFrame( capture );
cvShowImage("rgb",rgb);
cvSetMouseCallback("rgb", mouseEvent, 0);
char c = cvWaitKey(33);
if( c == 27 ) break;
}
cvReleaseCapture( &capture );
cvDestroyWindow( "rgb" );
}