简体   繁体   中英

Fill Holes of AForge.net not working

I am trying to smooth the morphological operation. I have already done 4*4 erosion and 4*4 dilation(I tried my best to achieve best on erosion and dilation) on an image 1 . Then i have detect largest blob to filter out noises. Then my next step is to smooth morphological operation for the image 2 so that i can fill the gap inside the image contour . I used the following code segment to fill the gap using aforge. But this method returns nothing .

public Bitmap fillGap(Bitmap image)
        {

            FillHoles filter = new FillHoles();
            filter.MaxHoleHeight = 5;
            filter.MaxHoleWidth = 5;
            filter.CoupledSizeFiltering = false;
            filter.Apply(image);
            return image;
        }

What is my next step to correct it?

皮肤检测图像形态图像

According to the API documentation , the Apply method leaves the source image unchanged. Either replace the last two lines in your method with:

return filter.Apply(image);

or use the ApplyInPlace method instead of Apply :

filter.ApplyInPlace(image);
return image;

BTW, are MaxHoleHeight and MaxHoleWidth set to large enough values?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM