Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Image Data from LabVIEW in Python

Hello I am trying to pass an image captured in LabVIEW to a python script and I am having trouble displaying the image in the python script because of the data passed being U16 data or a string.

I have attached the python and labview programs. Any help would be great:)

Download All
0 Kudos
Message 1 of 5
(2,505 Views)

I recreated your VI and python code and I think the issue is that you're using the wrong output from 'IMAQ Image to Array.vi'

 

In your screenshot, it shows that you're taking the I16 output of that vi, not the U16 output. Since your image is U16, the I16 output will be empty.

 

LabVIEW 2.png

 

Try changing the terminal you have 'image' connected to to the following:

rewired.PNG

0 Kudos
Message 2 of 5
(2,466 Views)

Thank you for the reply. Yes, I have tried this. The screenshot was probably an iteration that I did not revert back to the U16 connection. My apologies. It still gives errors when trying to display the image in python when the image data is sent. Either with the array or the actual image data.

0 Kudos
Message 3 of 5
(2,463 Views)

Try changing the endianness of the U16. It may well be that LabVIEW's data does not match Python's representation. I have seen this before with external code.

0 Kudos
Message 4 of 5
(2,431 Views)

Any thoughts on how to pass a color image?  Do you have to pass per plane and then re-assemble?  The only other idea I have is to pass a file path and use the load and save functions in opencv.  Kinda janky, and very in-efficient, but would work.

0 Kudos
Message 5 of 5
(2,288 Views)