Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
I am trying to crop out the background of a document so that I can then flatten and remove perspective of the document. I can use Fred Weinhaus's unperspective for that part. The problem I am having is preparing the image mask to use. I have an example document with a blank page on a wood table, I am trying to create a mask of the page and remove the background but am having difficulty doing so because of the darkness change of the wood.
Here's my original
Here's after using unperpsective with a couple different -f values
I don't have too much time right now, but try separating channels and see if one of them works better. Also try converting to other colorspaces and separate channels and see if one of them works.
Note that your page here is gray and has a brown background. Thus for gray saturation will be low. Perhaps you can do a fuzzy floodfill on the gray to white and then replace all non-white with black to create a mask.
fmw42 wrote:This seems to work well for me on IM 6.8.6.0 Q16 Mac OSX as I mentioned above separating the Saturation channel
convert 0M5Hiq1.jpg -colorspace HSL -channel g -separate +channel -fuzz 10% -fill black -opaque black -fill white +opaque black mask.png
But you can play with the -fuzz value
Thanks! Will test this with a variety of captures that I have but it has worked well with the initial set. Greatly appreciated, also thanks for all your scripts on your site.