iPhone and OpenCV

Posted by gn-mithun on Stack Overflow See other posts from Stack Overflow or by gn-mithun
Published on 2010-05-14T04:09:03Z Indexed on 2010/05/14 4:14 UTC
Read the original article Hit count: 293

Filed under:

Hello,

   I am writing an application to create a movie file from a bunch of images on an iPhone. I am using OpenCv. I downloaded openCv static libraries for arm(iPhones native instruction architecture) and the libraries were generated just fine. There were no problems linking to them libraries.

As a first step, i was trying to create a .avi file using one image, to see if it works. But cvCreateVideoWriter always returns me a NULL value. I did some searchin and i believe its due to the codec not being present. I am trying this on the iPhone simulator. this is what i do...

  • (void)viewDidLoad { [super viewDidLoad]; UIImage *anImage = [UIImage imageNamed:@"1.jpg"]; IplImage *img_color = [self CreateIplImageFromUIImage:anImage]; //The image gets created just fine

    CvVideoWriter *writer = cvCreateVideoWriter("out.avi",CV_FOURCC('P','I','M','1'), 25,cvSize(320,480),1); //writer is always null

    int result = cvWriteFrame(writer, img_color); NSLog(@"\n%d",result); //hence this is also 0 all the time cvReleaseVideoWriter(&writer);

}

I am not sure about the the second parameter. What sort of codec or what exactly it does... I am a n00B in this. Any suggestions?

© Stack Overflow or respective owner

Related posts about opencv