編集..別の画像で私の裏庭の外側を早くテストしている間に、バックグラウンド内でノイズが発生しているのですが、どうすればこのようなノイズを除去して犬を拾うことができますか?OpenCV Image comparsion
#Import Images
Background_Image = cv2.imread('bck.jpg',0)
Forground_Image = cv2.imread('dog.jpg',0)
#
diff = cv2.absdiff(Background_Image,Forground_Image)
thresh = cv2.threshold(diff, 80, 255, cv2.THRESH_BINARY)[1]
thresh = cv2.dilate(thresh, None, iterations=2)
(_, cnts, _) = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for c in cnts:
(x, y, w, h) = cv2.boundingRect(c)
cv2.rectangle(Forground_Image, (x, y), (x + w, y + h), (0, 255, 0), 4)
cv2.imshow('Test',Background_Image)
cv2.imshow('Test1',Forground_Image)
cv2.waitKey()
質問がありましたか? – beaker
はい私は自分の質問を編集しました。私は、両方の画像を比較して、それらが同じであるか同じでない場合に、このセクションに取り組む方法がわからない場合に、画像を比較して印刷する方法を知りたいです。 – David