-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add a crop test with the new "perserve_ar" config param
Signed-off-by: Naushir Patuck <[email protected]>
- Loading branch information
1 parent
a46fb48
commit adbfaa7
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/python3 | ||
|
||
# Test setting the "preserve_ar" stream configuration flag | ||
|
||
import cv2 | ||
|
||
from picamera2 import Picamera2 | ||
|
||
picam2 = Picamera2() | ||
|
||
for m, l in [(False, False), (False, True), (True, False), (True, True)]: | ||
cfg = picam2.create_video_configuration(main={"size": (1920, 1080), "format": 'XRGB8888', "preserve_ar": m}, | ||
lores={"size": (640, 640), "format": 'YUV420', "preserve_ar": l}, | ||
display="main") | ||
picam2.configure(cfg) | ||
picam2.start(show_preview=True) | ||
|
||
for _ in range(100): | ||
im = picam2.capture_array("lores") | ||
cv2.imshow("lores", im) | ||
cv2.resizeWindow("lores", (640, 640)) | ||
cv2.waitKey(1) | ||
|
||
picam2.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters