![](https://secure.gravatar.com/avatar/b8db648ce5b0b58a7dda6eab71e5a98f.jpg?s=120&d=mm&r=g)
On Sat, Mar 31, 2012 at 6:48 PM, Tony Yu <tsyu80@gmail.com> wrote:
1. Is this result correct? From what I read today seems like what dilation does is erosion and vice versa, but I probably overlooked something
This result looks correct to me. I think it depends on what you consider "object" and "background": Typically (I think), image-processing operators consider light regions to be objects and dark objects to be background. So dilation grows right regions and erosion shrinks bright regions. Obviously, in your images, definitions of object and background are reversed (black is object; white is background).
You are right. I thought on first it couldn't be flip logic, but thinking more about it and then backing with result from abs(img-1) shows it's just like that.
2. Does someone maybe know of better approach for enhancing original
sample for OCR (except thresholding, for which I'm aware)?
Have you tried the `open` and `close` operators? A morphological opening is just an erosion followed by a dilation and the closing is just the reverse (see e.g., the scikits-image docstrings<http://scikits-image.org/docs/dev/api/skimage.morphology.html#greyscale-open>). For an opening, the erosion would remove some of "salt" (white pixels) in the letters, and the dilation would (more-or-less) restore the letters to their original thickness. The closing would do the same for black pixels on the background.
Thanks for suggestion. Is morphology module in skimage reflection of ndimage, or it's separate implementation?