title: Affine transformation (shear) opencv c++
body: <p>So I have an image which I want to apply a shear transformation on using OpenCV.</p>
  
  <p>Here's a function I wrote,</p>
  
  <pre><code>Mat shearMat(Mat img){
  
  Mat temp;
  img.copyTo(temp);
  Mat M(2,3,CV_32F);
  
  
  M.at&lt;uint16_t&gt;(0,0) = 1;
  M.at&lt;uint16_t&gt;(0,1) = 0;
  M.at&lt;uint16_t&gt;(0,2) = 0;
  
  M.at&lt;uint16_t&gt;(1,0) = 0;
  M.at&lt;uint16_t&gt;(1,1) = 1;
  M.at&lt;uint16_t&gt;(1,2) = 0;
  
  warpAffine(temp, temp, M , Size(temp.cols,temp.rows));
  imshow("Sheared_Image", temp);
  </code></pre>
  
  <p>M is the inputArray for  <code>warpAffine(&lt;#InputArray src#&gt;, &lt;#OutputArray dst#&gt;, &lt;#InputArray M#&gt;, &lt;#Size dsize#&gt;);
  </code>
  I need to know how M should look like if I want to apply a shear transformation. It says it should be a 2x3 Matrix. When I try to show the image now, nothing appears. I know that <code>M.at&lt;uint16_t&gt;(1,0)</code> should be the shear factor, but its not working with warpAffine. </p>
  
  <p>Thanks! </p>