Android scale CvCameraViewListener2 prior to drawing
I would like to move a opencv application I built to Android, I would like it to be landscape with the one half to be a horizontally cropped video feed and the the other half to be text display.
Unfortunately I can't seem to crop the video, as all that is displayed is a blank screen.
public class MainActivity extends Activity implements CvCameraViewListener2 {
...
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
int offset = winWidth / 4; // winWidth is the width of the screen
Mat frame = inputFrame.rgba();
Mat roi = frame.submat(offset, frame.rows() - offset, 0, frame.cols());
frame.release();
return roi;
}
the submat is referencing the original frame's pixels, so
either clone it:
or don't release the frame.
Ok thanks, but that still hasn't produced the results I expect.