Code Monkey home page Code Monkey logo

Comments (4)

philipyexushen avatar philipyexushen commented on May 7, 2024 1

我不知道你是不是用的VS
如果你是用的VS的话,那就在项目配置的linker选项上添加opencv_world330.lib(我的是opencv3.3,加d的那个是调试版本的,其他版本的opencv也是一样)比如\opencv\build\x64\vc14\lib这个路径(你用Cmake编的lib可能在其他地方)
然后在linker下面的那个input选项的Additional Dependencies加上opencv_world330.lib

实测不加上就会出现和你一样的报错情况,加了就好了

from opencv3-intro-book-src.

JenifferWuUCLA avatar JenifferWuUCLA commented on May 7, 2024

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;
using namespace std;

int main()
{
// 初始化变量和随机值
Mat image(600, 600, CV_8UC3);
RNG& rng = theRNG();

// 循环,按下ESC, Q, q键程序退出,否则有键按下便一直更新
while (1)
{
	// 参数初始化
	int count = rng.uniform(3, 103);    // 随机生成点的数量
	vector<Point> points;    // 点值

	// 随机生成点坐标
	for (int i = 0; i < count; i++)
	{
		Point point;
		point.x = rng.uniform(image.cols/4, image.cols*3/4);
		point.y = rng.uniform(image.rows/4, image.rows*3/4);

		points.push_back(point);
	}

	// 对给定的2D点集,寻找最小面积的包围矩形
	RotatedRect box = minAreaRect(Mat(points));
	Point2f vertex[4];
	box.points(vertex);

	// 绘制出随机颜色的点
	image = Scalar::all(0);
	for( int i = 0; i < count; i++ )
		circle( image, points[i], 3, Scalar(rng.uniform(0, 255), rng.uniform(0, 255), rng.uniform(0, 255)), CV_FILLED, CV_AA );

	// 绘制出最小面积的包围矩形
	for( int i = 0; i < 4; i++ )
		line(image, vertex[i], vertex[(i+1)%4], Scalar(100, 200, 211), 2, CV_AA);

	// 显示窗口
	imshow( "矩形包围示例", image );

	// 按下ESC, Q, 或者q,程序退出
	char key = (char)waitKey();
	if (key == 27 || key == 'q' || key == 'Q')    // 'ESC'
		break;
}

return 0;

}

from opencv3-intro-book-src.

philipyexushen avatar philipyexushen commented on May 7, 2024

你没有链接静态库吧

from opencv3-intro-book-src.

JenifferWuUCLA avatar JenifferWuUCLA commented on May 7, 2024

Hi,请问如何“链接静态库”?有示例的命令吗?

from opencv3-intro-book-src.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.