Ask Your Question

beldachi's profile - activity

2013-09-26 05:37:32 -0600 commented answer Grayscale avi to image

Thanks for your time and help my friend :)

2013-09-26 01:58:16 -0600 commented answer Grayscale avi to image

I use OpenCV 2.3.1.Yes it seems there is a problem with the avi files. I have downloaded some grayscale avi s from http://users.soe.ucsc.edu/~milanfar/software/sr-datasets.html and it works perfect. Could you please tell me how did you find out about the segmentation fault?

2013-09-25 09:36:30 -0600 commented answer Grayscale avi to image
2013-09-25 08:56:11 -0600 commented answer Grayscale avi to image

how can i send it to you as i can't upload a video here :)

2013-09-25 08:40:47 -0600 commented answer Grayscale avi to image

no, it doesn't make any diffrence :)

2013-09-25 08:23:34 -0600 commented answer Grayscale avi to image

I have tried it.I can see the diffrence in colour avi but the grayscale one gives me all black for r , b and g :)

2013-09-25 08:12:26 -0600 commented question Grayscale avi to image

yes, I checked it before frame.converTo()

2013-09-25 07:18:51 -0600 commented question Grayscale avi to image

the number is 16 :)

2013-09-25 07:06:59 -0600 commented question Grayscale avi to image

Hi Moster;

In both cases (gray scale and colour), the captured frames are CV_8U.

Best, Beldachi

2013-09-25 04:15:08 -0600 asked a question Grayscale avi to image

Hi :) I would like to convert a grayscale avi to images. I use the following code but the produced images are all black. When I use a colour avi, it does work perfect but it doesn't work for grayscale avi. How can I solve this problem? Thanks for your help. Best; Beldachi


int main (int argc, char **argv)
{
   if (argc !=2)
   { 
   std::cout << "USE: " << argv[0] << " <video-filename>" << std::endl;
    return -1;
   }

  //Open the video that you pass from the command line
  cv::VideoCapture cap(argv[1]);
  if (!cap.isOpened())
  {
   std::cerr << "ERROR: Could not open video " << argv[1] << std::endl;
   return -1;
  }

  int frame_count = 0;
  bool should_stop = false;

  while(!should_stop)
  {
     cv::Mat frame;
     cap >> frame; //get a new frame from the video
     if (frame.empty())
     {
        should_stop = true; //we arrived to the end of the video
        continue;
     }

      char filename[128];
      sprintf(filename, "frame_%06d.jpg", frame_count);  
      frame.convertTo(frame,CV_8U); 
      cv::imwrite(filename, frame);
      frame_count++;
 }

 return 0;
}