[問題] Open CV: VideoCapture 開檔失敗

看板C_and_CPP作者 (隼)時間12年前 (2013/03/28 23:50), 編輯推噓3(3011)
留言14則, 6人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VS2012 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) opencv 2.4.3 問題(Question): 想讀入一個AVI影片,並且存取每一張frame的資訊 錯誤結果(Wrong Output): 直接return -1,表示根本沒有讀到影片 程式碼(Code):(請善用置底文網頁, 記得排版) int main(int argc,char*argv[]) { Mat frame; string path = "D:\\DSCN1244.avi"; VideoCapture capture(path); namedWindow("my_window"); if(!capture.isOpened())return -1; for(;;) { capture >> frame; imshow("my_window", frame); if(cvWaitKey(30) >= 0) break; } return 0; } 補充說明(Supplement): 已爬過文,並沒有解答 請各位先進提供可能原因 謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.68.157

03/29 01:36, , 1F
你確定路徑正確嗎?
03/29 01:36, 1F

03/29 01:36, , 2F
把exe檔跟avi檔放在一起執行看看
03/29 01:36, 2F

03/29 01:58, , 3F
最近在作作業時覺得2012的link做得好像很差...
03/29 01:58, 3F

03/29 11:04, , 4F
一樓這方法我已試過,一樣不行喔
03/29 11:04, 4F

03/29 20:40, , 5F
改成 path.c_str() ?
03/29 20:40, 5F

03/30 15:16, , 6F
大絕招 直接把影片放在PROJ目錄下
03/30 15:16, 6F

03/30 22:08, , 7F
把opencv的ffmpeg.dll放到程式目錄下試試看吧@@
03/30 22:08, 7F

03/31 21:36, , 8F
您好五樓,一樣RETURN -1
03/31 21:36, 8F

03/31 21:37, , 9F
大絕招在最一開始自己有試過,一樣gg
03/31 21:37, 9F

03/31 21:38, , 10F
6樓您好,有試過opencv_ffmpeg.dll opencv_ffmpeg_64.dl
03/31 21:38, 10F

03/31 21:39, , 11F
opencv_ffmpeg243.dll及opencv_ffmpeg243_64.dll都不行.
03/31 21:39, 11F

04/01 18:29, , 12F
我講一下 我之前是把 core, highgui, imgproc , video
04/01 18:29, 12F

04/01 18:29, , 13F
等三個 .dll 檔都直接搬到木錄下
04/01 18:29, 13F

04/01 22:11, , 14F
把影片放到專案內 可以直接打影片名稱不用給路徑
04/01 22:11, 14F
文章代碼(AID): #1HL6RZ7m (C_and_CPP)