I am new to opencv. I am trying to understand the image data through opencv-python application. Actual image is based on the 16bit/px format but when I check it with ‘img.dtype’, it gives me uint8 always. Is there any specific reason of this? Please make me understand about it. Thanks.
how do you save / load this ?
are there any operations, that might convert it ?
please show some code
@berak The frame format I am getting in YUY2 which refers the pixel size as 16bit. I am just trying to read this frame ‘data type’ as it is coming from sensor. please check:
cap = cv2.VideoCapture(0)
while (True):
# Capture frame-by-frame
ret, frame = cap.read()
print(frame.dtype)
cap.release()
cv2.destroyAllWindows()
@berak Could you please suggest something? Please!
VideoCapture will convert any input to bgr, 8bit
(what’s your problem with that ?)
you can try to
cap.set(cv2.CAP_PROP_CONVERT_BGR, 0)
(but there’s no guarantee, that it will get respected, or what you get in that case)
@berak Thanks for your comment.
Since my sensor output data format is 16bit/px, I want to cross check that my receiving data is 16bit/px. since the opencv video capture convert any input to bgr, 8bit means my 16bit incoming data to opencv video capture converts into bgr, 8bit. Is that you mean?
I checked, there is no api 'cap.set(cv2.CAP_PROP_CONVERT_BGR, 0)'
instead cap.set(cv2.CAP_PROP_CONVERT_RGB, 0)
and setting ‘zero (0)’ to this conversion means ‘no conversion’ right?