[英]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 .
我已经在图像1上进行了4 * 4腐蚀和4 * 4膨胀(我尽了最大的努力在腐蚀和膨胀上取得了最好的成绩)。 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 .
然后,我的下一步是使图像2的形态学操作平滑, 这样我就可以填补图像轮廓内的空白 。 I used the following code segment to fill the gap using aforge.
我使用以下代码段使用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. 根据API文档 ,
Apply
方法使源图像保持不变。 Either replace the last two lines in your method with: 用以下方法替换方法中的最后两行:
return filter.Apply(image);
or use the ApplyInPlace
method instead of Apply
: 或使用
ApplyInPlace
方法而不是Apply
:
filter.ApplyInPlace(image);
return image;
BTW, are MaxHoleHeight
and MaxHoleWidth
set to large enough values? 顺便说一句,
MaxHoleHeight
和MaxHoleWidth
设置为足够大的值?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.