Skip to content Skip to sidebar Skip to footer

Opencv (java) : Draw A Rectangle Region On Camera View

I'm trying to create a bank card scanner on android using OpenCV, first, I'm creating a region where the user can scan their cards then crop it after, I'm struggling with the recta

Solution 1:

Try this:

int w = mrgba.width();
int h = mrgba.height();
int w_rect = w*3/4; // or 640int h_rect = h*3/4; // or 480

Imgproc.rectangle(mrgba, newPoint( (w-w_rect)/2, (h-h_rect)/2 ), newPoint(
            (w+w_rect)/2, (h+h_rect)/2 ), newScalar( 255, 0, 0 ), 5

Make sure that w_rect and h_rect are less than w and h, respectively.

Post a Comment for "Opencv (java) : Draw A Rectangle Region On Camera View"