Programowanie w systemie UNIX/OpenCV: Różnice pomiędzy wersjami

Usunięta treść Dodana treść
m →‎mysz: nowy kod
Linia 191:
#include <cv.h>
#include <highgui.h> // highgui_c.h
 
 
int height,width,step,channels;
uchar *data;
 
 
// https://opencv-srf.blogspot.com/2011/11/mouse-events.html
// http://opencvexamples.blogspot.com/2014/01/detect-mouse-clicks-and-moves-on-image.html
// https://www.codeproject.com/Articles/526218/An-introduction-to-OpenCV-Part-II-Implementing-mou
 
void CallBackFuncOnMouse(int event, int x, int y, int flags, void* userdataparam)
{
 
IplImage* image = (IplImage*) param; // https://www.safaribooksonline.com/library/view/learning-opencv/9780596516130/ch04s04.html
if ( event == CV_EVENT_LBUTTONDOWN )
{
Linia 213 ⟶ 221:
{
// cout << "Mouse move over the window - position (" << x << ", " << y << ")" << endl;
printf(" x= %d ; y = %d B = %d G = %d R = %d\n ", x, y, data[y*step+x*channels+0], data[y*step+x*channels+1], data[y*step+x*channels+2]);
 
Linia 225 ⟶ 233:
{
IplImage* img = 0;
int height,width,step,channels;
uchar *data;
int i,j,k;
Linia 265 ⟶ 273:
//set the callback function for any mouse event
// https://stackoverflow.com/questions/15570431/opencv-return-value-from-mouse-callback-function
//
cvSetMouseCallback("mainWin", CallBackFuncOnMouse, NULL(void*) img);
// changed value of p will be accessible here
// here
 
 
Linia 281 ⟶ 290:
printf("OpenCV version = %s\r\n", CV_VERSION);
return 0;
}</source>
}
</source>
 
==c++==