cilynx / pantomath

Pantomath knows about things
GNU General Public License v3.0
1 stars 0 forks source link

Handle Stapled and Folded Documents #26

Open cilynx opened 1 year ago

cilynx commented 1 year ago

Related to #25.

The current document detection routine looks for rectangles. When a stapled packet is flipped through, one corner is chopped off so it has 5-sides, not 4. This could probably be detected by looking at 5-sided contours, defining the rectangle by the three vertices that are farther from the others, then estimating where the 4th corner should be and checking if the other two points are relatively close to that point.

For more geometry fun, we could look for the staple point closest to the known upper point and draw an extension line -- do the same with the other staple point and the known point on its same side, then the intersection of those two extensions is the non-existent 4th corner for the 4-point warp.