I am attempting to create a model that can recognize green circles or green rectangular arrows as shown in the "image".
I figured I would need to make my own classifier and I am using Cascade Trainer to accomplish this. (See repo for the classification images and .xml file.)
Complete code and supporting files here: https://github.com/ThePieMonster/Computer-Vision
# Analyze Screenshots
print("Analyze Screenshots")
img = cv2.imread('Data/image.png')
classifier_path = 'Data/train/classifier/cascade.xml'
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
print("- load classifier")
cascade = cv2.CascadeClassifier(classifier_path)
print("- detect objects")
objects = cascade.detectMultiScale(image=img_rgb, scaleFactor=1.10, minNeighbors=3)
print("- draw rectangle around objects")
for(x,y,w,h) in objects:
# cv2.rectangle(<image>, (x,y), (x+w,y+h), <rectangle rgb color>, <rectangle thickness>)
img = cv2.rectangle(img, (x,y), (x+w,y+h), (0,255,0), 2)
cv2.imshow('img', img)
cv2.waitKey(0)
print()
As you can see via the below image, I can't seem to get the classifier to recognize the green dots. There are about 41 green dots in the image and I am hoping to spot them all, currently I have a few red dots spotted and some random map squares. Any help is much appreciated!