Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQdx in Python only grabs a portion of the frame

Hello, 

 

I am using IMAQdx through Python and am experiencing an issue with the raw image frames. Both snap() and grab() seem to only capture a portion of the image. I've attached a images taken using NI MAX (software_image.png) and the IMAQdx library (imaqdx_image.png) for comparison. Note, there is a color difference in these images, but I don't care about this unless its indicative of the problem. I have tried four different cameras including the webcam, but they all have the issue. I have also looked at the raw image frame and have noticed that every 4th entry is zero. I'm assuming this is because the image is output in RGBA, but then shouldn't there be an image array of size w*h*4 instead of w*h*3 (see value of pic_size)? Below I have the simple script I am using to examine the raw frame...

 

from pylablib.devices.IMAQdx import IMAQdx

# Open Camera
device = IMAQdx.IMAQdxCamera("cam5")

# Send settings
device.enable_raw_readout("frame") # camera format: RGBA 8 Packed
device.set_attribute_value("AcquisitionAttributes/VideoMode", "1920x1520 MJPG 30.00fps")
device.set_attribute_value("CameraAttributes/Exposure/Value", 150000)

# Get image
pic = device.snap() # value: array([66, 101, 102, 0, 66, 101, 102, 0, ..., 75, 108, 111, 0], dtype=uint8)
pic_size = pic.size # value: 8755200 (which is 1920*1520*3)

# Close camera
device.close()

Please let me know if you are aware of any solution to this, I have been struggling for two weeks now.

 

Specs:

Windows 10 64-bit

Python 3.10 (also tried with 3.6)

pylablib v1.4.1 (also tried all other available versions)

LabVIEW 2021 with Vision Assistant, MAX, IMAQ, IMAQdx, IMAQ IO

 

Thank you in advance,

hackaway21

Download All
0 Kudos
Message 1 of 2
(857 Views)

EDIT: I've included some updated images without the color difference.

Download All
0 Kudos
Message 2 of 2
(828 Views)