Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can crop rectangle area? [closed]

Hi i am working on android application to detect page number using camera preview. After I received frame I draw a rectangle on surface view Using Canvas and I want to crop the rectangle area to put it in a bitmap, so please how can I do it ?as shown here

like image 404
Adnan KA Avatar asked Jul 27 '15 21:07

Adnan KA


1 Answers

If you have the bitmap of the frame, you can use

Bitmap croppedBmp = Bitmap.createBitmap(originalBmp, rectanglePositionX, rectanglePositionY, rectangleWidth, rectangleHeight);

Assuming you know where your rectangle is positioned and its dimensions.

like image 182
Bajji Avatar answered Sep 29 '22 01:09

Bajji