Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 错误LNK1120&;LNK2019-c++;?_C++_Opencv - Fatal编程技术网

C++ 错误LNK1120&;LNK2019-c++;?

C++ 错误LNK1120&;LNK2019-c++;?,c++,opencv,C++,Opencv,这是我的密码: // Image Processing.cpp : Defines the entry point for the console application. // //Save an available image. #include "stdafx.h" #include "cv.h" #include "highgui.h" #include "cxcore.h" #include <sstream> #include <string> #includ

这是我的密码:

// Image Processing.cpp : Defines the entry point for the console application.
//
//Save an available image.
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"
#include <sstream>
#include <string>
#include <iostream>

/*HW5
*/
int _tmain(int argc, _TCHAR* argv[])
{
IplImage* src = cvLoadImage("D:\\document\\Study\\university of   technology\\semester_8\\Computer Vision\\Pics for test\\color_3.jpg");
IplImage* dst_1 = cvCreateImage(cvGetSize(src),8,3);
IplImage* dst_2 = cvCreateImage(cvGetSize(src),8,1);
IplImage* gray = cvCreateImage(cvGetSize(src),8,1);

//step 1: filter undesired colored items => retain only red items.
CvScalar s,c;
for(int i = 0; i < (src->height); i++)
{
    for(int j = 0; j < (src->width); j++)
    {
        s = cvGet2D(src,i,j);
        //s.val[2]=Kenh R,s.val[1]=Kenh G,s.val[0]=Kenh B  
        if( (s.val[2] > 210)&&(s.val[1] < 50)&&(s.val[0]<50) )
        {
            c.val[2] = 250;
            c.val[1] = 0;
            c.val[0] = 0;
            cvSet2D(dst_1,i,j,c);
        }
        else
        {
            c.val[2] = 255;
            c.val[1] = 255;
            c.val[0] = 255;
            cvSet2D(dst_1,i,j,c);
        }
    }
}

//step 2: calculate & add the result into image
cvCvtColor(dst_1,gray,CV_RGB2GRAY);
cvThreshold(gray,dst_2,100,255,CV_THRESH_BINARY);

CvSeq* contours = 0;
CvMemStorage* storage = cvCreateMemStorage(0);
int n = 0;
cvFindContours(dst_2,storage,&contours);

CvSeq* result;
CvPoint* p;

for(CvSeq* c = contours; c != NULL; c = c->h_next)//consider each contour
{
    n++;
    result = cvApproxPoly(c,
                        sizeof(CvContour), 
                        storage, 
                        CV_POLY_APPROX_DP,
                        cvContourPerimeter(c)*0.02,
                        0);
    p = (CvPoint*)cvGetSeqElem(result,0);
    for(int k1 = 1; k1 < result->total; k1++)//consider each point of a paticular contour
    {
        CvPoint* temp = (CvPoint*)cvGetSeqElem(result,k1);
        if(p->y < temp->y)
            p = temp;
    }
    //calculate Contour Area
    double a;
    a = cvContourArea(c,CV_WHOLE_SEQ);
    if(a < 0.0)
        a = -a;

    std::ostringstream s;
    s << a;
    std::string output = "S = " + s.str();
    const char* text1 = output.c_str();
    //display result on image
    double hscale = 1.0;
    double vscale = 0.8;
    double shear = 0.2;
    int thickness = 1;
    int line_type = 8;
    CvScalar blue = CV_RGB(0,0,250);
    CvPoint pt1 = cvPoint(p->x - n*40,p->y + 30);
    CvFont font1;
         cvInitFont(&font1,CV_FONT_HERSHEY_DUPLEX,hscale,vscale,shear,thickness,line_type);     
    cvPutText(dst_1,text1,pt1,&font1,blue);
}


cvNamedWindow("src",1);
cvNamedWindow("dst_1",1);
cvShowImage("src",src);
cvShowImage("dst_1",dst_1);
cvWaitKey(0);

cvReleaseImage(&src);
cvDestroyAllWindows();
return 0;
}

我怎样才能修好它?希望得到帮助

检查此处--您缺少某个库。您显示的代码甚至不包含函数
icvRandomQuad
@bash.d-该函数将从他正在使用的其他OpenCV函数之一调用。抱歉,我无法访问链接“”!罗杰,你能给我看看解决方案或给我另一个链接吗?你能把你的makefile或cmakelist传给我吗?
1-error LNK1120: 1 unresolved externals.

2/-error LNK2019: unresolved external symbol _cvRodrigues2 referenced in function 
"void __cdecl icvRandomQuad(int,int,double (* const)[2],double,double,double)" 
(?icvRandomQuad@@YAXHHQAY01NNNN@Z).