Error with attempt to execute plot module

With the following code I am getting the posted error. Trying to make the plot module code work:

#include "pch.h"
#include "stdafx.h"
#include "ArduCamlib.h"
#include <windows.h>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/plot.hpp" 
#include <iostream>

using namespace cv;
using namespace std;

using std::cout;
using std::ifstream;
using std::string;

main
{
Mat plot_img(2, 100, CV_8U);
Ptr<plot::Plot2d> plotCOLs;
plotCOLs = plot::Plot2d::create(colX, colY); // error location I think
plotCOLs -> render(plot_img);
imshow("KM controller", plot_img);
}

error:

Error	LNK2001	unresolved external symbol "public: static struct cv::Ptr<class cv::plot::Plot2d> __cdecl cv::plot::Plot2d::create(class cv::_InputArray const &,class cv::_InputArray const &)" (?create@Plot2d@plot@cv@@SA?AU?$Ptr@VPlot2d@plot@cv@@@3@AEBV_InputArray@3@0@Z)	

I didn’t have much luck using other point plotters out there - I couldn’t change settings to make the origin TOL like opencv. So I am trying the native point plotter.

linker error. you should tell visual studio to link that plot module, same as you do for core, imgproc, highgui, …

1 Like

I’m sure you are right. I’m getting the error with several implementations. I am having difficulties with telling visual studio to link plot module. I’ve put plot.h in the main .cpp file “opencv2/plot.h”. I’ve tried adding it in project settings. Manually added plot.h to /opencv/plot.h directory.

it’s not about plot.h

you must tell the linker to use opencv_plot.lib

Seems logical. I have a few .lib files but not opencv_plot.lib. Is this search correct? Do I i have to download it?

no, you cannot download it.
you must rebuild the opencv libs with contrib modules

1 Like