Comments (7)
OK, in this case the only solution I can see is to try to override the value if PayloadSize
. For that you'll need to edit pylablib/devices/IMAQdx/IMAQdx.py
file line 433 and replace it with, e.g., size_bytes=self.cav["Height"]*self.cav["Width"]*4
. This will break the functionality for other pixel formats (which don't have 4 bytes per pixel), but has a chance of fixing your issue.
from pylablib.
Yeah, it looks like the frame size is calculated incorrectly. This is a bit strange, though, since the code uses the IMAQdx-provided PayloadSize
attribute which, one would hope, should be correct.
To start, it would be interesting to check all other camera attributes. Could you get their values by running atts=device.cav[""]
and send them here? In addition it would be good to compare these with the values you get in the Acquisition Attributes
tab in NI MAX, and check the possible values of Video Mode
and Pixel Format
parameters there.
from pylablib.
Hello!
This is my output (and I confirmed these are the same values I see in NI MAX):
atts = Dictionary(
'AcquisitionAttributes/Bayer/Algorithm': Bilinear
'AcquisitionAttributes/Bayer/GainB': 1.0
'AcquisitionAttributes/Bayer/GainG': 1.0
'AcquisitionAttributes/Bayer/GainR': 1.0
'AcquisitionAttributes/Bayer/Pattern': Use hardware value
'AcquisitionAttributes/BitsPerPixel': Use hardware value
'AcquisitionAttributes/HardwareMaximumQueuedBufferCount': 1000
'AcquisitionAttributes/HardwareRequeueBufferListThreshold': 50.0
'AcquisitionAttributes/Height': 1520
'AcquisitionAttributes/ImageDecoderCopyMode': Auto
'AcquisitionAttributes/OutputImageType': Auto
'AcquisitionAttributes/OverwriteMode': Get Newest
'AcquisitionAttributes/PayloadSize': 8755200
'AcquisitionAttributes/PixelFormat': BGRA 8 Packed
'AcquisitionAttributes/ReceiveTimestampMode': None
'AcquisitionAttributes/ShiftPixelBits': False
'AcquisitionAttributes/SwapPixelBytes': False
'AcquisitionAttributes/Timeout': 5000
'AcquisitionAttributes/VerticalMirror': False
'AcquisitionAttributes/VideoMode': 1920x1520 MJPG 30.00fps
'AcquisitionAttributes/Width': 1920
'CameraAttributes/BacklightCompensation/Mode': Manual
'CameraAttributes/BacklightCompensation/Value': True
'CameraAttributes/Brightness/Mode': Manual
'CameraAttributes/Brightness/Value': 0
'CameraAttributes/Contrast/Mode': Manual
'CameraAttributes/Contrast/Value': 0.0
'CameraAttributes/Exposure/Mode': Manual
'CameraAttributes/Exposure/Value': 0.125
'CameraAttributes/Gamma/Mode': Manual
'CameraAttributes/Gamma/Value': 1.0
'CameraAttributes/Hue/Mode': Manual
'CameraAttributes/Hue/Value': 0.0
'CameraAttributes/Saturation/Mode': Manual
'CameraAttributes/Saturation/Value': 64
'CameraAttributes/Sharpness/Mode': Manual
'CameraAttributes/Sharpness/Value': 2
'CameraAttributes/WhiteBalance/Mode': Manual
'CameraAttributes/WhiteBalance/Value': 4600
'CameraInformation/BaseAddress': 0
'CameraInformation/BusType': DirectShow
'CameraInformation/ModelName':
'CameraInformation/SerialNumberHigh': 2531778714
'CameraInformation/SerialNumberLow': 2530362052
'CameraInformation/VendorName': MD1200A
'StatusInformation/AcqInProgress': True
'StatusInformation/LastBufferCount': 131
'StatusInformation/LastBufferNumber': 130
'StatusInformation/LostBufferCount': 0
'Height': 1520
'PayloadSize': 8755200
'PixelFormat': BGRA 8 Packed
'Width': 1920)
from pylablib.
Could you examine other possible pixel formats by checking the value of ``device.ca["PixelFormat"].values"? It could be that some other format (e.g., not involving the alpha-channel or a monochrome one) would work better for you.
from pylablib.
Only ['BGRA 8 Packed'] is an available option.
from pylablib.
That fixed it! Thank you so much. I added the following lines after the pixel_format
definition to hopefully avoid problems with other formats:
if "BGRA" in pixel_format or "RGBA" in pixel_format:
size_bytes = self.cav["Height"] * self.cav["Width"] * 4
else:
size_bytes = self.cav["PayloadSize"]
from pylablib.
Glad that worked! I'll add something similar to the next version, either by trying to figure out the number of bytes based on the pixel format, or by adding an option to specify it explicitly (for some weird packed formats).
from pylablib.
Related Issues (20)
- Live acquisition HOT 8
- No module named 'pylablib.devices.Andor.utils' HOT 1
- Fails on Linux platform with Ando SDK2 installed. HOT 2
- Hello, please tell me who used the thorlabs_apt_device library how to correctly call the status_ method to get the position in millimeters!
- Parameters not set correctly after initializing Thorlabs BSC203 HOT 3
- Clarification on MPC-XXX device operation HOT 13
- BSC 201-3 Can not home HOT 2
- Problem when opening connection with zelux (thorlabs camera) HOT 3
- Connection problem with MLS203 thorlabs stage and BBD302 controller HOT 3
- External Triger and DDG in AndorSDK2 HOT 1
- Set/Reset trigger with pyLabLib for Thorlabs KDC101 HOT 4
- Arcus Performax Stage AttributeError: NoneType object has no attribute 'argtypes' HOT 3
- Kinesis BBD302 x-stage moving but y-stage is not homing
- ThorlabsBackendError: backend exception: 'read returned less data than expected' ('read returned less data than expected') HOT 1
- Absolute movement causes the stage to move continously in wrong direction HOT 5
- Pyinstaller Executable Crashing
- setup_velocity method does not change minimum velocity and maximum velocity HOT 1
- BPC301 - connected, but no communication HOT 2
- Issue with jogging channel 3 of Kinesis Piezomoter with KIM101 4 channel controller HOT 2
- pylablib.devices.Thorlabs.KinesisMotor.wait_move() raise Exception in sub-thread HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylablib.