2013年12月10日火曜日

[OpenCV] PythonのOpenCVで直線の描画

>>> import cv2
>>> img = cv2.imread('元の画像パス')
>>> cv2.line(img, (5, 5), (5, 100), (0, 0, 255)) # Draw Red Line
>>> cv2.line(img, (20, 20), (100, 20), (255, 0, 0), 3) # Draw Thick Blue Line
>>> cv2.line(img, (0, 0), (120, 120), (0, 255, 0), 5) # Draw Very Thick Green Line
>>> cv2.imwrite('出力先の画像パス', img)
True

こんな感じ。

0 件のコメント:

コメントを投稿

Related Posts Plugin for WordPress, Blogger...