Issue
my problem is when i set the resolution higher than 640x480, the output colors are only in the bottom part right. The rest of the output has a blueish color.
I have a RaspyberryPi4 with 4GB ram and a PiCamera V2. The CPU usage is not more than ~65% with the highest resolution. The same error appears also on another rapberrypi and its picamera (V2 NOIR).
Here are the Images (dont care about the white bars in the corner: they came from bad screenshooting)
Here Is my python script:
import cv2
cap = cv2.VideoCapture(0)
width = 640; height = 480
# width = 1920; height = 1080
# width = 3280; height = 2464
cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
cv2.waitKey()
print(cap.get(cv2.CAP_PROP_FRAME_WIDTH),cap.get(cv2.CAP_PROP_FRAME_WIDTH))
while cap.isOpened():
ret, frame = cap.read()
cv2.imshow('Resolution: '+str(width)+'x'+str(height), frame)
if cv2.waitKey(25) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
I know with a highe resolution i will lose higher framerates.
Have someone an idea what the source of the error could be and/or how i can resolve this error?
Regards
Solution
I will answer the question myself: The main problem is the picamera hardware and how the Raspberry is reading it through the Gpu.
The quick solution was to change the resolution to multiples of 32. For the FullHd case it need to be 1920*1088 instead of 1920*1080. Then the colors are normal again.
I also find out the highest resolution before the fps drop drown:
horizontal 1280*704
vertical 640*672
Every higher resolultion will drop the fps from 30+ to ~6-8.
Which part of the camera sensor is detecting/used also depends on the resolution. For more detail read the documentation carefully ;-)
Picamera official Documentation
Answered By - Jeffote Answer Checked By - Timothy Miller (WPSolving Admin)