简体   繁体   中英

opencv - c++: how i use fastNlMeansDenoisingColoredMulti()

I have a video (130 frames). when I run my code my result is a line instead of an image so I guess I do not use fastNlMeansDenoisingColoredMulti function correctly. What should I do?

int main(int argc, char** argv){
    VideoCapture video("F:\\tarashi\\datasets\\video\\1.mp4");
    if (!video.isOpened())
    {
        cout << "Error opening video stream or file" << endl;
        return -1;
    }
    namedWindow("test video", 1);
    int i = 0;
    Mat image[130];
    for (;i<130;i=i+1)
    {
        Mat frame;
        video >> frame; // get a new frame from camera   
        image[i] = frame;
        imshow("test video", frame);

        if (waitKey(30) >= 0) break;
    }
    //Video opened and the image sequence is created.

    Mat result;
    fastNlMeansDenoisingColoredMulti(image[129],result,65,129,3,3,7,21);
    imshow("denoised Image", result);
    waitKey();
    return 0;
    }

Example: This is a screenshot of the video: 在此输入图像描述 So expecting a full picture to output. but My output(result) is : 在此输入图像描述

fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs, OutputArray dst, int imgToDenoiseIndex, int temporalWindowSize, float h = 3, float hColor = 3, int templateWindowSize = 7, int searchWindowSize = 21);

InputArrayOfArrays srcImgs - array of images, but you put only one frame. Try this:

std::vector<cv::Mat> images;
...
images.push_back(frame);
...
fastNlMeansDenoisingColoredMulti(images, ...

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