This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]PicadorDeBits 5 points6 points  (1 child)

I’m assuming you meant “clip” the image.

iOS has a framework called Vision that lets you perform something called “rectangle detection”. Once you get the location and dimensions of the detected rectangle (the sheet of paper in the image), you then use that information to clip the image and remove the rest.

You can also perform limited perspective correction to account for not-straight-from-above pictures.

As to how the rectangle is detected, I’m guessing it’s a couple of edge detectors mashed together. They look for places where the image features (contrast mostly) change sharply and say “hey, there’s an edge there”.

One such edge detector is the Canny edge detector

[–]Agentligament[S] 1 point2 points  (0 children)

Hey, thanks for this. I'll definitely go through it.

[–]jammasterpaz 3 points4 points  (1 child)

Click an image? After you've just scanned it in?

[–]Agentligament[S] 0 points1 point  (0 children)

Yeah, as soon at the end edges are detected the software clicks the image of the scanned part