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;
}
source
share