Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving as Flash in C++

How to save an IPLImage of OpenCV as a Flash file? Maybe there is a library that does that?

like image 668
lital maatuk Avatar asked Feb 23 '11 21:02

lital maatuk


2 Answers

If you mean storing your output as a flash video (.flv) just use ffmpeg (libavcodec/libavformat). It is cross platform and supports the .flv format (besides a massive amout of others) and should be quite easy to do. You can embed audio too.

As a note: ffmpeg is partially included in opencv (depending on your build) as a video coder/decoder, i don't know though if you can force it to write as .flv (by choosing the right codec string) from within opencv. Anyways it's not too hard to convert IplImage to a ffmpeg buffer and store from there.

A problem you might have is that latest opencv (2.1) has trouble to build with ffmpeg support or is build against some ffmpeg version you don't want. But as mentioned above you don't need to use ffmpeg via the opencv 2.1 api, since you can use it directly by using the ffmpeg api.

Look for the examples in libavcodec on how to write a video, and check the opencv source on how to convert from IplImage to AVPacket/AVFrame. I've done this before and it was quite easy to do.

like image 117
count0 Avatar answered Oct 10 '22 21:10

count0


I don't know Flash much, but you can manipulate the data pointer of an IplImage (named char *imageData). Data is accessible as between 1 and 4 bit plans, in a format you surely know. Try writing your Flash file from this data pointer.

like image 43
Stéphane Péchard Avatar answered Oct 10 '22 19:10

Stéphane Péchard