I want to get coordinate X/Y from image, how to use setmousecallback opencv in button winforms? Thank you
1 | initial version |
I want to get coordinate X/Y from image, how to use setmousecallback opencv in button winforms? Thank you
I want to get coordinate X/Y from image, how to use setmousecallback opencv in button winforms?
Thank youyou
Button code :
private: System::Void b_SAsel_Click(System::Object^ sender, System::EventArgs^ e) {
namedWindow("Display window", 0);
Mat img = imread("PIC 1.jpg");
setMouseCallback("Display window", mouseHandler, &img);
}
I want to get coordinate X/Y from image, how to use setmousecallback opencv in button winforms?
Thank you
Button code :
:
private: System::Void b_SAsel_Click(System::Object^ sender, System::EventArgs^ e) {
namedWindow("Display window", 0);
Mat img = imread("PIC 1.jpg");
setMouseCallback("Display window", mouseHandler, &img);
}}
mousehandler code :
static void mouseHandler(int event, int x, int y, int, void* imgptr){
Point2f coordinate[30][30];
int temp;
RNG rng(12345);
cv::Point pts[30];
Mat shape, kontur;
Mat res;
if (event != 1) return;
Mat & img = (*(Mat*)imgptr);
cv::Point pt1 = cv::Point(x, y);
temp++;
pts[temp - 1] = cv::Point(x, y);
cout << temp << endl;
coordinate[temp][0] = Point2f(float(x), float(y));
img.copyTo(shape);
img.copyTo(kontur);
.................
...........
}
i got this error : Error 10 error C2664: 'void cv::setMouseCallback(const cv::String &,cv::MouseCallback,void *)' : cannot convert argument 2 from 'void (__clrcall *)(int,int,int,int,void *)' to 'cv::MouseCallback' ...\guithes1\guithes\guithesDlg.h 395 1 GUITHES