0
$\begingroup$

Rosanswers logo

Hey I have the following subscriber:

ImageConverter(ros::NodeHandle &n) :  n_(n), it_(n_)
{
  image_pub_ = it_.advertise("/output_img",1);

  cv::namedWindow(OPENCV_WINDOW);
  image_transport::TransportHints TH("compressed");
  image_sub_compressed.subscribe(n,"/Logitech_webcam/image_raw/compressed",5,&ImageConverter::imageCallback,ros::VoidPtr(),TH);
}

And the callback function

void imageCallback(const sensor_msgs::CompressedImageConstPtr& msg)

When I compile this I get an error:

from /home/johann/catkin_ws/src/uncompressimage/src/publisher_uncompressed_images.cpp:1:
/usr/include/boost/function/function_template.hpp: In instantiation of ‘static void boost::detail::function::function_void_mem_invoker1<MemberPtr, R, T0>::invoke(boost::detail::function::function_buffer&, T0) [with MemberPtr = void (ImageConverter::*)(const boost::shared_ptr<const sensor_msgs::CompressedImage_<std::allocator<void> > >&); R = void; T0 = const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&]’:
/usr/include/boost/function/function_template.hpp:934:38:   required from ‘void boost::function1<R, T1>::assign_to(Functor) [with Functor = void (ImageConverter::*)(const boost::shared_ptr<const sensor_msgs::CompressedImage_<std::allocator<void> > >&); R = void; T0 = const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&]’
/usr/include/boost/function/function_template.hpp:722:7:   required from ‘boost::function1<R, T1>::function1(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = void (ImageConverter::*)(const boost::shared_ptr<const sensor_msgs::CompressedImage_<std::allocator<void> > >&); R = void; T0 = const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
/usr/include/boost/function/function_template.hpp:1069:16:   required from ‘boost::function<R(T0)>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = void (ImageConverter::*)(const boost::shared_ptr<const sensor_msgs::CompressedImage_<std::allocator<void> > >&); R = void; T0 = const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
/home/johann/catkin_ws/src/uncompressimage/src/publisher_uncompressed_images.cpp:27:126:   required from here

The red error statement was:

/usr/include/boost/function/function_template.hpp:225:11: error: no match for call to ‘(boost::_mfi::mf1<void, ImageConverter, const boost::shared_ptr<const sensor_msgs::CompressedImage_<std::allocator<void> > >&>) (const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&)’
           BOOST_FUNCTION_RETURN(boost::mem_fn(*f)(BOOST_FUNCTION_ARGS));

I am not using BOOST, and searching around hasn't helped me solve it, this is how I think it should be based on reading the github for the sensor_msgs::compressedImages, if another method exists that is better?


Originally posted by jtim on ROS Answers with karma: 153 on 2016-07-15

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Read the source code:

https://github.com/ros-perception/image_common/tree/hydro-devel/image_transport/src

const sensor_msgs::CompressedImageConstPtr& compressedImg outputImg = cv::imdecode(cv::Mat(compressedImg->data), CV_LOAD_IMAGE_UNCHANGED);


Originally posted by soulslicer with karma: 61 on 2016-07-15

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by jtim on 2016-07-17:
@soulslicer Can't seem to find it in the source could you specify the file? Also the code you refer, creates and const pointer to a compressedImg data? Seems to be some wrong with the code? Also the idea was to decompress the image? so from Sensor_msgs::CompressedImage to Sensor_msgs::Image.

Comment by jtim on 2016-07-18:
@soulslicer I am not able to find the code you refer to, can you be more precise?

$\endgroup$
0
$\begingroup$

Rosanswers logo

ended up recompiling opencv and ros from source, the error was removed. However the subscription didn't work. Therefore I subscribed to the raw image that I had republished in a launch file. Now everything works.


Originally posted by jtim with karma: 153 on 2016-07-29

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.