quick solution for extracting paper content in photographs using imagemagick with autoit
median the image
brightness contrast
canny edge detect
make hough lines
sort the lines found by vertical/horizontal orientation
further sort by closeness to the left/right or up/down edges
further sort by how close it is to the edge and how long the line is
those are our 4 lines
to get the intersection of the lines
draw the lines and do a median/blur/brightness/contrast to create distinct blobs
connected-components can tell us the centroid positions for these blobs, which we take as the points of intersection
use those points to do a perspective distort which 'crops' to the paper
for reference later