Hi,
currently I am trying to implement my own hardhat-recognition to my MV-cam. For the Cascade classifier I used openCV and with my webcam it is working. Then I created a new .xml-classifier-file with the additional parameters “-SaveBaseFormat” and “-FeatureType HAAR” in order to make it usable for the MV-cam. Then I used this (https://github.com/openmv/openmv/blob/master/usr/openmv-cascade.py) script to transform it into a .cascade-file which I included like this into my micropython sript:
the cascade script is on the internal flash drive
hat_cascade = image.HaarCascade("/cascade_scenario4.cascade", stages=15)
…
while (True):
clock.tick()
Capture snapshot
img = sensor.snapshot()
Find objects.
Note: Lower scale factor scales-down the image more and detects smaller objects.
Higher threshold results in a higher detection rate, with more false positives.
objects = img.find_features(hat_cascade, threshold=1, scale_factor=1.35)
Draw objects
for r in objects:
img.draw_rectangle®
But my script just does nothing. It gets the snapshots, but recognized nothing. Does anyone have any experience in including own haar-cascades?
Did I implement it right?
best regards