Skip to content

Instantly share code, notes, and snippets.

@romichi
Created July 11, 2012 15:50
Show Gist options
  • Select an option

  • Save romichi/3091298 to your computer and use it in GitHub Desktop.

Select an option

Save romichi/3091298 to your computer and use it in GitHub Desktop.
openCVの描写処理のサンプル
# -*- 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