opencv-python 影像 二
http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_drawing_functions/py_drawing_functions.html
直線
cv2.line(img,(起始點),(終點),(顏色),px大小)
顏色為 bgr
>>> import cv2
>>> import numpy as np
>>> img=np.zeros((512,512,3),np.uint8)
>>> img = cv2.line(img,(0,0),(511,511),(255,0,0),5)
>>> cv2.imshow("xx",img)
矩形
img=cv2.rectangle(img,(384,0),(510,128),(0,255,0),3)
需要指定左上角,到右下角的座標,顏色,px大小
>>> img=cv2.rectangle(img,(384,0),(510,128),(0,255,0),3)
>>> cv2.imshow("xx",img)
圓
img = cv2.circle(img,(447,63), 63, (0,0,255), -1)
需要注意的是 -1代表內切圓
橢圓
img = cv2.ellipse(img,(256,256),(100,50),0,0,180,255,-1)
未試過
多邊形
pts = np.array([[10,5],[20,30],[70,20],[50,10]], np.int32)
pts = pts.reshape((-1,1,2))
img = cv2.polylines(img,[pts],True,(0,255,255))
未試過
To draw a polygon, first you need coordinates of vertices. Make those points into an array of shape ROWSx1x2 where ROWS are number of vertices and it should be of type int32. Here we draw a small polygon of with four vertices in yellow color.
新增文字
cv2.putText()
但是顯示中文的貌似沒有對應的字型,不知道該怎麼新增
Text data that you want to write
Position coordinates of where you want put it (i.e. bottom-left corner where data starts).
Font type (Check cv2.putText() docs for supported fonts)
Font Scale (specifies the size of font)
regular things like color, thickness, lineType etc. For better look, lineType = cv2.LINE_AA is recommended.
font = cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(img,'OpenCV',(10,500), font, 4,(255,255,255),2,cv2.LINE_AA)
相關文章
- 【OpenCV-Python】:影像的傅立葉變換與逆傅立葉變換OpenCVPython
- 二值影像
- Opencv-Python學習筆記十——影像梯度、邊緣檢測 Gradient, Edge DetectionOpenCVPython筆記梯度
- OpenCV-Python -- Fourier TransformOpenCVPythonORM
- 最新openCV-Python安裝教程(opencv-python版本4.4.0, Python版本: 3.9)OpenCVPython
- 3. OpenCV-Python——影像梯度演算法、邊緣檢測、影像金字塔與輪廓檢測、直方圖與傅立葉變換OpenCVPython梯度演算法直方圖
- opencv-python學習之旅OpenCVPython
- 形態學影像處理(二)
- OpenCV-Python 視訊讀取OpenCVPython
- OpenCV與影像處理學習二——影像基礎知識(下)OpenCV
- opencv中的SVM影像分類(二)OpenCV
- 彩色影像二值化函式(matlab)函式Matlab
- ImageJ軟體使用教程(二):影像測量
- OpenCV-Python 人臉眼睛嘴識別OpenCVPython
- Python - opencv-python 獲取影片尺寸PythonOpenCV
- 影像語義分割資料增強——imgaug(二)
- 深度學習之影像處理與分析(二)深度學習
- 使用 OpenCV-Python 識別答題卡判卷OpenCVPython
- OpenCV-Python教程:11.圖片閾值OpenCVPython
- 影像處理技術(二)濾波去噪(上)
- opencv-python簡易文件(一)圖片基本操作OpenCVPython
- opencv——輪廓發現與輪廓(二值影像)分析OpenCV
- 使用matlab對影像進行二值化處理Matlab
- 人工智慧——影像分析第二期練習人工智慧
- OpenCV-Python實戰(16)——人臉追蹤詳解OpenCVPython
- 影像處理--影像特效特效
- opencv學習筆記(二)-- 載入、修改和儲存影像OpenCV筆記
- Opencv-Python 影象透視變換cv2.warpPerspectiveOpenCVPython
- 演算法影像崗-影像分類與影像分割演算法
- python 影像與影像模型匹配Python模型
- C#處理醫學影像(二):基於Hessian矩陣的醫學影像增強與窗寬窗位C#矩陣
- QGis二次開發基礎 -- 柵格影像增強顯示
- Hibernate、JAVA、SQL對應二進位制、文字、影像物件型別JavaSQL物件型別
- opencv 影像腐蝕、影像的膨脹OpenCV
- 1.影像濾波與影像融合
- opencv-python 讀取同一目錄的多個檔案OpenCVPython
- docker 打包 opencv-python,libGL.so.1 報錯解決方法DockerOpenCVPython
- Web 影像Web