【发布时间】:2014-04-24 22:41:50
【问题描述】:
我需要从一系列图像中编写视频。我正在使用此代码:
int main()
{
//Read sequence of images
Size frameSize(1360,1024);
//cout<<path<<endl;
VideoCapture sequence("path/fr%1d.jpg");
if (!sequence.isOpened())
{
cerr << "Failed to open Image Sequence!\n" << endl;
return -1;
}
//Write video
VideoWriter oVideoWriter ("path/MyVideo.avi",CV_FOURCC('8','B','P','S'), 15
, frameSize);
Mat imageGrey;
if(!oVideoWriter.isOpened())
{
cout<<"ERROR: Failed to write the video"<<endl;
return -1;
}
Mat Image;
int i=0;
while(true)
{
sequence>>Image;
if(Image.empty())
break;
cout<<i<<endl;
Mat imageArr[] = {Image, Image, Image};
merge(imageArr, 3, imageGrey);
//cvtColor(Image,imageGrey,CV_GRAY2BGR);
oVideoWriter.write(imageGrey);
i++;
}
cout<<"video written!"<<endl;
return 1;
}
与 Windows 7 中的视频相比,我得到一个非常暗的视频。我认为这是编解码器的问题。什么是适用于 mac os x 的最佳编解码器。谢谢
【问题讨论】: