OpenCV Error: Null pointer (NULL or empty buffer) in cvOpenFileStorage
Hi, i am trying to use a face detector node in python with follower node in c++. I have copy the whole turtlebot_follower packages and placed the python node inside src. Following is the error message it shows when i tried to run the node:
OpenCV Error: Null pointer (NULL or empty buffer) in cvOpenFileStorage, file /tmp/buildd/ros-groovy-opencv2-2.4.6-1precise-20131020-2316/modules/core/src/persistence.cpp, line 2703
Traceback (most recent call last):
File "/home/chao/abc/src/turtlebot_follower/nodes/face_detector.py", line 140, in <module>
FaceDetector(node_name)
File "/home/chao/abc/src/turtlebot_follower/nodes/face_detector.py", line 42, in __init__
self.cascade_1 = cv2.CascadeClassifier(cascade_1)
cv2.error: /tmp/buildd/ros-groovy-opencv2-2.4.6-1precise-20131020-2316/modules/core/src/persistence.cpp:2703: error: (-27) NULL or empty buffer in function cvOpenFileStorage
Shutting down vision node.
and this is the python node i placed inside src folder:
#!/usr/bin/env python
""" face_detector.py - Version 1.0 2012-02-11
Based on the OpenCV facedetect.py demo code
Extends the ros2opencv2.py script which takes care of user input and image display
Created for the Pi Robot Project: <a href="http://www.pirobot.org">http://www.pirobot.org</a>
Copyright (c) 2011 Patrick Goebel. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details at:
<a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a>
"""
import roslib; roslib.load_manifest('turtlebot_follower')
import rospy
import cv2
import cv2.cv as cv
from ros2opencv2 import ROS2OpenCV2
class FaceDetector(ROS2OpenCV2):
def __init__(self, node_name):
super(FaceDetector, self).__init__(node_name)
# Get the paths to the cascade XML files for the Haar detectors.
# These are set in the launch file.
cascade_1 = rospy.get_param("~cascade_1", "")
cascade_2 = rospy.get_param("~cascade_2", "")
cascade_3 = rospy.get_param("~cascade_3", "")
# Initialize the Haar detectors using the cascade files
self.cascade_1 = cv2.CascadeClassifier(cascade_1)
self.cascade_2 = cv2.CascadeClassifier(cascade_2)
self.cascade_3 = cv2.CascadeClassifier(cascade_3)
# Set cascade parameters that tend to work well for faces.
# Can be overridden in launch file
self.haar_scaleFactor = rospy.get_param("~haar_scaleFactor", 1.3)
self.haar_minNeighbors = rospy.get_param("~haar_minNeighbors", 3)
self.haar_minSize = rospy.get_param("~haar_minSize", 30)
self.haar_maxSize = rospy.get_param("~haar_maxSize", 150)
# Store all parameters together for passing to the detector
self.haar_params = dict(scaleFactor = self.haar_scaleFactor,
minNeighbors = self.haar_minNeighbors,
flags = cv.CV_HAAR_DO_CANNY_PRUNING,
minSize = (self.haar_minSize, self.haar_minSize),
maxSize = (self.haar_maxSize, self.haar_maxSize)
)
# Do we should text on the display?
self.show_text = rospy.get_param("~show_text", True)
# Intialize the detection box
self.detect_box = None
# Track the number of hits and misses
self.hits = 0
self.misses = 0
self.hit_rate = 0
def process_image(self, cv_image):
# Create a greyscale version of the ...