二值图像的空洞定义为与图像边界不相连的背景成分集合。这意味着与图像边界相连的背景成分补集的输出为空洞抑制后的图像,可以通过腐蚀重建实现。其中掩模图像等于输入图像,而标记图像为与输入图像具有相同边界并具有常数 的图像。该方法同样适用于灰度图像。

二值图像 空洞填充

形态学重建的应用2——填充空洞形态学重建的应用2——填充空洞

 灰度图像 空洞填充

 形态学重建的应用2——填充空洞形态学重建的应用2——填充空洞

       函数:lhMorpFillHole

说明:空洞的填充

参数:

src 输入图像

dst 输出图像

源码:

void lhMorpFillHole(const IplImage* src, IplImage* dst)

{

       IplImage *temp = cvCloneImage(src);

       double min, max;

       cvMinMaxLoc(src, &min, &max);

       cvRectangle(temp, cvPoint(3,3), cvPoint(temp->width-7, temp->height-7), CV_RGB(max,max,max), -1);

       lhMorpRErode(temp, src, dst);

       cvReleaseImage(&temp);

}

相关文章:

  • 2021-05-20
  • 2021-12-08
  • 2022-12-23
  • 2021-04-18
  • 2021-04-24
  • 2021-08-01
  • 2021-12-10
  • 2022-12-23
猜你喜欢
  • 2021-06-29
  • 2021-12-05
  • 2022-12-23
  • 2021-12-05
  • 2021-12-05
  • 2021-07-28
  • 2021-04-02
相关资源
相似解决方案