OpenCV CV2.PLOYLINES draws polygon

tags: OpenCV  python  cv2.polylines  Draw polygon  

Reference materials:Python-opencv-drawing (drawing line, rectangular, round, plus text) _zangba9624 blog-CSDN blog

Sample code

# -*- coding:utf-8 -*-
import cv2
import numpy as np
 
img = cv2.imread("1.jpg", 1)
PTS = np.array ([[10, 10], [400, 10], [400, 400], [10, 400], np.int32) # Data type must be INT32
pts = pts.reshape((-1, 1, 2))

 # Draw an uns filled polygon
cv2.polylines(img, [pts], isClosed=True, color=(0,0,255), thickness=1)

 # Draw a filling polygon
# cv2.fillPoly(img, [pts], color=(255, 255, 0))
cv2.imshow('img', img)
cv2.waitKey()

Intelligent Recommendation

Tencent map draws polygon

For details as the map level is enlarged, click the display details, and click to cancel the display details again This is the effect map: Code directly:...

OpenCV draws line, rectangle, arc line, elliptical arc, polygon, add text

Reference link:Drawing Functions in OpenCV Experimental code display code: Run results screenshot:...

Cesium draws polygon polygon and adds label method

Cesium draws polygon and adds label method method 1: Method 2: Effect picture 3:...

A simple OpenGL program draws a polygon

Please refer to OpenGL configuration #include <windows.h> #include <gl/gl.h> #include <gl/GLAUX.H> void CALLBACK display(void) { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BU...

More Recommendation

It draws a polygon in two ways Openlayers2

Openlayers2 draw a polygon in two ways: 1. This is a direct way to add up 2. This is the way you draw vue Code:...

Qt notes - QPainter draws polygon

// Take someone else's code to make you easier to understand, the rough idea of ​​drawing polygons is the same. DrawPolygon.h DrawPolygon.cpp operation result: Reference blog:...

Unity draws circle, ellipse, polygon

The Unity painting circle is to draw polygons, increase the number of polygons, and when the number reaches a certain number, it looks a smooth circle.  ...

Cesium dynamically draws Polygon and adjusts

Cesium dynamically draws Polygon and adjusts Inspiration blog link: https://blog.csdn.net/qwe435541908/Article/details/90762066 This article is only for dynamic drawing Polygon, there is no line, roun...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top