0

I would like to run a small OpenCV script in BM3D denoising filter.

I can't properly call this function in OpenCV.

bm3dDenoising()?

Could anyone help me please? About include and namespace?

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/photo/photo.hpp>
#include <math.h>

using namespace cv::xphoto;
using namespace std;

int main()
{
    //Load an Image
    Mat img = imread("C:\\image2.jpg", CV_LOAD_IMAGE_COLOR);
    namedWindow("Image", CV_WINDOW_AUTOSIZE);
    imshow("Image", img);


    //Blur Effect
    GaussianBlur(img, img, cv::Size(3, 3), 0);
    cv::xphoto::bm3dDenoising(img, img);  // ???? 

    namedWindow("Output", CV_WINDOW_AUTOSIZE);
    imshow("Output", img);

    //Wait Key press
    cvWaitKey(0);

    //destroy
    cvDestroyWindow("Image");
    cvDestroyWindow("BlurEffect");

    return 0;
}
jaggedSpire
  • 4,423
  • 2
  • 26
  • 52
Agata
  • 141
  • 2
  • 14

2 Answers2

1

You are probably missing OpenCV extra modules, i.e. opencv_contrib: https://github.com/opencv/opencv_contrib

Once you get your development environment ready, you can take a look at the sample code: https://github.com/opencv/opencv_contrib/blob/master/modules/xphoto/test/test_denoise_bm3d.cpp

bpawlik
  • 26
  • 1
0

What are your errors? If it is error: ‘cv::xphoto’ has not been declared is a compilation error, not a linker error. Probably, your compiler is not able to look for definitions of cv::xphoto.

Try to give explicit path. #include "path/opencv2/.....h"

or provide the include path in -I switch.

g++ -I *.cpp -l -o

I hope it will help.

MichalSzczep
  • 345
  • 1
  • 4
  • 15