当前位置:网站首页>First knowledge of opencv4.x --- drawing shapes on images
First knowledge of opencv4.x --- drawing shapes on images
2022-07-25 09:47:00 【F l e】
// Drawing shapes on images
#include <stdio.h>
#include <iostream>
#include <string>
#include <opencv2\opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat img = Mat::zeros(Size(500, 500), CV_8UC1);// Create a black background , Note that Size(x,y), namely ( Column , That's ok )
// A circle
circle(img, Point(250,50 ), 30, Scalar(255));// Note that Point(x,y), namely ( Column , That's ok )
// Draw a straight line
line(img, Point(250, 80), Point(250, 100), Scalar(255));
line(img, Point(220, 100), Point(200, 150), Scalar(255));
line(img, Point(280, 100), Point(300, 150), Scalar(255));
line(img, Point(250, 150), Point(250, 180), Scalar(255));
line(img, Point(250, 180), Point(220, 200), Scalar(255));
line(img, Point(250, 180), Point(280, 200), Scalar(255));
// Draw a rectangular
rectangle(img, Point(220, 100), Point(280, 150), Scalar(255));// Draw with two points at the opposite corners of the rectangle
// Generate text
putText(img, "people", Point(220, 220), 6, 1, Scalar(255));// Currently, only Chinese is supported
imshow("img", img);
waitKey(0);
return 0;
}

边栏推荐
猜你喜欢
随机推荐
1094 - Google recruitment
鱼眼图像自监督深度估计原理分析和Omnidet核心代码解读
初识Opencv4.X----ROI截取
expect+sh实现自动交互
matlab如何导入大量数据
初识Opencv4.X----图像卷积
类(2) 和 协议
Voice chat app source code - produced by NASS network source code
基于stm32的恒功率无线充电
@3-2 optimal threshold of CCF 2020-12-2 final forecast
2022年的个人技术选型梳理
How many regions can a positive odd polygon be divided into
How to configure SSH after changing the computer
How to install pytorch—— A most simple and effective method!
基于树莓派4b的传感器数据可视化实现
服务器cuda toolkit多版本切换
【深度学习】卷积神经网络
Minkowskiengine installation
[code source] daily problem segmentation (nlogn & n solution)
CoreData存储待办事项


![[gplt] 2022 popular lover (Floyd)](/img/30/c96306ca0a93f22598cec80edabd6b.png)





