Here is a potentially different approach using my unix bash shell script, textcleaner. After the text cleaner, I have assumed that all pages extracted from the same book have the same scale and region size for the text. So I measure an area about the text with some white border, but not too much. I then resized the image by 1/16 and did a subimage compare search to find the region that best matches to a mid gray region of that estimated text area reduced size. Once I had the offsets, I scale them back up by 16 and did a crop. (A more exact result could be achieved by repeating the subimage search at full resolution on a region that was somewhat bigger, but not full image size)
textcleaner -f 25 -o 10 -g IMG_0073.JPG tmp.png
http://www.fmwconcepts.com/misc_tests/p ... ct/tmp.png
width=1850
height=2750
factor=16
pct=`convert xc: -format "%[fx:100/$factor]" info:`
ww=`convert xc: -format "%[fx:round($width/$factor)]" info:`
hh=`convert xc: -format "%[fx:round($height/$factor)]" info:`
convert tmp.png -resize $pct% tmp2.png
http://www.fmwconcepts.com/misc_tests/p ... t/tmp2.png
vals=`compare -metric rmse -subimage-search -dissimilarity-threshold 1 tmp2.png \( -size ${ww}x${hh} xc:gray \) null: 2>&1`
coords=`echo $vals | sed -n 's/^.*[@] \(.*,.*\)/\1/p'`
xx=`echo $coords | cut -d, -f1`
yy=`echo $coords | cut -d, -f2`
xoff=$((xx*factor))
yoff=$((yy*factor))
convert tmp.png -crop ${width}x${height}+${xoff}+${yoff} +repage tmp3.png
http://www.fmwconcepts.com/misc_tests/p ... t/tmp3.png
Sorry. If you are on Windows, I do not have a corresponding script, but you can process the images similarly using -lat 25x25+10%. The rest of my code would need to be modified to Windows equivalents. I am not a Windows user, so could not help with this.