Tuesday, July 28, 2015

Drawing Functions in OpenCV

  • 寫入數據
  • 位置坐標,你想要把它(即左下邊角數據開始)
  • 字體類型(檢查cv2.putText()文檔支持的字體)
  • 字體量表(指定字體的大小)
  • 喜歡的顏色,厚度,線型等。對於更好看規律性的東西,線型 cv2.CV_AA建議

import cv2
import numpy as np

img = np.zeros((512,512,3), np.uint8)
font = cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(img,'OpenCV',(10,500), font, 4,(255,255,255),2,cv2.CV_AA)
cv2.namedWindow('image')

while(1):
    cv2.imshow('image',img)
    if cv2.waitKey(20) & 0xFF == 27:
        break
cv2.destroyAllWindows()
參考資料:
http://stackoverflow.com/questions/21899555/circle-detection-in-open-cv-using-python
http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_drawing_functions/py_drawing_functions.html#drawing-functions

No comments:

Post a Comment