i want to write a program with this feature: 1:when a user click left button of mouse on windows a circle is constructed with 15 radius at first i make a black image 500500 and i use setMouseCallback for my_mouse_callback and in function my_mouse_callback i write my circle code ,when run the program there arent any errors but only there is a black image 500500 i know my program has trouble but where? please help me my program is like this:
include <cv.h>
include <highgui.h>
include <iostream>
using namespace std; using namespace cv; Mat image; void my_mouse_callback( int event, int x, int y, int flags, void* param ); int main() { int i,j,k; Mat image; image.create(500,500,CV_8UC3); namedWindow("amin"); for(i=0;i<500;i++){ for(j=0;j<500;j++){ for(k=0;k<3;k++){ Vec3b &intensity = image.at<vec3b>(j, i); intensity.val[k]=0; } } } setMouseCallback( "amin", my_mouse_callback, &image );
imshow("amin",image);
waitKey(0);
return(0);
} void my_mouse_callback( int event, int x, int y, int flags, void* param ) { Mat &image= ¶m; if(event==CV_EVENT_LBUTTONDOWN){ circle( image, Point(x,y), 20, Scalar(0xff,0xff,0xff)
);
}
}