mirror of
https://github.com/davpapp/PowerMiner
synced 2024-12-21 23:48:49 -05:00
19 lines
576 B
Python
19 lines
576 B
Python
import numpy as np
|
|
import cv2
|
|
|
|
willowCascade = cv2.CascadeClassifier('/home/dpapp/open/opencv-haar-classifier-training/classifier/stage8.xml')
|
|
img = cv2.imread('/home/dpapp/Desktop/RunescapeAIPics/CascadeTraining/Testing/screenshot1.jpg')
|
|
#gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
|
|
|
willows = willowCascade.detectMultiScale(img, 1.3, 5)
|
|
for (x,y,w,h) in willows:
|
|
cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
|
|
roi_gray = gray[y:y+h, x:x+w]
|
|
roi_color = img[y:y+h, x:x+w]
|
|
print("Found willow!")
|
|
|
|
|
|
cv2.imshow('img', img)
|
|
cv2.waitKey(0)
|
|
cv2.destroyAllWindows()
|