When interfacing with a USB camera and grabbing image data, I am running into problems with saving the data as 16 bit. I have the camera pixel format set to Mono16, however whenever I save the raw image data to a numpy array, the array defaults to a uint8 datatype. I have noticed that the raw data array doubles in size when switching from Mono8 to Mono16. I have looked into numpy as_strided, but that still didn't fix the issues. Here is a snippet of code to help show a basic example of the situation.
>>>c.startCapture()
>>>fireSoftwareTrigger()
>>>im = c.retrieveBuffer()
>>>c.stopCapture()
>>>cols = im.getCols()
>>>cols
964
>>>rows = im.getRows()
>>>rows
724
>>>data = numpy.array(im.getData())
>>>len(data)
1395872
>>>rows*cols
697936
>>>data.dtype
dtype('uint8')
arr.dtype.data = numpy.array(im.getData()).view(numpy.uint16)or if you have to control endianness'<u2'or'>u2'instead ofnumpy.uni16