当前位置:网站首页>cv2-drawline
cv2-drawline
2022-07-08 01:52:00 【step step】
title: cv2 drawline
date: 2022-07-02 21:23:50
tags: opencv
cv2 drawline
import numpy as np
import cv2 as cv
def draw_line():
''' Draw a straight line cv.line(img, pt1, pt2, color, thickness) Parameters: img Image. pt1 First point of the line segment. pt2 Second point of the line segment. color Line color. thickness Line thickness. lineType Type of the line. See LineTypes. shift Number of fractional bits in the point coordinates. '''
# Create a black image
img = np.zeros((512, 512, 3), np.uint8)
# Draw a picture 5px Wide diagonal
cv.line(img, (0, 0), (511, 511), (255, 0, 0), 5)
# display picture
cv.imshow('img', img)
key = cv.waitKey(0)
if key == ord('q'):
cv.destroyAllWindows()
def draw_rectangle():
''' Draw a rectangular cv.rectangle(img, pt1, pt2, color, thickness) Parameters img Image. pt1 Vertex of the rectangle. pt2 Vertex of the rectangle opposite to pt1 . color Rectangle color or brightness (grayscale image). thickness Thickness of lines that make up the rectangle. Negative values, like FILLED, mean that the function has to draw a filled rectangle. lineType Type of the line. See LineTypes shift Number of fractional bits in the point coordinates. '''
img = np.zeros((512, 512, 3), np.uint8)
cv.rectangle(img, (384, 0), (510, 128), (0, 256, 0), 3)
cv.imshow('img', img)
key = cv.waitKey(0)
if key == ord('q'):
cv.destroyAllWindows()
def draw_circle():
''' '''
img = np.zeros((512, 512), np.uint8)
cv.circle(img,(447,63), 63, (0,0,255), -1)
# cv.circle(img, (200, 63), 63, (0, 255, 0), 3)
cv.imshow('img', img)
key = cv.waitKey(0)
if key == ord('q'):
cv.destroyAllWindows()
def draw_polylines():
img = np.zeros((512, 512, 3), np.uint8)
pts = np.array([[10,5],[20,30],[70,20],[50,10]], np.int32)
pts = pts.reshape((-1, 1, 2))
cv.polylines(img, [pts], True, (0, 255, 255))
cv.imshow('img', img)
key = cv.waitKey(0)
if key == ord('q'):
cv.destroyAllWindows()
print(pts.shape)
边栏推荐
- Usage of xcolor color in latex
- uniapp一键复制功能效果demo(整理)
- In depth analysis of ArrayList source code, from the most basic capacity expansion principle, to the magic iterator and fast fail mechanism, you have everything you want!!!
- Matlab r2021b installing libsvm
- Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
- 从Starfish OS持续对SFO的通缩消耗,长远看SFO的价值
- [target tracking] |atom
- mysql/mariadb怎样生成core文件
- Dataworks duty table
- 【目标跟踪】|atom
猜你喜欢

QT -- package the program -- don't install qt- you can run it directly

Write a pure handwritten QT Hello World

QT build with built-in application framework -- Hello World -- use min GW 32bit

SQLite3 data storage location created by Android

Usage of hydraulic rotary joint

Application of slip ring in direct drive motor rotor

如何制作企业招聘二维码?

Remote Sensing投稿經驗分享

神经网络与深度学习-5- 感知机-PyTorch

pb9.0 insert ole control 错误的修复工具
随机推荐
C语言-模块化-Clion(静态库,动态库)使用
qt--將程序打包--不要安裝qt-可以直接運行
Node JS maintains a long connection
What kind of MES system is a good system
【错误】加载h5权重出错AttributeError: ‘str‘ object has no attribute ‘decode‘
城市土地利用分布数据/城市功能区划分布数据/城市poi感兴趣点/植被类型分布
Redisson distributed lock unlocking exception
Usage of xcolor color in latex
burpsuite
进程和线程的退出
About snake equation (5)
MySQL查询为什么没走索引?这篇文章带你全面解析
cv2-drawline
I don't know. The real interest rate of Huabai installment is so high
剑指 Offer II 041. 滑动窗口的平均值
【目标跟踪】|DiMP: Learning Discriminative Model Prediction for Tracking
mysql/mariadb怎样生成core文件
Partage d'expériences de contribution à distance
QT build with built-in application framework -- Hello World -- use min GW 32bit
Redux使用