2017-04-19 3 views
0

Raspberry PiのLearnOpenCVからBlobの検出例を試していますが、imreadファイルのエラーは引き続き発生します。エラーは "TypeError:組み込み操作の引数型が正しくありません"です。Raspberry TypeErrorのImpleread

これはコードである:Eyllanescから

import picamera.array 
import picamera 
import numpy as np 
import cv2 

with picamera.PiCamera() as camera: 
    with picamera.array.PiRGBArray(camera) as stream: 
     camera.resolution = (320,240) 

     while True: 
      camera.capture(stream, 'bgr', use_video_port=True) 

      im = cv2.imread(stream.array, cv2.IMREAD_GRAYSCALE) 
      detector = cv2.SimpleBlobDetector_create() 
      keypoints = detector.detect(im) 
      im_with_keypoints = cv2.drawKeypoints(im, keypoints, np.array([]), (0,0,255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS) 
      cv2.imshow("Keypoints", im_with_keypoints) 
      if cv2.waitKey(1) & 0xFF == ord('q'): 
       break 

      stream.seek(0) 
      stream.truncate() 
     cv2.destroyAllWindows() 
+0

これはエラーメッセージですか? – eyllanesc

+0

実際、エラーは "TypeError:組み込み操作の引数の型が悪い"という行です。 "im = cv2.imread(stream.array、cv2.IMREAD_GRAYSCALE)" –

+0

コードはどこにありますか? opencvのどのバージョンがありますか? – eyllanesc

答えて

0

回答が正解であった:

がim = cv2.cvtColor(ストリームにIM = cv2.imread(stream.array、cv2.IMREAD_GRAYSCALE)を変更する必要があります.array、cv2.COLOR_BGR2GRAY)