Android - openCV, get part of image - weird behavior

I am trying to get part of the image received from the camera. I am using the code below. When I return the CameraFrame, everything is fine and the full image is displayed. But when I use the code below, only a black image is displayed. What am I doing wrong? Of course, the image obtained from inputFrame.rgba has a larger width and height than I want to crop. I am using openCV 3.0.

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
    Mat cameraFrame = inputFrame.rgba();

    Rect roi = new Rect(100, 100, 500, 500);
    Mat cropped = new Mat(cameraFrame, roi);
    return cropped;
}
+4
source share
1 answer

I found what I'm doing wrong. JavaCameraView / CameraViewBase does not show an image with a different resolution that is set for the camera.

0
source

Source: https://habr.com/ru/post/1617958/


All Articles