miniprojet/ROS/gesture_based_control/src/descripteur.cpp

31 lines
708 B
C++
Raw Normal View History

#include <ros/ros.h>
#include <opencv2/opencv.hpp>
#include <image_transport/image_transport.h>
#include <cv_bridge/cv_bridge.h>
//#include <math.hpp>
void callback(const sensor_msgs::ImageConstPtr& msg) {
cv_bridge::CvImagePtr cv_ptr;
try {
cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::RGB8);
}catch(cv_bridge::Exception& e) {
ROS_ERROR("cv_bridge exception: %s", e.what());
return;
}
const cv::Mat& input = cv_ptr->image;
}
int main(int argc, char** argv) {
ros::init(argc, argv, "descripteur");
ros::NodeHandle n;
image_transport::ImageTransport it(n);
image_transport::Subscriber sub = it.subscribe("/image_raw", 1, callback);
ros::spin();
}