cv::KalmanFilter not working [Solved]
I'm trying to use kalman filter in ROS with OpenCV library, but I'm getting error.
below is the error that I'm getting while compilation.
error: ‘KalmanFilter’ is not a member of ‘cv’ cv::KalmanFilter kf(stateSize, measSize, contrSize, type); ^ /home/pkumars/catkin_ws/src/cv_bridge_tutorial_pkg/src/kalman_code1.cpp:59:19: error: expected ‘;’ before ‘kf’ cv::KalmanFilter kf(stateSize, measSize, contrSize, type); ^
and here is my code that I'm trying to compile.
// ROS synchronization headers
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <message_filters/time_synchronizer.h>
// ROS headers
#include <ros/ros.h>
#include <sensor_msgs/Image.h>
#include <sensor_msgs/CameraInfo.h>
#include <sensor_msgs/PointCloud2.h>
#include <image_transport/image_transport.h>
#include <sensor_msgs/image_encodings.h>
// OpenCV headers
#include <cv_bridge/cv_bridge.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
// c++ headers
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <math.h>
// pcl headers
#include <pcl_ros/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/filters/voxel_grid.h>
#include <boost/foreach.hpp>
#include <pcl/io/pcd_io.h>
// visualization header
#include <visualization_msgs/Marker.h>
// point cloud definition
typedef pcl::PointCloud<pcl::PointXYZ> PointCloud;
// standard namespace for c++, ROS messages transport, ROS message filters, OpenCV
using namespace std;
using namespace sensor_msgs;
using namespace message_filters;
using namespace cv;
// Kalman filter parameters
int stateSize = 6; // 6 no of states
int measSize = 3; // 3 parameters to be measured
int contrSize = 0; //
unsigned int type = CV_32F; // type
int main( int argc, char *argv[] )
{
ros::init(argc, argv, "prediction_node");
ros::NodeHandle nh;
ROS_INFO("Starting ");
cv::KalmanFilter kf(stateSize, measSize, contrSize, type);
ros::spin();
return 0;
}