What is perspective correction? (And why scans look flat)
Photograph a rectangular page from any real-world position and the rectangle becomes a trapezoid: nearer edges look longer, farther edges shorter. Perspective correction is the transformation that undoes this — the reason a phone photo can end up looking like it came from a flatbed scanner.
The idea in one paragraph
If you know where the four corners of the page are in the photo, and you know the shape they should form (a flat rectangle), there is exactly one perspective transformation — a homography — that maps one onto the other. Apply it to every pixel and the trapezoid becomes a rectangle, as if the camera had been perfectly perpendicular to the page.
Why corner detection is the hard part
The math is a solved problem; finding the corners is not. A scanner has to distinguish the page edge from wood grain lines, shadow boundaries, and reflections that all look like edges. Scandut scores candidate rectangles by whether real image edges support each side, whether inside and outside differ consistently, and whether the interior actually contains print — then hands you the corners for a final drag-adjustment when the scene is genuinely ambiguous.
Its limits
Perspective correction assumes the page is flat. A curled page or a book's curved gutter needs additional dewarping, which is a harder problem. It also cannot create detail that is not there: text photographed at an extreme angle occupies few pixels, and straightening does not add resolution. Moderate angles correct beautifully; extreme ones are better re-shot.