Invert and Options problem of Erosion and Dilation

I want to improve the partial volume effects problem of my image by Erosion and Dilation. And for my image the target objects are the foreground.

I have the following problems:

(1) Do I need to invert my image to do erosion and expansion (that is to make the target become the background)?

(2) What does “count” in Process/Binary/Options mean? The explanation in the document is:

Count:Specifies the number of adjacent background pixels necessary before a pixel is removed from the edge of an object during erosion and the number of adjacent foreground pixels necessary before a pixel is added to the edge of an object during dilation.

But I’m confused about the definition. I just found that when the count is 1, the image changes greatly, and when the count is 8, the image changes very little.

Any leads will be appreciated!


You do not need to invert the image but you will need to enable the “Black background” option if your image has a black background. The best way to learn how the binary operators work is to enable “Preview” in the Process>Binary>Options dialog.


Thanks @Wayne
Thank you for also answering this question in NIH list. Because I’m worried that there won’t be too many people paying attention to what I posted on NIH list, so I posted it here again.

By the way, I want to check another question about binary. If I think it is unreasonable to have background objects in closed foreground, in my sample, there are solid grains in pores. If I want to remove it, Is fillholes designed to be used in this situation?

Best regards(Hope you are always healthy :wink:)

“File Holes” is designed to fill holes in foreground objects in binary images.