gpt4 book ai didi

c++ - 从 MATLAB 到 C++ : equivalent of bwmorph with option 'remove'

转载 作者:行者123 更新时间:2023-11-27 23:44:36 24 4
gpt4 key购买 nike

我找到了一个用于 C++ 的 MATLAB bwmorph 函数版本,带有选项 'endpoints' here How to implement an function equivalent to bwmorph Matlab function in OpenCV 和一个用于选项 'clean' here bwmorph(image,'clean') equivalent in opencv但选项 'remove' 没有。有人有 C++ 实现吗?

最佳答案

The 'remove' option to `bwmorph :

Removes interior pixels. This option sets a pixel to 0 if all its 4-connected neighbors are 1, thus leaving only the boundary pixels on.

您可以使用简单的 4-connected 腐 eclipse 来实现这一点,然后获取输入图像和腐 eclipse 图像之间的差异。

auto se = getStructuringElement(MORPH_CROSS, Size{3,3});
erode(in, out, se);
subtract(in, out, out);

关于c++ - 从 MATLAB 到 C++ : equivalent of bwmorph with option 'remove' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51622310/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com