简体   繁体   中英

Identifier not found with a function in Opencv, how to solve this?

I'm trying to use this function:

fastNlMeansDenoising(image, image, 3.0, 7, 21);

Using OpenCV with Visual Studio 2010 express, but it said "identifier not found". I did a quick search and found that this must be a ".lib" is missing, but I did not find which library should I add in my project for this function to work. Anyone could help me with this?

Ok. In order to use fastNlMeansDenoising(image, image, 3.0, 7, 21);

1) You need to configure opencv 2.4.8 or 2.4.9.

Here is procedure to link opencv 249 with Visual studio.

2) Use the following code to test opencv function

#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace std;
using namespace cv;

int main()
{
   // load the image

   Mat img = imread("lenna.jpg");


   if(!img.data) 
   {
      cout << "File not found" << endl;
      return -1;
   }

   // show it in a window
   namedWindow( "Image", WINDOW_AUTOSIZE );
   imshow("Image", img);

   // image window will immediately disappear if the program ends, so
   // we'll wait for a keypress, indefinitely
   waitKey();

   // do a simple transformation: convert to grayscale

   // first copy the image
   Mat img_gray = img.clone();
   Mat img1;
   cvtColor(img, img_gray, CV_RGB2GRAY);
   fastNlMeansDenoising(img_gray,img1,3.0,7,21);
   imshow("Image", img1);
   waitKey();
   return 0;
}

Hope, this helps you. Cheers,

The function is defined in the photo.hpp file. So you have to get the opencv_photo300.lib

Edit 1:

I searched a little bit (sorry im at work, dont have more time) and i couldnt find the library itself. You can go ahead and build opencv yourself from: https://github.com/Itseez/opencv Then you can just search that folder for the lib. An installationguide for the build process is here: http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html

Edit 2:

Berak is right, the opencv_photo300.lib is not in the 2.3 Version of OpenCV. Update your OpenCV to the current version 2.4.9 and you'll have what you need.

您将必须使用opencv 2.4.9,但在2.3.0中不可用

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