I have the image
I want to detect the plots and warp them into perfect squares. My workflow so far:
corners=ImageCorners[img,10];
This returns a lot of corners, and I find I have to go through them manually. I would really appreciate a heuristic to find the proper corners automatically, maybe some filter based on the amount of whitespace in a big (50 px) smoothed area around a pixel. To manually select corners:
HighlightImage[img,MapIndexed[Labeled[#1,ToString@First@#2]&,corners[[;;200]]]]
(*no good way to layout that many labels,
is there a way to dynamically make the labels near the mouse pointer big?*)
HighlightImage[img,MapIndexed[Labeled[#1,ToString@First@#2]&,
corners[[Join[{15,171,89,108},{77,113,79,158}]]]]]
I don't know if those indices will be the same on every machine. Finally, the warping
sketch0=ImageTake[ImageTransformation[img,Last@FindGeometricTransform[
corners[[{15,171,89,108}]],{20,20}+#&/@{{0,#},{0,0},{#,0},{#,#}}&@300],
ImageDimensions@img,DataRange->Full],All,{0,340}]
sketch1=ImageTake[ImageTransformation[img,Last@FindGeometricTransform[
corners[[{77,113,79,158}]],{20,20}+#&/@{{0,#},{0,0},{#,0},{#,#}}&@300],
ImageDimensions@img,DataRange->Full],All,{0,340}]
I'm not super concerned about the dewarping code. It's ugly, but does the trick.
Feedback on my code is appreciated, as well as less tedious methods for detecting features. In my mind a perfect program to do this would highlight the closest strong corner to the mouse as it moves across the image so you could quickly select the relevant features -- a module like this is feasible in Mathematica.