implement own Haar-Cascade
-
- Posts: 6
- Joined: Thu Feb 02, 2017 10:56 am
implement own Haar-Cascade
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/m ... 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(r)
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
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/m ... 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(r)
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
Re: implement own Haar-Cascade
I've altered Ibrahim to this issue. Not sure how to start the debugging process for this as I don't know this part of the code.
Nyamekye,
Re: implement own Haar-Cascade
Can you print the Haar Cascade object to see if it was loaded without issues?
Code: Select all
print hat_cascade
Nyamekye,
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
Hi, I'm not sure why it's not working, try to remove the stages argument to test all stages. If you can you attach the xml and binary cascades I'll test them for you.
-
- Posts: 6
- Joined: Thu Feb 02, 2017 10:56 am
Re: implement own Haar-Cascade
Hi 
yes the print(hat_cascade) works. It prints values like:
20.13845
20.13423
20.13026
20.12651
20.12297
20.11963
...
I attached the XML, but I can't attach the .cascade-file due to the filetype..?
Best regards

yes the print(hat_cascade) works. It prints values like:
20.13845
20.13423
20.13026
20.12651
20.12297
20.11963
...
I attached the XML, but I can't attach the .cascade-file due to the filetype..?
Best regards
- Attachments
-
cascade_scenario4.xml
- (67.04 KiB) Downloaded 300 times
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
It seems to be working on some hats and not others:

Note it has 16 stages (the script prints cascade info) you should use them all.
Update:
I used all cascade stages by just leaving out the stages arg:
Also used a 0.85 threshold and 1.15-1.25 scaling factor.

Note it has 16 stages (the script prints cascade info) you should use them all.
Update:
I used all cascade stages by just leaving out the stages arg:
Code: Select all
hat_cascade = image.HaarCascade("/cascade_scenario4.cascade")
-
- Posts: 6
- Joined: Thu Feb 02, 2017 10:56 am
Re: implement own Haar-Cascade
Thanks for the replies
In the attachment ist the zipped up XML & Cascade
best regards

In the attachment ist the zipped up XML & Cascade
best regards
- Attachments
-
- d-shop.zip
- (10.15 KiB) Downloaded 264 times
-
- Posts: 6
- Joined: Thu Feb 02, 2017 10:56 am
Re: implement own Haar-Cascade
Sorry for asking again, but can someone tell me wheather this .cascade-file is working?
Currently, when I run this code:
import sensor, time, image, pyb
# Reset sensor
sensor.reset()
# Sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)
# HQVGA and GRAYSCALE are the best for face tracking.
sensor.set_framesize(sensor.HQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
greenLed = pyb.LED(2) # define green LED.
# Load Haar Cascade
# By default this will use all stages, lower satges is faster but less accurate.
hat_cascade = image.HaarCascade("/cascadesc22.cascade")
print(hat_cascade)
# frontalface
# /cascade_scenario4.cascade
# FPS clock
clock = time.clock()
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=0.85, scale_factor=1.2)
# Draw objects
for r in objects:
img.draw_rectangle(r)
greenLed.on()
time.sleep(10)
greenLed.off()
# Print FPS.
# Note: Actual FPS is higher, streaming the FB makes it slower.
print(clock.fps())
I just get the line: width:36 height:36 n_stages:17 n_features:150 n_rectangles:260
And the red-LED turns on and I can't do anything, not even disconnecting :/
What am I doing wrong?
attached the cascade-file
best reards
Currently, when I run this code:
import sensor, time, image, pyb
# Reset sensor
sensor.reset()
# Sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)
# HQVGA and GRAYSCALE are the best for face tracking.
sensor.set_framesize(sensor.HQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
greenLed = pyb.LED(2) # define green LED.
# Load Haar Cascade
# By default this will use all stages, lower satges is faster but less accurate.
hat_cascade = image.HaarCascade("/cascadesc22.cascade")
print(hat_cascade)
# frontalface
# /cascade_scenario4.cascade
# FPS clock
clock = time.clock()
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=0.85, scale_factor=1.2)
# Draw objects
for r in objects:
img.draw_rectangle(r)
greenLed.on()
time.sleep(10)
greenLed.off()
# Print FPS.
# Note: Actual FPS is higher, streaming the FB makes it slower.
print(clock.fps())
I just get the line: width:36 height:36 n_stages:17 n_features:150 n_rectangles:260
And the red-LED turns on and I can't do anything, not even disconnecting :/
What am I doing wrong?
attached the cascade-file
best reards
- Attachments
-
- cascadesc22.zip
- (1.86 KiB) Downloaded 237 times
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
No this one doesn't work, when I run the script my cam hangs, if you can attach the xml file for this cascade I'll regenerate it and test again.
-
- Posts: 6
- Joined: Thu Feb 02, 2017 10:56 am
Re: implement own Haar-Cascade
Hi,
I attached the XML-file.
Hope this helps solving my problem
best regards
I attached the XML-file.
Hope this helps solving my problem

best regards
- Attachments
-
cascade.xml
- (67.2 KiB) Downloaded 256 times
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
Hi,fabianhummel wrote: ↑Tue Feb 14, 2017 4:23 amHi,
I attached the XML-file.
Hope this helps solving my problem
best regards
This one works (doesn't crash the camera) it's different from the one you sent before (cascadesc22.cascade) I'm attaching the binary cascade I made with the script
- Attachments
-
- cascade.zip
- (1.69 KiB) Downloaded 242 times
-
- Posts: 6
- Joined: Thu Feb 02, 2017 10:56 am
Re: implement own Haar-Cascade
Hi all,
thanks for the replies!
I have another question:
I created the XML-file with openCV. In order to run it on my Laptop (using it's webcam) I created the new version of the XML-file (without the parameter -SaveBaseFormat).
The result is very good an it detects a lot of hardhats.
Now, in order to run it on the openMV-Cam I need the old format of the XML-file (created by using the parameter -SaveBaseFormat). But then I use the script (https://github.com/openmv/openmv/blob/m ... cascade.py) in order to convert it into a .cascade-file and it detects almost nothing. How ist this possible: I used the same parameters as I did for the new format. :/
Is this a common issue=?
best regards
Fabian
thanks for the replies!
I have another question:
I created the XML-file with openCV. In order to run it on my Laptop (using it's webcam) I created the new version of the XML-file (without the parameter -SaveBaseFormat).
The result is very good an it detects a lot of hardhats.
Now, in order to run it on the openMV-Cam I need the old format of the XML-file (created by using the parameter -SaveBaseFormat). But then I use the script (https://github.com/openmv/openmv/blob/m ... cascade.py) in order to convert it into a .cascade-file and it detects almost nothing. How ist this possible: I used the same parameters as I did for the new format. :/
Is this a common issue=?
best regards
Fabian
Re: implement own Haar-Cascade
Hi iabdalkader,
I tried to replace the eye detection cascade with a new one. I converted the .xml file to .cascade file using the provided tool. But the video stream stuck and I think the camera cracked . I read the thread above and bascially the problem is the same as Fabianhummel's. You created a new binary cascade (cascade.zip) for him and it also works on my machine. I want to know how you did that. I also attached my xml file. It'll be great help if you create a binary cascade for me.
Best regards,
I tried to replace the eye detection cascade with a new one. I converted the .xml file to .cascade file using the provided tool. But the video stream stuck and I think the camera cracked . I read the thread above and bascially the problem is the same as Fabianhummel's. You created a new binary cascade (cascade.zip) for him and it also works on my machine. I want to know how you did that. I also attached my xml file. It'll be great help if you create a binary cascade for me.
Best regards,
- Attachments
-
- eye_det.zip
- (25.42 KiB) Downloaded 173 times
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
Hi, it seems the cascade tool only works on Linux.
-
- Posts: 10
- Joined: Sat Feb 24, 2018 7:11 am
Re: implement own Haar-Cascade
hi @iabdalkader
i want to create a cascade file from xml file
xml file is a opencv sample (haarcascade_fullbody)
i try to convert xml file to cscsde file whit openmv-cascade.py but it return
usage: conver [-h] [-i] [-n NAME] [-s STAGES] [-c] file
conver: error: too few arguments
Traceback (most recent call last):
File "C:\Users\azaduni\Desktop\conver", line 288, in <module>
main()
File "C:\Users\azaduni\Desktop\conver", line 272, in main
args = parser.parse_args()
File "C:\Python27\lib\argparse.py", line 1656, in parse_args
args, argv = self.parse_known_args(args, namespace)
File "C:\Python27\lib\argparse.py", line 1688, in parse_known_args
return self._parse_known_args(args, namespace)
File "C:\Python27\lib\argparse.py", line 1901, in _parse_known_args
self.error(_('too few arguments'))
File "C:\Python27\lib\argparse.py", line 2311, in error
self.exit(2, _('%s: error: %s\n') % (self.prog, message))
File "C:\Python27\lib\argparse.py", line 2299, in exit
_sys.exit(status)
SystemExit: 2
its my xml file
and its openmv-cascade.py whit path chenged
- Attachments
-
haarcascade_fullbody.xml
- (465.65 KiB) Downloaded 166 times
-
conver.py
- (10.07 KiB) Downloaded 174 times
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
I don't know what conver.py is, please use our script:
./openmv-cascade.py haarcascade_fullbody.xml
Also Note it doesn't work on Windows.
./openmv-cascade.py haarcascade_fullbody.xml
Also Note it doesn't work on Windows.
-
- Posts: 10
- Joined: Sat Feb 24, 2018 7:11 am
Re: implement own Haar-Cascade
thank you for answer to my questioniabdalkader wrote: ↑Sat Feb 24, 2018 3:34 pmI don't know what conver.py is, please use our script:
./openmv-cascade.py haarcascade_fullbody.xml
Also Note it doesn't work on Windows.
i use your script and now had this problem
- Attachments
-
- ac.jpg (122.39 KiB) Viewed 32961 times
-
- Posts: 10
- Joined: Sat Feb 24, 2018 7:11 am
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
Can you run it from the terminal so we can see the error ?
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
here I converted the file for you.
- Attachments
-
- haarcascade_fullbody.cascade.zip
- (12.92 KiB) Downloaded 194 times
-
- Posts: 10
- Joined: Sat Feb 24, 2018 7:11 am
Re: implement own Haar-Cascade
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
No the script should work out of the box though, anyway we're going to add a built-in cascade converter to the IDE it's just a matter of time.
-
- Posts: 10
- Joined: Sat Feb 24, 2018 7:11 am
Re: implement own Haar-Cascade
iabdalkader wrote: ↑Mon Feb 26, 2018 7:36 pmCan you run it from the terminal so we can see the error ?
- Attachments
-
- Screenshot from 2018-03-02 03-49-18.png (1.19 MiB) Viewed 32082 times
Re: implement own Haar-Cascade
It looks like you have html in your script... i.e. you didn't download it right...
Nyamekye,
-
- Posts: 10
- Joined: Sat Feb 24, 2018 7:11 am
Re: implement own Haar-Cascade
- Attachments
-
- Screenshot from 2018-03-03 03-11-31.png (192.32 KiB) Viewed 32064 times
-
- Posts: 10
- Joined: Sat Feb 24, 2018 7:11 am
Re: implement own Haar-Cascade
thanks for replying
How to write the xml file to the script or in the other words how to Introduce xml file to script?
-
- Posts: 10
- Joined: Sat Feb 24, 2018 7:11 am
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
Hi download the script like so:
Then run it like this:
Code: Select all
wget https://raw.githubusercontent.com/openmv/openmv/master/usr/openmv-cascade.py
Code: Select all
python2.7 openmv-cascade.py cascade_file.xml
-
- Posts: 10
- Joined: Sat Feb 24, 2018 7:11 am
Re: implement own Haar-Cascade
Thank you so muchiabdalkader wrote: ↑Sat Mar 03, 2018 7:51 pmHi download the script like so:
Then run it like this:Code: Select all
wget https://raw.githubusercontent.com/openmv/openmv/master/usr/openmv-cascade.py
Code: Select all
python2.7 openmv-cascade.py cascade_file.xml
-
- Posts: 7
- Joined: Fri Apr 06, 2018 11:05 pm
Re: implement own Haar-Cascade
hai,i got a problem here,when i try to convert the xml file using converter as here : https://github.com/openmv/openmv/blob/m ... cascade.py
i got an error. So here i attach the xml file.Seem i stuck to convert to cascade file.After that,does the cascade embedded directly to camera or i need to transfer the cascade into internal memory to load on another script.
i got an error. So here i attach the xml file.Seem i stuck to convert to cascade file.After that,does the cascade embedded directly to camera or i need to transfer the cascade into internal memory to load on another script.
- Attachments
-
myhaar.xml
- (1.75 KiB) Downloaded 162 times
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
The converter doesn't work on Windows, try the attached cascade.aqeelyaacob wrote: ↑Tue Apr 10, 2018 9:01 pmhai,i got a problem here,when i try to convert the xml file using converter as here : https://github.com/openmv/openmv/blob/m ... cascade.py
i got an error. So here i attach the xml file.Seem i stuck to convert to cascade file.After that,does the cascade embedded directly to camera or i need to transfer the cascade into internal memory to load on another script.
You need to copy the cascade to flash or sd card, see examples and replies to this post.
- Attachments
-
- myhaar.cascade.zip
- (222 Bytes) Downloaded 154 times
-
- Posts: 7
- Joined: Fri Apr 06, 2018 11:05 pm
Re: implement own Haar-Cascade
it all done,thanks to you.But the detection still low rate,does i need to add more positive image during making a cascade?.here i attach the video and also codingiabdalkader wrote: ↑Wed Apr 11, 2018 11:24 amThe converter doesn't work on Windows, try the attached cascade.aqeelyaacob wrote: ↑Tue Apr 10, 2018 9:01 pmhai,i got a problem here,when i try to convert the xml file using converter as here : https://github.com/openmv/openmv/blob/m ... cascade.py
i got an error. So here i attach the xml file.Seem i stuck to convert to cascade file.After that,does the cascade embedded directly to camera or i need to transfer the cascade into internal memory to load on another script.
You need to copy the cascade to flash or sd card, see examples and replies to this post.
import sensor, time, image
lens_mm = 2.8 # Standard Lens.
average_spool_height_mm = 360.0 #
image_height_pixels = 240.0 # QVGA
sensor_h_mm = 2.952 # For OV7725 sensor - see datasheet.
offest_mm = 100.0 # Offset fix...
# https://photo.stackexchange.com/questio ... in-a-photo
def rect_size_to_distance(r): # r == (x, y, w, h) -> r[3] == h
return ((lens_mm * average_spool_height_mm * image_height_pixels) / (r[3] * sensor_h_mm)) - offest_mm
# Reset sensor
sensor.reset()
# Sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)
# HQVGA and GRAYSCALE are the best for face tracking.
sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
# Load Haar Cascade
# By default this will use all stages, lower satges is faster but less accurate.
spool_cascade = image.HaarCascade("myhaar.cascade", stages=1)
print(spool_cascade)
# FPS clock
clock = time.clock()
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(spool_cascade, threshold=0.75, scale_factor=1.25)
# Draw objects
for i in range(len(objects)):
img.draw_rectangle(objects)
img.draw_string(objects[0] - 16, objects[1] - 16, "Distance %d mm" % rect_size_to_distance(objects))
img.draw_cross(img.width()//2, img.height()//2, size = min(img.width()//5, img.height()//5))
# Print FPS.
# Note: Actual FPS is higher, streaming the FB makes it slower.
print("FPS %f" % clock.fps())
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
I'm not sure, maybe try a lower scaling factor (1.15).aqeelyaacob wrote: ↑Tue Apr 10, 2018 9:01 pmit all done,thanks to you.But the detection still low rate,does i need to add more positive image during making a cascade?.here i attach the video and also coding
-
- Posts: 7
- Joined: Fri Apr 06, 2018 11:05 pm
Re: implement own Haar-Cascade
it's done.thanks..Now i'm designing alignment algorithm for AGV.Openmv camera as input,then arduino as controller also encoder for each mecanum wheels as feedback for positioning agv.Btw can i make that openmv determine the spool position either left or right side plus with distance from camera(already done) to tell AGV position(Camera) against spool(target) ?iabdalkader wrote: ↑Sun Apr 15, 2018 9:22 pmI'm not sure, maybe try a lower scaling factor (1.15).aqeelyaacob wrote: ↑Tue Apr 10, 2018 9:01 pmit all done,thanks to you.But the detection still low rate,does i need to add more positive image during making a cascade?.here i attach the video and also coding
- Attachments
-
- WhatsApp Image 2018-04-30 at 07.50.31.jpeg (66.25 KiB) Viewed 28854 times
-
- Screenshot (16).png (261.62 KiB) Viewed 28854 times
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
@aqeelyaacob Please post a new topic for that with as much details as possible.
Re: implement own Haar-Cascade
I use my own haarcascade_eye.cascade to detect eyeiabdalkader wrote: ↑Fri Feb 03, 2017 11:20 amHi, I'm not sure why it's not working, try to remove the stages argument to test all stages. If you can you attach the xml and binary cascades I'll test them for you.
Error: unaligned read buf:10004fd6 count3
best wishes
Thankyou
Re: implement own Haar-Cascade
The link above seems not existed any longer. I get it from https://github.com/openmv/openmv/blob/m ... convert.pyiabdalkader wrote: ↑Sat Mar 03, 2018 7:51 pmHi download the script like so:
Code: Select all
wget https://raw.githubusercontent.com/openmv/openmv/master/usr/openmv-cascade.py
but when I ran it with attached xml file on ubuntu, it printed below error message:
Converting new XML format..
Traceback (most recent call last):
File "cascade_convert.py", line 422, in <module>
main()
File "cascade_convert.py", line 419, in main
cascade_binary_universal(args.file, args.stages, args.name)
File "cascade_convert.py", line 101, in cascade_binary_universal
cascade_binary(path, n_stages, name)
File "cascade_convert.py", line 183, in cascade_binary
rects = feature[idx].getElementsByTagName('_')
IndexError: list index out of range
- Attachments
-
haarcascade_frontalface_alt2.xml
- (527.95 KiB) Downloaded 135 times
-Falong
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
Hi, support for the new Haar cascade format is somewhat limited, we only support 1 feature and 2 alpha per weak classifier. This cascade has 2 features and 3 alpha per weak classifier so it's not going to work. See the haarcascade_frontalcatface.xml for an example of a supported new format cascade, or use the old format.Falong wrote: ↑Tue Jun 19, 2018 11:35 pmThe link above seems not existed any longer. I get it from https://github.com/openmv/openmv/blob/m ... convert.pyiabdalkader wrote: ↑Sat Mar 03, 2018 7:51 pmHi download the script like so:
Code: Select all
wget https://raw.githubusercontent.com/openmv/openmv/master/usr/openmv-cascade.py
but when I ran it with attached xml file on ubuntu, it printed below error message:
Converting new XML format..
Traceback (most recent call last):
File "cascade_convert.py", line 422, in <module>
main()
File "cascade_convert.py", line 419, in main
cascade_binary_universal(args.file, args.stages, args.name)
File "cascade_convert.py", line 101, in cascade_binary_universal
cascade_binary(path, n_stages, name)
File "cascade_convert.py", line 183, in cascade_binary
rects = feature[idx].getElementsByTagName('_')
IndexError: list index out of range
Re: implement own Haar-Cascade
Hi,
Does the cascade converter work on macos?I couldnt find the eye cascade binary in the Github directory, so had to generate it but it doesnt detect. I used the frontalface cascade binary provided and it works.
Does the cascade converter work on macos?I couldnt find the eye cascade binary in the Github directory, so had to generate it but it doesnt detect. I used the frontalface cascade binary provided and it works.
Re: implement own Haar-Cascade
Hi, I'll put some effort into updating the docs for all that in the future. Um, but, yest, it works on Mac if you have all the required libs.
Nyamekye,
Re: implement own Haar-Cascade
Thanks for the reply. If the binary generated from the provided eye cascade xml doesn't detect the eye, what could be the problem? i pass roi from the frontalface detect. I have attached my files. Could you please share me a working eye cascade binary, i am confused?
- Attachments
-
- eye.zip
- eye cascade
- (63.82 KiB) Downloaded 105 times
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
Haven't tested it before on Mac.
The eye and face cascades are built-in the firmware because they are very common. To load a built-in cascade, just use its name without a path, ex:
Code: Select all
c = load('eye.cascade')
Could you try the example first using the built-in cascades, and see if it works ?
Examples->08-Eye-Tracking->face_eye_detection.py
Re: implement own Haar-Cascade
Hi,
face_eye_detection.py looks fine but it doesnt work with the eye cascade generated by me. I have attached the cascade in my previous post, could you please regenerate and try?
Thanks for the support. Much appreciated!
face_eye_detection.py looks fine but it doesnt work with the eye cascade generated by me. I have attached the cascade in my previous post, could you please regenerate and try?
Thanks for the support. Much appreciated!
- iabdalkader
- Posts: 1326
- Joined: Sun May 24, 2015 3:53 pm
Re: implement own Haar-Cascade
The script should generate an identical cascade. Note I never tested the converted on Mac (and it doesn't work on Windows) I can only confirm it works on Linux, you could try to run the script on Linux VM and compare the output.
Re: implement own Haar-Cascade
Hi iabdalkader,iabdalkader wrote: ↑Wed Oct 17, 2018 2:14 pmThe script should generate an identical cascade. Note I never tested the converted on Mac (and it doesn't work on Windows) I can only confirm it works on Linux, you could try to run the script on Linux VM and compare the output.
I tried to use your cascade_convert.py to convert haarcascade_frontalcatface.xml but always failed. and I don't know why.
could you help me convert it?
Thanks a ton!
Return to “Technical Discussion”
Who is online
Users browsing this forum: No registered users and 0 guests