Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying 3D RGB image matrix (from MATLAB) in Labview

Solved!
Go to solution

Hi. I am trying to display the 3-dimensional RGB image matrix/array (from MATLAB) in LabVIEW. MATLAB returns a 3D matrix with the RGB data, but it seems LabVIEW only takes 2D matrices. Is there anyway to display the image in labview?

 

Thanks!

0 Kudos
Message 1 of 6
(7,061 Views)
Hello,

if you interpret the matlab rgb image in labview, it is a 3-dimensional 2d array. Each dimension contains the color plane (red,green and blue). Each 2d array represents the respective intensities.

So in order to read the rgb image you have to use an equation to convert each corresponding intensity value (of all three planes) to rgb value. You can find such equation models easily on the web.

The easier approach is to use Imaq replace color plane,after "converting" each pixel array to image reference.


Hope this helps you.

Best regards,
K

https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 2 of 6
(7,040 Views)
Solution
Accepted by topic author hyun.suh

...and here is the sample code (matlab and labview). Yesterday i didn't have access to my computer.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 3 of 6
(7,033 Views)

Dear Klemen,

 

 Your sample code works great! Thank you very much for this.

 

 Let me move a step further. The 3-dimensional 2D array has already been stored in the memory space (made dll with given matlab code). If there is any function to take R/G/B bit value of each plane in LabVIEW, would it be faster to read directly from memory (probably with array rearrangement or different order) and to display it? 

 

Thanks!

Hyun K. Suh

0 Kudos
Message 4 of 6
(7,005 Views)

Hello,

 

if you have a dll, you could call it in labview.

I do not know anything about creating a dll in matlab, but have some experience creating dll in c++. You can check out the code i've just attached to another thread here. You can use "call library function node" to use the dll in labview.

 

If you share the matlab code (and dll), maybe i can help you further.

 


Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 5 of 6
(7,002 Views)

Dear Klemen,

 

 Thanks again for your quick help! The problem is solved.

 

Thanks super!

Hyun K. Suh

0 Kudos
Message 6 of 6
(6,990 Views)