[問題] OpenCV in windows form(callback)
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC2010
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
OpenCV
問題(Question):
我需要使用 OpenCV 裡的 cvSetMouseCallback 來寫滑鼠事件
同樣的 code 在一般空專案執行都沒有問題
但改在 windows form下就會編譯錯誤
我的 code 是寫在一個 button click 的事件裡
編譯出現的錯誤訊息是:
"函式呼叫遺漏引數清單,請用 '&test_opencv1::Form1::on_mouse' 建立成員的指標"
程式碼(Code):(請善用置底文網頁, 記得排版)
cvSetMouseCallback("CamShiftDemo", on_mouse, NULL);
private:void on_mouse(int event, int x, int y, int flags, void* param){}
補充說明(Supplement):
on_mouse 內容應該是不影響編譯的
之前也有碰到類似的問題
就是簡單的宣告一個圖片再釋放掉
IplImage *img;
cvReleaseImage(&img);
但是如果把圖片的變數宣告為全域變數編譯就會出現錯誤(windows form)
最後的解決方式是在windows form的最外面宣告
static IplImage *img;
請問有人有遇過相同的問題嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 115.43.220.114
※ 編輯: mingpepe 來自: 115.43.220.114 (04/01 20:55)
※ 編輯: mingpepe 來自: 115.43.220.114 (04/01 20:57)
※ 編輯: mingpepe 來自: 115.43.220.114 (04/01 20:58)