gpt4 book ai didi

c++ - 算法,可以去除异常值,但不模糊图像的其他部分

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:22:48 25 4
gpt4 key购买 nike

有没有什么算法,既可以去除异常值,又不模糊图像的其他部分?

仅举个例子,当我们使用cv::StereoBM/SBGMcv::gpu::StereoConstantSpaceBP从 opencv,那么我们可以有异常值,如相关问题所示:opencv sgbm produces outliers on object edges此外,我们可以在具有相似颜色的图像的局部区域中获得大量强度爆发(强烈变化):enter image description here

还有许多其他情况...

最简单的解决方案是使用 cv::medianBlur(),但它会平滑所有图像,而不仅仅是异常值:Median filter example video

是否有任何算法可以只平滑异常值,而不影响图像的其余部分?

还有比这更好的吗?

// get cv::Mat src_frame ...
int outliers_size = 10;
int outliers_intensive = 100;
int ksize = outliers_size*2 + 1; // smooth all outliers smaller than 11x11
cv::Mat smoothed;
cv::medianBlur( src_frame, smoothed, ksize );
cv::Mat diff;
cv::absdiff( src_frame, smoothed, diff );
cv::Mat mask = diff > Scalar( outliers_intensive );

smoothed.copyTo( src_frame, mask );
// we have smoothed only small outliers areas in src_frame

最佳答案

也许您正在寻找双边过滤器?

OpenCV 说:

we have explained some filters which main goal is to smooth an input image. However, sometimes the filters do not only dissolve the noise, but also smooth away the edges. To avoid this (at certain extent at least), we can use a bilateral filter.

Here's what it looks like on a depth image

OpenCV 内置了这个:http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=bilateralfilter#bilateralfilter

关于c++ - 算法,可以去除异常值,但不模糊图像的其他部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30894835/

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