0

I am trying to write a video with some sequence of depth map.

I have converted the depth image from cv::Mat_ to cv::Mat with single channel. But no codec I use is able to open the avi file I want to write. The VideoCapture.open(...) doesn't seem to be able to either create the file or open it.

I think its the problem choosing the right codec. I might be wrong. I have posted a small code snippet.

cv::VideoWriter outputVideo_;
source_ = "~/Hello.avi";
cv::Size S(480, 640);
outputVideo_.open(source_, CV_FOURCC('D','I','B', ' '), 20, S, false);

if (!outputVideo_.isOpened())
{
  std::cout  << "Could not open the output video for write: " << source_ << std::endl;
  return;
}

How do I get opencv to work correctly in this case. I am using linux 12.04, ROS (Robot Operating System) and OpenCV 2.4.2

navderm
  • 799
  • 2
  • 11
  • 33

1 Answers1

0

Try to use open() function with only file name. because here with me it works well.

VideoWriter outputVideo_;
source_ = "~/Hello.avi";
// cv::Size S(480, 640);
outputVideo_.open(source_);

if (!outputVideo_.isOpened())
{
  std::cout  << "Could not open the output video for write: " << source_ << std::endl;
  return;
Nabil
  • 29
  • 1
  • 4