[問題] Opencv debug & release mode問題

看板C_and_CPP (C/C++)作者 (笨小孩)時間10年前 (2016/04/29 06:45), 10年前編輯推噓1(108)
留言9則, 5人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC2015 Community 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) OpenCV 3.0.0 問題(Question): 1. 為何只有在debug mode imwrite時會出現Access violation reading location問題 2. 為何debug mode出錯不是顯示(opencv_world300d.dll)而是(opencv_world300.dll) 餵入的資料(Input): 程式如下圖,有餵入一張圖且有成功show出來 http://i.imgur.com/ADKPUiL.png
預期的正確結果(Expected Output): 圖可以顯示出來也可以存檔 錯誤結果(Wrong Output): 如下面截圖所示 http://i.imgur.com/PDzNnFP.png
程式碼(Code):(請善用置底文網頁, 記得排版) #include <iostream> #include <opencv2/opencv.hpp> #include <opencv2/features2d/features2d.hpp> #include <cv.h> #include <highgui.h> using namespace cv; int main(void) { Mat img_object = imread("./test.png", CV_LOAD_IMAGE_GRAYSCALE); namedWindow("test.png", CV_WINDOW_AUTOSIZE); imshow("test.png", img_object); waitKey(0); imwrite("./out.jpg", img_object); return 0; } 補充說明(Supplement): 1. release mode不會 2. 我是用opencv build 好的lib&dll 3. 有在專案裡設定include lib dll等路徑與相依檔案 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.251.197.95 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1461883532.A.717.html ※ 編輯: hardman1110 (111.251.197.95), 04/29/2016 06:47:12

04/29 08:36, , 1F
library link 設錯 ?
04/29 08:36, 1F

04/29 08:38, , 2F
是說lib檔案的路徑嗎? 應該有對,不然跑不起來吧?
04/29 08:38, 2F

04/29 11:19, , 3F
可以問大大 為什麼讀檔要在檔名前面加上./呢?
04/29 11:19, 3F

04/29 11:21, , 4F
習慣而已...表示當前目錄下 (應該沒錯吧)
04/29 11:21, 4F

04/29 16:06, , 6F
5538.html
04/29 16:06, 6F

04/29 16:09, , 7F
http://goo.gl/Ldo9Ps 參考看看~
04/29 16:09, 7F

04/30 02:16, , 8F
檢查一下lib是不是填成 opencv_world300.lib (少一個d)
04/30 02:16, 8F

04/30 02:19, , 9F
我把release的lib用在debug組態也重現了你的錯誤
04/30 02:19, 9F
文章代碼(AID): #1N8fACSN (C_and_CPP)
文章代碼(AID): #1N8fACSN (C_and_CPP)