OpenCV: Denoising image / video frame

≡放荡痞女 提交于 2019-12-11 11:25:14

问题


I want to denoise a video using OpenCV and C++. I found on the OpenCV doc site this:

fastNlMeansDenoising(contourImage,contourImage2);

Every time a new frame is loaded, my program should denoise the current frame (contourImage) and write it to contourImage2.

But if I run the code, it returns 0 and exits. What am I doing wrong or is there an alternative way to denoise an image? (It should be fast, because I am processing a video)


回答1:


while you are using c++ you are not providing the full argument try this that way.

cv::fastNlMeansDenoisingColored(contourImage, contourImage2, 10, 10,7, 21);

// This is Original Function to be used.
cv::fastNlMeansDenoising(src[, dst[, h[, templateWindowSize[,     searchWindowSize]]]]) → dst

Parameters:
src – Input 8-bit 1-channel, 2-channel or 3-channel image.
dst – Output image with the same size and type as src .
templateWindowSize – Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels.
searchWindowSize – Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater.
searchWindowsSize - greater denoising time. Recommended value 21 pixels.
h – Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise



来源:https://stackoverflow.com/questions/29104764/opencv-denoising-image-video-frame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!