title: Rotate Opencv Matrix by 90, 180, 270 degrees
body: <p>I'm capturing image from webcam and I need to rotate it by right angle. I found myself theese functions: </p>
  
  <ol>
  <li><code>getRotationMatrix2D</code> - to create rotation matrix (whatever it is)</li>
  <li><code>transform</code> - transform one matrix to another by rotation matrix</li>
  </ol>
  
  <p>But, I don't get anything but black area. This is my code:</p>
  
  <pre><code>   if(rotate_button.click%4&gt;0) {
         double angle = (rotate_button.click%4)*90;  //button increments its click by 1 per click
         Mat transform_m = getRotationMatrix2D(Point(cam_frame_width/2, cam_frame_height/2), angle, 1);  //Creating rotation matrix
         Mat current_frame;
         transform(cam_frame, current_frame, transform_m);  //Transforming captured image into a new one
         cam_frame = Mat((int)current_frame.cols,(int)current_frame.rows, cam_frame_type) = Scalar(0,128,0);  //resizing captured matrix, so I can copy the resized one on it
         current_frame.copyTo(cam_frame);  //Copy resized to original
     }
  </code></pre>
  
  <p>Outputs just black screen.</p>