Robotics StackExchange | Archived questions

Error: Cascade File haarcascade_frontalface_alt.xml

Moving from ROS Hydro to Indigo on the PR2 robot (via Clearpath Robotics upgrade), the face_detector package (git) did not work. I have purged and reinstalled through apt-get and used git clone.

When running

$ roslaunch face_detector face_detector.wide.launch​

I get

[ERROR]: Cascade file /usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml doesn't exist.

I have found the file at the following locations.

$ locate haarcascade_frontalface
/opt/ros/indigo/share/OpenCV-3.1.0-dev/haarcascades/haarcascade_frontalface_alt.xml
/opt/ros/indigo/share/OpenCV-3.1.0-dev/haarcascades/haarcascade_frontalface_alt2.xml
/opt/ros/indigo/share/OpenCV-3.1.0-dev/haarcascades/haarcascade_frontalface_alt_tree.xml
/opt/ros/indigo/share/OpenCV-3.1.0-dev/haarcascades/haarcascade_frontalface_default.xml

Is there a solution to this other than sudo cp?

Thanks

Asked by CodyLL on 2016-08-24 10:04:32 UTC

Comments

Not an expert, but looking at param/classifier.yaml it would seem the path to that file is configurable. Have you tried changing/updating it?

Asked by gvdhoorn on 2016-08-24 10:16:16 UTC

That was introduced in wg-perception/people#15.

Asked by gvdhoorn on 2016-08-24 10:17:44 UTC

Thank you this does seem like a solution with the code cloned or with a higher level launch file.

Asked by CodyLL on 2016-08-24 10:25:54 UTC

Yeah. The released pkgs probably expect OpenCV 2 to have been installed. Is the OpenCV-3.1.0-dev dir something 'official'?

Asked by gvdhoorn on 2016-08-24 13:18:18 UTC

The pr2 server computers were returned from Clearpath Robotics in that configuration. On a side note the launch file is still not running. It dies on start up error code -11. No other details. Works file on my laptop. I am assuming face_detector is not compatible with opencv 3

Asked by CodyLL on 2016-08-24 13:36:41 UTC

Might want to report this to both Clearpath as well as the wg-perception/people issue tracker.

Asked by gvdhoorn on 2016-08-25 01:37:15 UTC

Thank you for the assistance. I had reported the problem to them both before posing onto ROS answers.

Asked by CodyLL on 2016-08-25 13:11:53 UTC

Related wg-perception/people#52.

Asked by gvdhoorn on 2019-09-11 05:33:11 UTC

Answers

If opencv file dose not exits in /usr/share, Create folder in /usr/share called ''opencv'' using SUDO then create "haarcascades". search for " haarcascade_frontalface_alt.xml " in all your files then copy it using '' sudo cp -i /home/catkin_ws/ haarcascade_frontalface_alt.xml /usr/share/opencv/haarcascade/ " change /home/catkin_ws/ haarcascade_frontalface_alt.xml to haarcascade_frontalface_alt.xml original file directory.

Asked by Nada Aweaa on 2019-09-11 05:07:01 UTC

Comments

This would not be a good thing to do on an OS which has a package manager (as that is going to complain loudly if you ever try to install OpenCV the proper way.

On the PR2 this would probably also not be good advice.

Asked by gvdhoorn on 2019-09-11 05:32:12 UTC