Download my latest version of the script. I made a few minor changes today. Also it seems I forgot to change my examples page for some earlier changes I made. In the following examples I used my autothreshold method rather than fuzz value (-p a), which needs my otsuthresh script.
Your image then works fine with the default values if you scale it down to 25% of the size.
Code: Select all
unperspective -p a -i save -k mask IMG_4764_small.png IMG_4764_small_unp.jpg
But if you leave it at larger sizes, then the boundary gets very rough due to the nature of your background. For best results with your image, you should use the -C channel that best separates the foreground from the background. In this case it seems to be the CMYK black channel.
Code: Select all
unperspective -p a -C black -i save -k mask IMG_4764_small.png MG_4764_small_black_unp.png
If you save the masks using -i and -k arguments, then you will see that at full resolution, you have a very rough boundary, with pits and bumps. These are what are causing the error messages about too many peaks. Also there are some small islands of white outside your image. So you have to add the -A argument to remove the small islands of white. You also have to increase the smoothing using -s 5 and -B 1. And you need to increase the peak detection threshold to -t 8 so that it does not consider these small bump and gaps as peaks. This is really a problem primarily because you have a textured background and very high resolution images.
Code: Select all
unperspective -p a -C black -i save -k mask -A 10 -s 5 -t 8 -B 1 IMG_4764.jpg IMG_4764_unp.jpg
Try these examples. They seem to work for me.