为什么我有错误“未解析的外部符号”void __cdecl cv :: fastNlMeansDenoising" [英] Why am I having the error "unresolved external symbol "void __cdecl cv::fastNlMeansDenoising"

查看:225
本文介绍了为什么我有错误“未解析的外部符号”void __cdecl cv :: fastNlMeansDenoising"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

 #include <   iostream  >  
#includeopencv2 / highgui / highgui.hpp
#include opencv2 / imgproc / imgproc.hpp
#include < stdio.h >
#include < stdlib.h >
#includeopencv2 / opencv.hpp
using namespace std;
使用命名空间cv;
vector < Rect > detectLetters(Mat img)
{
vector < Rect > boundRect;
Mat img_gray,img_sobel,img_threshold,element,img_dilated,img_denoised;
cvtColor(img,img_gray,CV_BGR2GRAY); //转换为灰度
fastNlMeansDenoising(img_gray,img_denoised,3,7,21);
Sobel(img_denoised,img_sobel,CV_8U,1,0,3,1,0,BORDER_DEFAULT); //索贝尔是一种分化功能。这用于查找渐变
// dilate(img_sobel,img_dilated,Mat(),Point(-1,-1),1);
// adaptiveThreshold(img_sobel,img_threshold,255,0,THRESH_BINARY,3,0);
threshold(img_sobel,img_threshold,0,255,CV_THRESH_BINARY | CV_THRESH_OTSU); //
element = getStructuringElement(MORPH_RECT,Size(17,3));
morphologyEx(img_threshold,img_threshold,CV_MOP_CLOSE,element); //技巧
vector < vector< Point > >轮廓;
findContours(img_threshold,contours,0,1);
vector < vector< Point > > contours_poly(contours.size());
for(int i = 0; i < contours.size(); i ++

if (等高[i] .size() > 100)
{
approxPolyDP(Mat (contours [i]),contours_poly [i],3,true);
Rect appRect(boundingRect(Mat(contours_poly [i])));
if(appRect.width> appRect.height)
boundRect.push_back(appRect);
}
imwrite(img_gray.jpg,img_gray);
imwrite(img_sobel.jpg,img_sobel);
imwrite(img_threshold.jpg,img_threshold);
imwrite(element.jpg,element);
返回boundRect;
}

int main(int argc,char ** argv)
{
//读取
Mat img1 = imread(argv [1], 1);
Mat img2 = imread(argv [2],1);
//检测
vector < Rect > letterBBoxes1 = detectLetters(img1);
vector < Rect > letterBBoxes2 = detectLetters(img2);
//显示
for(int i = 0; i < < span class =code-attribute> letterBBoxes1.size();
i ++) < span class =code-attribute>

< span class =code-attribute> rectangle(img1,letterBBoxes1 [i],Scalar(0,255,0),3,8,0);

imwrite( imgOut1_new.jpg, img1);

for(int i = 0; i< letterBBoxes2.size(); i ++)

rectangle(img2,letterBBoxes2 [i] ,标量(0,255,0),3,8,0);

imwrite( imgOut2_new.jpg, img2);

return 0;

}





我收到错误

 错误 LNK2019:未解析的外部符号  void __cdecl cv :: fastNlMeansDenoising(class cv :: _ InputArray const&,class cv :: _ OutputArray const&,float,int ,int)(?fastNlMeansDenoising @ cv @@ YAXABV_InputArray @ 1 @ ABV_OutputAr ray @ 1 @ MHH @ Z)在  function  中引用   class std :: vector< class cv :: Rect_< int> ;, class std :: allocator< class cv :: Rect_< int> > > __cdecl detectLetters(class cv :: Mat)(?detectLetters @@ YA?AV?$ vector @ V?$ Rect_ @ H @ cv @@ V?$ allocator @ V?$ Rect_ @ H @ cv @ @@ std @@@ std @@ VMat @ cv @@@ Z)





在我的代码中,当我删除fastNlMeansDenoising()函数,错误被删除。



有谁能解释这个函数的问题是什么?

解决方案
矢量@ V'

Rect_ 3 H @ @@ CV V'

分配器@ V'

#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <stdio.h>
#include <stdlib.h>
#include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;
vector<Rect> detectLetters(Mat img)
{
    vector<Rect> boundRect;
    Mat img_gray, img_sobel, img_threshold, element, img_dilated, img_denoised;
    cvtColor(img, img_gray, CV_BGR2GRAY); // converting to gray scale
    fastNlMeansDenoising(img_gray, img_denoised, 3, 7, 21);
    Sobel(img_denoised, img_sobel, CV_8U, 1, 0, 3, 1, 0, BORDER_DEFAULT);  // sobel is a differentiation function. this is used to find gradients
    //dilate(img_sobel,img_dilated, Mat(),Point(-1,-1),1);
    //adaptiveThreshold(img_sobel,img_threshold, 255, 0, THRESH_BINARY, 3,0);
    threshold(img_sobel, img_threshold, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU); //
    element = getStructuringElement(MORPH_RECT, Size(17, 3));
    morphologyEx(img_threshold, img_threshold, CV_MOP_CLOSE, element); //Does the trick
    vector<vector<Point>> contours;
    findContours(img_threshold, contours, 0, 1);
    vector<vector<Point> > contours_poly( contours.size() );
    for( int i = 0; i < contours.size(); i++ )

        if (contours[i].size()>100)
        {
            approxPolyDP( Mat(contours[i]), contours_poly[i], 3, true );
            Rect appRect( boundingRect( Mat(contours_poly[i]) ));
            if (appRect.width>appRect.height)
                boundRect.push_back(appRect);
        }
        imwrite( "img_gray.jpg", img_gray);
        imwrite( "img_sobel.jpg", img_sobel);
        imwrite( "img_threshold.jpg", img_threshold);
        imwrite( "element.jpg", element);
    return boundRect;
}

int main(int argc,char** argv)
{
    //Read
    Mat img1=imread(argv[1], 1);
    Mat img2=imread(argv[2], 1);
    //Detect
    vector<Rect> letterBBoxes1=detectLetters(img1);
    vector<Rect> letterBBoxes2=detectLetters(img2);
    //Display
    for(int i=0; i< letterBBoxes1.size(); i++)

        rectangle(img1,letterBBoxes1[i],Scalar(0,255,0),3,8,0);

    imwrite( "imgOut1_new.jpg", img1);

    for(int i=0; i< letterBBoxes2.size(); i++)

        rectangle(img2,letterBBoxes2[i],Scalar(0,255,0),3,8,0);

    imwrite( "imgOut2_new.jpg", img2);

    return 0;

}



I am getting the error

error LNK2019: unresolved external symbol "void __cdecl cv::fastNlMeansDenoising(class cv::_InputArray const &,class cv::_OutputArray const &,float,int,int)" (?fastNlMeansDenoising@cv@@YAXABV_InputArray@1@ABV_OutputArray@1@MHH@Z) referenced in function "class std::vector<class cv::Rect_<int>,class std::allocator<class cv::Rect_<int> > > __cdecl detectLetters(class cv::Mat)" (?detectLetters@@YA?AV?$vector@V?$Rect_@H@cv@@V?$allocator@V?$Rect_@H@cv@@@std@@@std@@VMat@cv@@@Z)



In my code, when I am removing fastNlMeansDenoising() function, the error is removed.

Can anyone explain what the problem is in this function??

解决方案

vector@V?


Rect_@H@cv@@V?


allocator@V?


这篇关于为什么我有错误“未解析的外部符号”void __cdecl cv :: fastNlMeansDenoising&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆