title: ROS ImagePtr and Image Compilation Confusion
body: <p>I am trying to create a publish a custom message that has two images. Here is the custom message file:</p>
  <pre><code>Header header
  sensor_msgs/Image leftimage
  sensor_msgs/Image rightimage
  </code></pre>
  <p>And here is the file where I try to publish the images from my stereo camera over ROS using my custom message:</p>
  <pre><code>sensor_msgs::ImagePtr leftmsg;
  sensor_msgs::ImagePtr rightmsg;
  leftmsg = cv_bridge::CvImage(std_msgs::Header(), &quot;mono8&quot;, leftframe).toImageMsg();
  rightmsg = cv_bridge::CvImage(std_msgs::Header(), &quot;mono8&quot;, rightframe).toImageMsg();
  stereo.leftimage = leftmsg;
  stereo.rightimage = rightmsg;
  stereo_pub.publish(stereo);
  </code></pre>
  <p>However, I am getting the following compilation error when I <code>catkin_make</code>:</p>
  <pre><code>    error: no match for ‘operator=’ (operand types are ‘duo_cam::Stereo_&lt;std::allocator&lt;void&gt; &gt;::_leftimage_type {aka sensor_msgs::Image_&lt;std::allocator&lt;void&gt; &gt;}’ and ‘sensor_msgs::ImagePtr {aka boost::shared_ptr&lt;sensor_msgs::Image_&lt;std::allocator&lt;void&gt; &gt; &gt;}’)
              stereo.leftimage = leftmsg;
                               ^
      note: candidate is:
      In file included from /opt/ros/indigo/include/image_transport/publisher.h:39:0,
               from /opt/ros/indigo/include/image_transport/image_transport.h:38,
      sensor_msgs::Image_&lt;std::allocator&lt;void&gt; &gt;&amp; sensor_msgs::Image_&lt;std::allocator&lt;void&gt; &gt;::operator=(const sensor_msgs::Image_&lt;std::allocator&lt;void&gt; &gt;&amp;)
       struct Image_
              ^
  </code></pre>
  <p>How do I correct this? I already am using the toImageMsg() function which I see online makes the ImagePtr into an Image, so not sure what is going wrong.</p>