简体   繁体   English

在Opencv中找不到带有函数的标识符,该如何解决?

[英]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); fastNlMeansDenoising(image,image,3.0,7,21);

Using OpenCV with Visual Studio 2010 express, but it said "identifier not found". 在Visual Studio 2010 Express中使用OpenCV,但显示“找不到标识符”。 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. 我进行了快速搜索,发现必须缺少“ .lib”,但是我没有找到应该在我的项目中添加哪个库才能使此功能正常工作。 Anyone could help me with this? 有人可以帮助我吗?

Ok. 好。 In order to use fastNlMeansDenoising(image, image, 3.0, 7, 21); 为了使用fastNlMeansDenoising(image, image, 3.0, 7, 21);

1) You need to configure opencv 2.4.8 or 2.4.9. 1)您需要配置opencv 2.4.8或2.4.9。

Here is procedure to link opencv 249 with Visual studio. 这是 opencv 249与Visual Studio 链接的过程。

2) Use the following code to test opencv function 2)使用以下代码测试opencv功能

#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. 该功能在photo.hpp文件中定义。 So you have to get the opencv_photo300.lib 因此,您必须获取opencv_photo300.lib

Edit 1: 编辑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. 您可以从以下网址继续自己构建opencv: https//github.com/Itseez/opencv然后您可以在该文件夹中搜索lib。 An installationguide for the build process is here: http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html 此处提供了有关构建过程的安装指南: http : //docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html

Edit 2: 编辑2:

Berak is right, the opencv_photo300.lib is not in the 2.3 Version of OpenCV. Berak是正确的,opencv_photo300.lib不在OpenCV的2.3版本中。 Update your OpenCV to the current version 2.4.9 and you'll have what you need. 将您的OpenCV更新到当前版本2.4.9,您将拥有所需的内容。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM