简体   繁体   中英

Algorithm, which can remove outliers, but do not blur other part of image

Is there any algorithm, which can remove outliers, but do not blur other part of image?

Only for example, when we use cv::StereoBM/SBGM or cv::gpu::StereoConstantSpaceBP from opencv, then we can have outliers, as shown in relevant question: opencv sgbm produces outliers on object edges Also, we can get large bursts of intensity (strong variations) in local area of image with similar colors: 在此处输入图片说明

And many other cases...

The simplest solution is using cv::medianBlur() , but it will smooth all image, not only outliers: Median filter example video

Is there any algorithm which smoothes only outliers, and It does not affect the rest of the image?

Is there anything better than this?

// 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

Perhaps you are looking for the bilateral filter?

OpenCV says:

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.

这是深度图像上的样子

OpenCV has this built-in: http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=bilateralfilter#bilateralfilter

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