Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i pass an imaq sequence into Matlab?

Solved!
Go to solution

I would like to be able to pass an Imaq seqence (128x128 x 1500 frames x 2 bytes/pixel) directly into Matlab for processing.  I am currently saving the image sequence to an array (imaq image to array vi), saving the array and then opening it in matlab.  this process is painfuly slow and save a lot of unneccesary data - the matlab code generates and saves a processed subset of the data.

0 Kudos
Message 1 of 7
(5,177 Views)

 Hey Jwock,

 

You can use the "Image Acquisition Toolbox" 

 

which is a Matlab's tool that allows you to acquire images and video from cameras and frame grabbers directly into MATLAB and Simulink. You can detect hardware automatically and configure hardware properties.

 

I leave you a reference here for you to check it out:

 

"Image Acquisition Toolbox Documentation"
http://www.mathworks.com/help/imaq/index.html

 

Hope that helps to adress you in the right direction.

 

Regards!

 

Daniel C.

 

0 Kudos
Message 2 of 7
(5,122 Views)

Daniel,

 

Thanks for the reply.  I am using the IMAQ toolbox to setpup my camera and acquire data.  That's not the problem.  My data is a contiguous sequence of >1000 frames, which I can acquire using the various tools in that toolbox.  I want to pass the data into Matlab, which is superior for the image processing I need to perform.  In order to do that, I am writing and saving the image data to a pre-allocated Labview 3D array and then opening the file in a Matlab script window, which is both cumbersome and slow.  The Matlab script interface only allows me to pass 2D real arrays, but my data is 3D.

 

-S

0 Kudos
Message 3 of 7
(5,116 Views)

Sorry, I should have added that I am stuck using hte Labview acquisition environment.

0 Kudos
Message 4 of 7
(5,115 Views)
I'd convert each image to a 1D array (instead of 2D) and then make your 2D array from that. Then in Matlab you can reshape each array back to a 2D one based on the known dimensions. This is certainly much more efficient than using a file.
0 Kudos
Message 5 of 7
(5,109 Views)

that's a good idea as a work-around but there has to be a better way to do this. i will continue to bang my head against it as time permits and post whatever solution i come up with.  i don't believe i am the only one with this issue.

0 Kudos
Message 6 of 7
(5,102 Views)
Solution
Accepted by topic author jwock

Figured it out...turns out that Matlab remains persistent in the Labview environment once it's been called so a simple Labview loop on the number of frames does the trick nicely...

 

 

0 Kudos
Message 7 of 7
(5,036 Views)