Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Load avi files

Subject: Load avi files

From: Torvald Helmer

Date: 7 Feb, 2008 11:26:03

Message: 1 of 7

I load an avi-file into matlab and it gets saved, in this
case, in a 1x170 struct. Each block/cell inside the struct
contains a cdata-field with 175x260x3 uint8.

How can I get this in a variable of 175x260x170 double?

Subject: Load avi files

From: Malcolm Lidierth

Date: 7 Feb, 2008 11:41:04

Message: 2 of 7

Try
x=double(structname.fieldname);

Subject: Load avi files

From: Malcolm Lidierth

Date: 7 Feb, 2008 11:50:03

Message: 3 of 7

That should be
x=double(structname(index).fieldname);

"Malcolm Lidierth" <ku.ca.lck@htreidil.mloclam> wrote in
message <foeqog$27i$1@fred.mathworks.com>...
> Try
> x=double(structname.fieldname);
>

Subject: Load avi files

From: Yumnam Kirani Singh

Date: 7 Feb, 2008 12:13:42

Message: 4 of 7

Do you mean you have 170x175x260x3 data, i.e, 170 image color frames of size 175x260?

Subject: Load avi files

From: Torvald Helmer

Date: 7 Feb, 2008 12:37:02

Message: 5 of 7

Yumnam Kirani Singh <kirani.singh@gmail.com> wrote in
message
<28418001.1202386452430.JavaMail.jakarta@nitrogen.mathforum.org>...
> Do you mean you have 170x175x260x3 data, i.e, 170 image
color frames of size 175x260?


That is correct! I have a true color-video of 170 frames,
with size 175x260...

This will further on be converted to binary-image...

Subject: Load avi files

From: nor ki

Date: 7 Feb, 2008 14:03:07

Message: 6 of 7

"Torvald Helmer" <torvald.helmer@mathworks.com> wrote in
message <foeu1e$nir$1@fred.mathworks.com>...
> Yumnam Kirani Singh <kirani.singh@gmail.com> wrote in
> message
>
<28418001.1202386452430.JavaMail.jakarta@nitrogen.mathforum.org>...
> > Do you mean you have 170x175x260x3 data, i.e, 170 image
> color frames of size 175x260?
>
>
> That is correct! I have a true color-video of 170 frames,
> with size 175x260...
>
> This will further on be converted to binary-image...

avidata = aviread(avifile);
newdatadouble = double(avidata.cdata);

Subject: Load avi files

From: Vihang Patil

Date: 7 Feb, 2008 16:48:02

Message: 7 of 7

"Torvald Helmer" <torvald.helmer@mathworks.com> wrote in
message <foepsb$j2o$1@fred.mathworks.com>...
> I load an avi-file into matlab and it gets saved, in this
> case, in a 1x170 struct. Each block/cell inside the struct
> contains a cdata-field with 175x260x3 uint8.
>
> How can I get this in a variable of 175x260x170 double?

You cannot get a RGB image in the above said format. You can
get it in 4-D format

ex:
D(:,:,:,1) = mov(1,1).cdata;
D(:,:,:,2) = mov(1,2).cdata; so on and so forth

If you are going to convert the RGB image into grayscale or
binary then its possibe to have them stored in mxnxp format
as follows

D(:,:,:,1) = rgb2gray(mov(1,1).cdata);
D(:,:,:,2) = rgb2gray(mov(1,2).cdata);

and then use
D1 = squeeze(D);


HTH
VIhang

Tags for this Thread

No tags are associated with this thread.

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.

Contact us