# Help for haar cascade

**URL:** <https://forums.openmv.io/t/help-for-haar-cascade/836>\
**Category:** OpenMV Boards\
**Created:** [July 21, 2018, 2:33pm UTC](https://forums.openmv.io/t/help-for-haar-cascade/836 "2018-07-21T14:33:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Funky](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Funky](https://forums.openmv.io/u/Funky)\
**Post date:** [July 21, 2018, 2:33pm UTC](https://forums.openmv.io/t/help-for-haar-cascade/836/1 "2018-07-21T14:33:59Z")

</div>

- 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

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [July 21, 2018, 4:42pm UTC](https://forums.openmv.io/t/help-for-haar-cascade/836/2 "2018-07-21T16:42:42Z")

</div>

Hi,

1. Follow Open **CV** tutorials to train a haar cascade:

[https://docs.opencv.org/3.3.0/dc/d88/tutorial\_traincascade.html](https://docs.opencv.org/3.3.0/dc/d88/tutorial_traincascade.html)

> **[GitHub - mrnugget/opencv-haar-classifier-training: Learn how to train your...](https://github.com/mrnugget/opencv-haar-classifier-training)**
>
> Learn how to train your own OpenCV Haar classifier - GitHub - mrnugget/opencv-haar-classifier-training: Learn how to train your own OpenCV Haar classifier

[https://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html](https://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html)

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

1. Convert xml to binary using the [converter script](https://raw.githubusercontent.com/openmv/openmv/wifidbg/ml/haarcascade/cascade_convert.py):

```python
python2 cascade_convert.py my_cascade.xml

```

1. Copy my\_cascade.cascade to camera storage (flash or SD) and run the example script.

---

<div class="post-metadata">

**Author:** ![Funky](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Funky](https://forums.openmv.io/u/Funky)\
**Post date:** [July 24, 2018, 7:50pm UTC](https://forums.openmv.io/t/help-for-haar-cascade/836/3 "2018-07-24T19:50:00Z")

</div>

Sorry for the late reply,

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

```python
 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 [Make your own Haar Cascade on Windows | Quick & Simple | Face Detection - YouTube](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 ?

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [July 25, 2018, 1:18am UTC](https://forums.openmv.io/t/help-for-haar-cascade/836/4 "2018-07-25T01:18:29Z")

</div>

Hi,

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