wao, that's exactly what I wanted!Ah, I think I might be seeing the problem. It's not 'ScalerCropMaximum' that you want to use, you need to find the maximum allowable crop **for the output size that you've requested**. You will find this as follows:This "default" scaler crop value that gets advertised here is the largest one possible that does *not* give you squished pixels.Code:
_. _, default_scaler_crop = picam2.camera_controls['ScalerCrop']
Now with
default_scaler_crop =picam2.camera_controls['ScalerCrop']
print (default_scaler_crop[2]
I get the tuple I need to dezoom with the correct ratio.
Sorry if I wasn't clear earlier.
Many thanks!
I have another question, I'm missing something. I'm no longer talking about the zoom/dezoom but about the preview display in the pyQt window.
I have several image formats:
Code:
config = picam2.create_video_configuration({'size': (2028, 1524)}, transform=Transform(hflip=1, vflip=1)) #format 1.33 config = picam2.create_video_configuration({'size': (2028, 1480)}, transform=Transform(hflip=1, vflip=1)) #format 1.37 config = picam2.create_video_configuration({'size': (2028, 795)}, transform=Transform(hflip=1, vflip=1))#format 2.55 config = picam2.create_video_configuration({'size': (2028, 1221)}, transform=Transform(hflip=1, vflip=1))# format 1.66 picam2.set_controls({"ScalerCrop":(0,440,4056,2444)}) config = picam2.create_video_configuration({'size': (2028, 1096)}, transform=Transform(hflip=1, vflip=1))# format 1.85 config = picam2.create_video_configuration({'size': (2028, 863)}, transform=Transform(hflip=1, vflip=1))# format 2.35 config = picam2.create_video_configuration({'size': (2028, 765)}, transform=Transform(hflip=1, vflip=1))# format 2.65
Except for 1.66 format, if I don't use
picam2.set_controls({"ScalerCrop":(0,440,4056,2444)})
The width of the image is missing a piece on the right and left. Normally the width should not vary, only the height.
If I try to "force" the resolution using :
picam2.set_controls({"ScalerCrop":(0,440,4056,2444)})
The image is distorted.
I don't really understand why only this resolution is a problem...
Could you help me?
Statistics: Posted by davebixby — Fri Mar 01, 2024 12:56 pm