forked from PatternConsulting/opencv
-
-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Description
I'm currently using OpenCV on a Pi 4 with the ArmV7L native library loaded. When I try to capture an image through the Pi Camera with square resolutions from 700x700 to 790x790 in increments of 10, the image is completely garbled. Setting the capture to a non-square resolution like 700x730 results in a clear image.
Square resolutions tried that result in a garbled image:
- 700x700
- 710x710
- 720x720
- 730x730
- 740x740
- 750x750
- 760x760
- 770x770
- 780x780
- 790x790
Expected result: The image shouldn't be garbled, with whatever's in shot clearly visible.


What actually happens: The image is a garbled mess, nothing is visible.


Reproduction Code:
try {
VideoCapture camera = new VideoCapture(0);
camera.set(Videoio.CAP_PROP_FRAME_WIDTH, 700);
camera.set(Videoio.CAP_PROP_FRAME_HEIGHT, 700);
if (camera.isOpened()) {
Mat image = new Mat();
MatOfByte buffer = new MatOfByte();
if(colour) {
camera.read(image);
Imgcodecs.imencode(".jpg", image, buffer);
}else{
camera.read(image);
Imgproc.cvtColor(image, image, Imgproc.COLOR_BGR2GRAY);
Imgcodecs.imencode(".jpg", image, buffer);
}
// Converting the mat into a BufferedImage
this.image = ImageIO.read(new ByteArrayInputStream(buffer.toArray()));
}
camera.release();
}catch(Exception e){
e.printStackTrace();
}Metadata
Metadata
Assignees
Labels
No labels