I’m trying to use the OpenMV (& micropython) on the Arduino Portenta H7 + vision shield board. I managed to convert and install the russian plate haar cascade
#Load Haar Cascade
carplate_cascade = image.HaarCascade('/haarcascade_russian_plate_number.cascade', stages=25)
print(carplate_cascade)
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot() # Take a picture and return the image.
#Find objects.
detects = img.find_features(carplate_cascade, threshold=1,scale_factor=0.75)
#Draw objects
for x,y,w,h in detects:
img.draw_rectangle(x,y,w,h)
#draw image on top of it
print(clock.fps())
The code seems to run and when I move it around & i have adjusted the different threshold values. I think it detects it because when i picture it over the license plate, the script stops and i get this in the output of the serial terminal
>>> {"width":60, "height":20, "n_stages":20, "n_features":212, "n_rectangles":433}
How would i draw the rectangle around the detected area? i figured img.draw_rectangle would work but it doesn’t seem to show any rectangles. The aim is to next extract out this detected portion before passing it through another model for segmentation (there’s an OpenCV find_contours method just that I have to see if it works in OpenMV) and finally digit recognition.