I have a camera connected to my computer that produces 16bit grayscale images. I am importing them with the camera manufacturer's proprietary software and then insert them into a numpy array.
imObj = fc2.Image()
frame = np.array(c.retrieve_buffer(imObj))
This casts the array as a uint8. If I try to add the dtype parameter to the array declaration:
frame = np.array(c.retrieve_buffer(imObj), dtype = np.uint16)
I get the following output:
typeError: __array__() takes no arguments (1 given)
Anybody know what is causing this?
EDIT: I am using pyflycapture2. I don't know how to call or set the Image class attributes.
It seems you are possibly using
pyflycapture2, which does not seem to have an__array__hook capable of recasting the data.Instead, its
__array__hook chooses thedtypeappropriate to the image. That is, it returns auint8based array if the underlying format isPIXEL_FORMAT_MONO8and auint16based array when the format isPIXEL_FORMAT_MONO16.It might be worth checking that the image format (
c.retrieve_buffer(imObj).img.format) is what you think it is?