Created
July 11, 2012 15:50
-
-
Save romichi/3091298 to your computer and use it in GitHub Desktop.
openCVの描写処理のサンプル
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding:utf-8 -*- | |
| import cv2 | |
| import numpy | |
| src = numpy.zeros((400, 200), numpy.uint8) | |
| color = (255, 255, 255) | |
| #直線 | |
| cv2.line(src, (10, 50), (190, 50), color) | |
| #矩形(塗りつぶし) | |
| cv2.rectangle(src, (10, 100), (190, 150), color, thickness = -1) | |
| #円 | |
| cv2.circle(src, (100, 240), 50, color) | |
| #テキスト | |
| cv2.putText(src, 'test', (50, 350), cv2.FONT_HERSHEY_SIMPLEX, 1.5, color) | |
| cv2.imshow('draw', src) | |
| cv2.waitKey(0) | |
| cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment