0 down vote favorite I am new to OpenCV and so I am still learning some of the functionalities. So, here is what I would like to achieve. I want to load my camera and in the camera frame I just want to keep the area inside the rectangular box to be seen in the camera frame. Anything outside the box should be completely black. How should I go about it. This is what I tried so far.
int centerx = (int) (mrgba.width()*0.5);
int centery = (int) (mrgba.height() * 0.5);
// Rect rect = new Rect(centerx,centery,100,100);
// Mat submat = mrgba.submat(rect);
Imgproc.rectangle(mrgba,new Point(centerx-100,centery - 100),new Point(centerx+100,centery+100),new Scalar(0,0,255) );
/Currently all it does, is that it draws a rectangle at the center of the camera frame but then I dont want anything outside that rectangular frame.
return mrgba;