Hacker News new | ask | show | jobs
by DZittersteyn 4223 days ago
Is there a reason to be doing doing a closing, and then a sequence of erosions, followed by dilations?

Since closing(image, str.elem.) == erode(dilate(image, str.elem), str.elem), it feels like you could better use an erosion (remove noise) followed by a closing (to fill up the empty spaces) instead of the other way around?

1 comments

Great observation. But if you erode too early you run the risk of not being able to perform a closing and fill in the gaps between the vertical stripes of the barcode.
You could ofc. erode with a smaller element, and open with a larger one, but that might be just as parameter-tweaky as this approach ;)