脳汁portal

アメリカ在住(だった)新米エンジニアがその日学んだIT知識を書き綴るブログ

python

openCVでraspberryPiのUSBカメラのキャプチャをとって、サイズを変更する

import cv2 # cameraの設定 c = cv2.VideoCapture(0) # キャプチャ boolean, img = c.read() h, w = img.shape[:2] print h # 1280 print w # 720 # サイズ変更 half = cv2.resize(img, (320, 240)) hh, hw = half.shape[:2] print hh # 320 print hw # 240 …