Ask Your Question
0

Compile Time Error when making image_view

asked 2015-02-28 16:17:49 -0500

kenrobinson gravatar image

Hi all,

I am trying to get ros installed on the Raspberry Pi 2. Let me first say what a pleasure it is reading the helpful how to's.

I am following the http://wiki.ros.org/indigo/Installati...

With this I am trying to use some of the open cv libraries along with the robot package. Raspberry Pi 2 Raspbian has the open cv 2 libraries (including dev) installed.

Linux raspberrypi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l GNU/Linux

This is the packages I am trying to install rosinstall_generator robot image_common image_pipeline image_transport_plugins \ vision_opencv --rosdistro indigo --deps --wet-only --exclude roslisp cd /home/-\ -tar > indigo-robot_opencv_custom-wet.rosinstall

When running make this is the error I get the following error. This seems to say it cannot find the conversion for certain cv defined types, yet the header file that has these definitions is found and candidates are called. Should I build cv from stratch?

pi@raspberrypi ~/ros_catkin_ws/build_isolated/image_view $ make [100%] Built target disparity_view [100%] Built target extract_images [100%] Built target image_saver [100%] Built target image_view [100%] Built target image_view_exe [100%] Built target stereo_view [100%] Building CXX object CMakeFiles/video_recorder.dir/src/nodes/video_recorder.cpp.o /home/pi/ros_catkin_ws/src/image_pipeline/image_view/src/nodes/video_recorder.cpp: In function ‘void callback(const ImageConstPtr&, const CameraInfoConstPtr&)’: /home/pi/ros_catkin_ws/src/image_pipeline/image_view/src/nodes/video_recorder.cpp:64:9: error: no match for ‘operator<<’ in ‘std::operator<< with _Traits = std::char_traits<char>, ((const char)"Starting to record "))), ((const std::basic_string<char>)(& codec)))), ((const char)" video at ")) << size’ /home/pi/ros_catkin_ws/src/image_pipeline/image_view/src/nodes/video_recorder.cpp:64:9: note: candidates are: /usr/include/c++/4.6/ostream:110:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& ()(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] /usr/include/c++/4.6/ostream:110:7: note: no known conversion for argument 1 from ‘cv::Size’ to ‘std::basic_ostream<char>::__ostream_type& ()(std::basic_ostream<char>::__ostream_type&) {aka std::basic_ostream<char>& ()(std::basic_ostream<char>&)}’ /usr/include/c++/4.6/ostream:119:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type& ()(std::basic_ostream<_CharT, _Traits>::__ios_type&)) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>, std::basic_ostream<_CharT, _Traits>::__ios_type = std::basic_ios<char>] /usr/include/c++/4.6/ostream:119:7: note: no known conversion for argument 1 from ‘cv::Size’ to ‘std::basic_ostream<char>::__ios_type& ()(std::basic_ostream<char>::__ios_type&) {aka std::basic_ios<char>& ()(std::basic_ios<char>&)}’ /usr/include/c++/4.6/ostream:129:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& ()(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] /usr/include/c++/4.6/ostream:129:7: note: no known conversion for argument 1 from ‘cv::Size’ to ‘std::ios_base& ()(std ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2015-02-28 20:30:08 -0500

kenrobinson gravatar image

updated 2015-02-28 20:51:12 -0500

So I found the cause of the problem. The Size template has no operator <<. I changed the code to access the members width and height.

ROS_INFO_STREAM("Starting to record " << codec << " video at width " << size.width << " height " <<\ size.height << "@" << fps << "fps. Press Ctrl+C to stop recording." );

I am still confused how the Size type gets to use these methods in Size_. Is there some typedef elsewhere? This is in /usr/include/opencv2/core/core.hpp

//////////////////////////////// Size_ ////////////////////////////////

/*!
The 2D size class

The class represents the size of a 2D rectangle, image size, matrix size etc.
Normally, cv::Size ~ cv::Size_<int> is used.
*/ template<typename _tp=""> class CV_EXPORTS Size_ { public: typedef _Tp value_type;

//! various constructors                                                                                                  
Size_();
Size_(_Tp _width, _Tp _height);
Size_(const Size_& sz);
Size_(const CvSize& sz);
Size_(const CvSize2D32f& sz);
Size_(const Point_<_Tp>& pt);

Size_& operator = (const Size_& sz);
//! the area (width*height)                                                                                               
_Tp area() const;

//! conversion of another data type.                                                                                      
template<typename _Tp2> operator Size_<_Tp2>() const;

//! conversion to the old-style OpenCV types                                                                              
operator CvSize() const;
operator CvSize2D32f() const;

_Tp width, height; // the width and the height

};

I guess I do a patch now and submit to the maintainer?

edit flag offensive delete link more

Comments

Hi,

first: thanks for finding this solution, I had the same problem, but for compiling I had to use

" height " << size.height

instead off

" height " <<\ size.height

Wedigo gravatar image Wedigo  ( 2015-08-10 04:54:28 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-02-28 16:17:49 -0500

Seen: 319 times

Last updated: Feb 28 '15