how to transform image from one coordinate frame to another coordinate frame using c++
<p>I have two images from two different cameras, for which I have done both intrinsic and extrinsic calibration.</p>

<p>I have done transforming point clouds(3D) from both the cameras to base_link frame and added together(point cloud registration).</p>

<p>I wanted to do the same for 2D images. That is, I want to transform both the images and add it together so that I get one large image as if taken from one single camera.</p>

<p>Is my approach correct. If so How would I do it.</p>

<p>Thanks in advance.</p>

<p><strong>Update</strong></p>

<p>This is what im trying to do,</p>

<pre><code>    listener-&gt;waitForTransform(reference_frame, camera_link, ros::Time(0), ros::Duration(5.0));
    listener-&gt;lookupTransform(reference_frame, camera_link,  ros::Time(0), transform);

    cv::Mat t(4,4,CV_64F, cvScalar(0.0));

    t.at&lt;double&gt;(3,0) = transform.getOrigin().getX();
    t.at&lt;double&gt;(3,1) = transform.getOrigin().getY();
    t.at&lt;double&gt;(3,2) = transform.getOrigin().getZ();

    t.at&lt;double&gt;(0,0) = transform.getRotation().getX() / transform.getRotation().getW();
    t.at&lt;double&gt;(1,1) = transform.getOrigin().getY() / transform.getRotation().getW();
    t.at&lt;double&gt;(2,2) = transform.getOrigin().getZ() / transform.getRotation().getW();

    t.at&lt;double&gt;(3,0) = 1;
    t.at&lt;double&gt;(3,1) = 1;
    t.at&lt;double&gt;(3,2) = 1;

    t.at&lt;double&gt;(3,3) = 1;

    cv::Mat inputImag = cv_ptr-&gt;image;
    cv::Mat dest;
    cv::Size size(inputImag.cols,inputImag.rows);
    cv::warpAffine(inputImag, dest, t, size);
</code></pre>

<p>Im getting the following error,</p>

<pre><code>OpenCV Error: Assertion failed ((M0.type() == CV_32F || M0.type() == CV_64F) &amp;&amp; M0.rows == 2 &amp;&amp; M0.cols == 3) in warpAffine, file /build/buildd/opencv-2.4.8+dfsg1/modules/imgproc/src/imgwarp.cpp, line 3455
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/buildd/opencv-2.4.8+dfsg1/modules/imgproc/src/imgwarp.cpp:3455: error: (-215) (M0.type() == CV_32F || M0.type() == CV_64F) &amp;&amp; M0.rows == 2 &amp;&amp; M0.cols == 3 in function warpAffine
</code></pre>

<p>Can someone help me to solve this problem.</p>