Help for haar cascade

Discussion related to "under the hood" OpenMV topics.
Funky
Posts: 2
Joined: Sat Jul 21, 2018 10:28 am

Help for haar cascade

Postby Funky » Sat Jul 21, 2018 10:33 am

* i use a translator

Hello, I am a beginner on openmv and I want to create a haar cascade

Can you tell me step by step instructions to follow

Best regards


Funky
User avatar
iabdalkader
Posts: 629
Joined: Sun May 24, 2015 3:53 pm

Re: Help for haar cascade

Postby iabdalkader » Sat Jul 21, 2018 12:42 pm

Hi,

1) Follow OpenCV tutorials to train a haar cascade:

https://docs.opencv.org/3.3.0/dc/d88/tu ... scade.html
https://github.com/mrnugget/opencv-haar ... r-training
https://coding-robin.de/2013/07/22/trai ... ifier.html

* Note you have to use -baseFormatSave to save the cascade in the old format

2) Convert xml to binary using the converter script:

Code: Select all

python2 cascade_convert.py my_cascade.xml
3) Copy my_cascade.cascade to camera storage (flash or SD) and run the example script.
Funky
Posts: 2
Joined: Sat Jul 21, 2018 10:28 am

Re: Help for haar cascade

Postby Funky » Tue Jul 24, 2018 3:50 pm

Sorry for the late reply,

I tried your code but this line does not work. There is nothing in my samples folder

Code: Select all

 perl bin/createsamples.pl positives.txt negatives.txt samples 1500\
   "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1\
   -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40"
So i try with this code https://www.youtube.com/watch?v=Dg-4MoABv4I

it works with his photos.

Now i try with my pictures (ball) for positive img and i let the same negative img it not work

Have an idea why the camera does not detect them ?
User avatar
iabdalkader
Posts: 629
Joined: Sun May 24, 2015 3:53 pm

Re: Help for haar cascade

Postby iabdalkader » Tue Jul 24, 2018 9:18 pm

Hi,

If it's not detecting the object, try a higher threshold and/or lower scale.

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests