python-OpenCVを用いて、Webカメラから入力した映像の円検出をリアルタイムで行うプログラムを作成しています。以前質問させていただき、改善したプログラムが以下の通りです。
import numpy import cv2 cap = cv2.VideoCapture(0) while True: ret, frame = cap.read() gray = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY) gray = cv2.GaussianBlur(gray, (33,33), 1) circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1, 60, param1=10, param2=85, minRadius=10, maxRadius=80) if circles != None: circles = np.uint16(np.around(circles)) for i in circles[0,:]: cv2.circle(frame,(i[0],i[1]),i[2],(255,255,0),2) cv2.circle(frame,(i[0],i[1]),2,(0,0,255),3) cv2.imshow('preview', frame) key = cv2.waitKey(10) if key == ord("q"): break cv2.destroyAllWindows() コード
起動させたところ,
if circles != None:
ValueError:The trueth value of an array with more than one element is ambiguous.
と出てしまいました。自分で調べてみたのですが、何を指摘されているのかわかりませんでした。
複数の要素を持つ配列の真理値があいとはどういうことなんですか?

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。