Thread Subject: How to generate Binary file from *.avi format?

Subject: How to generate Binary file from *.avi format?

From: Suraj

Date: 24 Jan, 2012 10:43:10

Message: 1 of 6

I've a video of format *.avi, and I need to extract the binary file of it. How do I proceed to save in binary format (*.bin).

Later I need this bin format for processing using computer vision toolbox.

Subject: How to generate Binary file from *.avi format?

From: Mohammad Khan

Date: 24 Jan, 2012 14:47:14

Message: 2 of 6

Hi Suraj,

The System Object vision.VideoFileReader can be used to read frames of a
video (most of the popular formats, including .avi). The System Object
vision.BinaryFileWriter can be used to write a video in binary format
(*.bin). If you just want to process every frame of a video in .avi format,
you don't need to convert it to a binary format first. You may want to look
at the Matlab demo "Tracking Cars Using Optical Flow" in Computer Vision
System Toolbox to see how it is done.

Thanks,
Mohammad

"Suraj " <suraj.kv.blog@gmail.com> wrote in message
news:jfm1vu$lf2$1@newscl01ah.mathworks.com...
> I've a video of format *.avi, and I need to extract the binary file of it.
> How do I proceed to save in binary format (*.bin).
>
> Later I need this bin format for processing using computer vision toolbox.

Subject: How to generate Binary file from *.avi format?

From: Suraj

Date: 24 Jan, 2012 15:37:10

Message: 3 of 6

Hi,

I've seen the demo. They have used 'viptraffic.bin' for their code. But how can I make a bin file for my avi format. The code given as:

filename = fullfile('output.bin');
hbfr = vision.BinaryFileReader;
hbfw = vision.BinaryFileWriter(filename);

 while ~isDone(hbfr)
   [y,cb,cr] = step(hbfr);
   step(hbfw,y,cb,cr);
 end

 release(hbfr); % close the input file
 release(hbfw); % close the output file

The code actually reads a empty binary file before writing. But any where in the vision.BinaryFileWriter(filename); No *.avi format is specified.

I even tried:
vision.BinaryFileWriter(filename, 'video.avi');
Didn't succeed. Any idea how to over come this?

Subject: How to generate Binary file from *.avi format?

From: Mohammad Khan

Date: 24 Jan, 2012 15:59:46

Message: 4 of 6

Here is the latest version of the demo that reads a video in .avi format
instead of .bin format:
http://www.mathworks.com/products/computer-vision/demos.html?file=/products/demos/shipping/vision/videotrafficof.html

Please note that the demo may not work in older version of Matlab, but first
part of the demo shows how to process each frame of a video in avi format.

Hope this helps.
Mohammad

"Suraj " <suraj.kv.blog@gmail.com> wrote in message
news:jfmj76$iam$1@newscl01ah.mathworks.com...
> Hi,
>
> I've seen the demo. They have used 'viptraffic.bin' for their code. But
> how can I make a bin file for my avi format. The code given as:
>
> filename = fullfile('output.bin');
> hbfr = vision.BinaryFileReader;
> hbfw = vision.BinaryFileWriter(filename);
>
> while ~isDone(hbfr)
> [y,cb,cr] = step(hbfr);
> step(hbfw,y,cb,cr);
> end
>
> release(hbfr); % close the input file
> release(hbfw); % close the output file
>
> The code actually reads a empty binary file before writing. But any where
> in the vision.BinaryFileWriter(filename); No *.avi format is specified.
>
> I even tried:
> vision.BinaryFileWriter(filename, 'video.avi'); Didn't succeed. Any idea
> how to over come this?

Subject: How to generate Binary file from *.avi format?

From: Suraj

Date: 24 Jan, 2012 16:24:10

Message: 5 of 6

Thanks, I didn't see that matlab help online was updated.

Anyways, I still got the error and the tracking was unsuccessful and no rectangle was seen.

??? Index exceeds matrix dimensions.

Error in ==> gussianfilter at 72
    ratio(Idx) = single(area(Idx,1))./single(bbox(Idx,3).*bbox(Idx,4));

Subject: How to generate Binary file from *.avi format?

From: Mohammad Khan

Date: 24 Jan, 2012 16:57:28

Message: 6 of 6

The following thread may be helpful:
http://www.mathworks.com.au/matlabcentral/newsreader/view_thread/281071

Mohammad

"Suraj " <suraj.kv.blog@gmail.com> wrote in message
news:jfmlv9$s90$1@newscl01ah.mathworks.com...
> Thanks, I didn't see that matlab help online was updated.
>
> Anyways, I still got the error and the tracking was unsuccessful and no
> rectangle was seen.
>
> ??? Index exceeds matrix dimensions.
>
> Error in ==> gussianfilter at 72
> ratio(Idx) = single(area(Idx,1))./single(bbox(Idx,3).*bbox(Idx,4));
>

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
image processing Suraj 24 Jan, 2012 05:44:12
binary file Suraj 24 Jan, 2012 05:44:12
rssFeed for this Thread

Contact us at files@mathworks.com