Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crop image after selecting area using edge detection in android

I want to automatically select area of the page to crop later. I thought edge detection might be useful and used canny edge detection to find edges of the image. Now I have this image! but I've no clear idea to select area of the page as a rectangle. Can anyone suggest a method or implementation for this problem? What I really want to do is this selecting the area of the page as follows. Is there any other method to do this? I have also seen boundary detection in the book of introduction to digital image processing using matlab. But I'm not familiar with that. Can I use that for this purpose?

like image 333
chAmi Avatar asked Nov 13 '22 03:11

chAmi


1 Answers

I assume that you have "Canny-ed" image. Now you can use Imgproc.findCountours, to find and store edges (you need List<MatOfPoint>for that). Before using findContours i would play with Imgproc.dilate, which might help finding contours(it "fattens" lines so we are sure that findContours wont miss your target). Then you need only to use Imgproc.boudningRect to get your ROI. Then just crop image using this ROI.

like image 55
don_pablito Avatar answered Nov 16 '22 04:11

don_pablito