LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting AVI frames - converting to readily accessible BMPs

Solved!
Go to solution

Hi, Im at a roadblock currently, I need to extract frames from an AVI video then convert it to BMP images and load/apply it as a texture to an object in a 3D scene. Now the problem is not extracting the frames, Ive managed to extract the frames using the IMAQ AVI Vis available but Im stuck after that.
I found the 'write file as BMP' VI under Vision Utilities, one of the terminals of the VI says 'File Path' now does that mean the path it will write the file to? Or...?
Secondly, I can't seem to find a way of simultaenously loading/saving lots of BMPs. The texture I apply to the object is from a BMP picture (and in this case lots of BMP images extracted from the AVI video) just using the 'Read BMP file' vi, which leads back to the path/directory of the BMP on the PC. Which is where the problem lies, I need the 'Read BMP file' vi to continously update every "x" seconds to account for the number of frames / FPS of the video so it reads each frame from the video as its updated. But if I need to save the accquired AVI frames as BMPs I don't see a way of doing this.
Any suggestions would be greatly appreciated.

0 Kudos
Message 1 of 5
(5,201 Views)

Hi

As I understand from your post you have acquired your data, so the problem is writing the extracted files to bmp and saving the files.

 

I have been looking into your issue and have found some documentation which may help with your application.

 

1) You asked about the path input to the bmp.vi's, the input path is for the file that you wish to write the data to, as the data is input through the image data terminal.

When in LabVIEW there is a handy context help tool, if you type ctrl+h a small window opens, when you hover your mouse over a function the window will display the basic description for that item, in the window clicking on detailed help will take you straight to the correct document.

 

2) You were also asking about continuously reading and simultaneously loading/saving the bmp data.

The link below is for a presentation on design patterns which may help you make an informed decision about the architecture of your vi.

http://zone.ni.com/devzone/cda/tut/p/id/7605

 

I am going to continue to look into this for you, if you have any questions please feel free to ask and I will get back to you.

 

Thank you

Stephanie L

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 2 of 5
(5,182 Views)

Thanks for the swift reply.

My bad, I wasn't very clear in the first post about the problem.

Initially I was reading in one BMP image (from a BMP file already on the PC) using the 'read BMP' function and applying it as a texture for an object in a 3D scene. Now I'd like to do the same just with a video file (in .avi format).

Since there is no straight conversion or way I could directly feed the .avi file and apply it as a texture (to my knowledge) because the texture.vi accepts image data only.

To get around this, I extracted each individual frame from the avi file and had them written as BMPs but the problem is that I want to load all the BMP images I have written from the video (say 200 images) in about 14 seconds (length of the video) so that the texture being applied to the object corresponds to the video frames played at its natural FPS. I can't see how this is possible if I can only load one BMP path at a time unless I set up 200 paths and put them in a timed loop. So I was wondering if there was a cleverer way of doing this?


0 Kudos
Message 3 of 5
(5,173 Views)

Hi again

 

Sorry I initially misunderstood your problem. With respect to the AVI files I have found some examples within labVIEW which show read and write of avi files, maybe this would be a reasonable solution.

The file is in the example finder within the help section.

help>>find examples>>browse>>toolkits and modules>>vision>>functions>>AVI Read and Write With Data Example

The other AVI examples are also informative.

If you would like to look into this and I will continue to do some research.

Please ask any questions regarding this and I will get back to you shortly.

Stephanie L

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 4 of 5
(5,165 Views)
Solution
Accepted by Nik@Bris

Hi again

 

I hope your application is on the right track now. I have found some more examples for avi functionality so I will add the links below.

http://decibel.ni.com/content/docs/DOC-12618

http://decibel.ni.com/content/docs/DOC-8479

http://decibel.ni.com/content/docs/DOC-4672

 

If you have any further questions please feel free to ask

 

Thank you

Steph

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 5 of 5
(5,148 Views)