[問題] OpenCV VideoWrite 存出的影片全黑幕
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC# 2010
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
EmguCV 2.3.0.1416
問題(Question):
使用VideoWriter將以運算完成之frames(Bitmap)存入影片檔案
檔案建立成功,但是撥放時卻是從頭黑畫面到尾
已經確認算出來的frame是正確的(有在程式中播放出來)
餵入的資料(Input):
一堆Bitmap
預期的正確結果(Expected Output):
正確的影片檔案
錯誤結果(Wrong Output):
影片全部黑幕
程式碼(Code):(請善用置底文網頁, 記得排版)
VideoWriter vw = new VideoWriter("D:\\DAS_Out.avi",
-1 , 30, 800, 450, false);
for (int i = 0; i < 300; i++)
{
currentFrame = i;
capture.SetCaptureProperty(
Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_POS_FRAMES,
currentFrame);
videoImg = capture.QueryFrame();
_InputImage = videoImg.ToBitmap();
DAS(); //影像處理,將_InputImage經運算存入_OutputImage
vw.WriteFrame(new Image<Bgra,Int32>(_OutputImage));
}
vw.Dispose();
補充說明(Supplement):
輸出影片使用未壓縮格式
運算結果(_OutputImage)已經確認是正確的
也測試過將_OutputImage轉成Image<Bgra,Int32>再傳換回來,也是正確的
所以推測問題出在將Image<Bgra,Int32>寫入檔案的時候?
vw.WriteFrame(new Image<Bgra,Int32>(_OutputImage));
但是不知道原因,得請教各位板友了,謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.117.168.131
※ 編輯: zoeysui 來自: 114.33.154.28 (12/30 21:19)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章