当前位置:网站首页>初识Opencv4.X----在图像上绘制形状
初识Opencv4.X----在图像上绘制形状
2022-07-25 09:22:00 【F l e】
//在图像上绘制形状
#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);//创建一个黑色背景,注意是Size(x,y),即(列,行)
//画圆
circle(img, Point(250,50 ), 30, Scalar(255));//注意是Point(x,y),即(列,行)
//画直线
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));
//画矩形
rectangle(img, Point(220, 100), Point(280, 150), Scalar(255));//用矩形的对角两个点绘制
//生成文字
putText(img, "people", Point(220, 220), 6, 1, Scalar(255));//目前只支持中文
imshow("img", img);
waitKey(0);
return 0;
}

边栏推荐
猜你喜欢
随机推荐
OC--Foundation--字符串+日期和时间
OC--类别 扩展 协议与委托
Esp8266的Flash读写操作以及Flash上传文件
对象初始化
【代码源】每日一题 - 排队
[De1CTF 2019]SSRF Me
Redis list 结构命令
【cf】Round 128 C. Binary String
学习新技术语言流程
OC--包装类和处理对象
Redis string structure command
Numpy array attribute, shape changing function, basic operation
一张图讲解 SQL Join 左连 又连
cf #785(div2) C. Palindrome Basis
Install MySQL in Ubuntu and create new users
Browser access to swagger failed with error err_ UNSAFE_ PORT
TCP network application development process
【代码源】 每日一题 素数之欢(bfs)
Why use json.stringify() and json.parse()
Stm32+hc05 serial port Bluetooth design simple Bluetooth speaker









