ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

how to do opencv haartraining with opencv from ROS?

asked 2014-05-15 10:01:57 -0500

Pollon gravatar image

updated 2015-08-18 01:35:45 -0500

ahendrix gravatar image

I am new to opencv haartraining and really need some help. I want to train my own haar classifier so I followed some step by step tutorials:

but I am stuck because I can't find the haartraining folder which is needed in --> cp src/mergevec.cpp ~/opencv-2.4.5/apps/haartraining

The problem is I am using opencv installed with ROS hydro (version opencv 2.4.6) and I cannot find where is located the haartraining folder which I need.

I tried using bash comands: sudo find / -iname 'haartraining', sudo find / -iname 'apps', sudo find / -iname 'opencv', sudo find / -iname 'opencv2' but none of these helped me find the haartraining folder.

I am working on Ubuntu 12.04.

Can you suggest how to find the folder haartraining, or how to do the haartraining with opencv from ROS?

Please help me

edit retag flag offensive close merge delete


it would help if you show what compiler error you get (if using C++) and your package's Manifest.xml and CMakefiles.txt How did you install OpenCV?

Mehdi. gravatar image Mehdi.  ( 2014-05-15 16:20:21 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-05-16 09:28:30 -0500

Alexandr Buyval gravatar image


I have found 'opencv_haartraining' file into 'opt/ros/hydro/bin/' folder on my computer. I am also using ROS Hydro on Ubuntu 12.04.

However, please note, there is new version of haar training program. It is 'opencv_traincascade'. This program also is located into 'opt/ros/hydro/bin/' folder.

You can use this program like the following sample:

opencv_traincascade -data haarcascade_file -vec pos_samples.vec -bg negatives.dat -numStages 20 -precalcValBufSize 2000 -precalcIdxBufSize 2000 -featureType LBP -minHitRate 0.999 -maxFalseAlarmRate 0.05 -numPos 3000 -numNeg 3019 -w 24 -h 24 -mode ALL
edit flag offensive delete link more


Thank you :)

Pollon gravatar image Pollon  ( 2014-05-17 03:24:32 -0500 )edit

Question Tools

1 follower


Asked: 2014-05-15 10:01:57 -0500

Seen: 593 times

Last updated: May 16 '14