waveform80 / picamera

A pure Python interface to the Raspberry Pi camera module
https://picamera.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.57k stars 358 forks source link

Camera rotation and preview rotation difficulties @ 90 deg. #434

Open caerandir opened 7 years ago

caerandir commented 7 years ago

Hi,

I want to use the camera module v2, rotated by 90 degrees, on a 16:10 screen (1280x800), which is rotated also by /boot/config.txt line "display_rotate=3". All on a Raspberry Pi 1, 512 MB. I face problems:

Code 1: Camera = picamera.PiCamera() Camera.resolution = (3280, 2464) Camera.rotation = 90 Camera.preview_fullscreen=False Camera.preview_window=(0, 0, 800, 1066) Camera.start_preview()

Result:

Code 2: Camera = picamera.PiCamera() Camera.resolution = (3280, 2464) Camera.rotation = 0 Camera.preview_fullscreen=False Camera.preview_window=(0, 0, 800, 1066) Camera.start_preview(rotation = 90)

Result:

Code 3: Camera = picamera.PiCamera() Camera.sensor_mode = 2 Camera.rotation = 90 Camera.preview_fullscreen=False Camera.preview_window=(0, 0, 800, 1066) Camera.start_preview()

Result:

I'm totally at a loss... Code 2 would be totally fine with me if it would not have the slow framerate...

Any help appreciated!

Kind regards

Caerandir

caerandir commented 7 years ago

Addendum: If I add the following to Code 3:

Camera.capture("test.jpg", format='jpeg', use_video_port=False, resize=None, splitter_port=0, bayer=False)

The resulting image is 800x1280 - so it seems to me that sensor_mode=2 does not pick 4:3 at max. resolution (as suggested here), but uses the actual screen resolution, which would explain the aspect ratio.