Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've <strong>found a solution</strong> that doesn't involve <a href="http://opencv.willowgarage.com/documentation/cpp/geometric_image_transformations.html#cv-warpaffine" rel="noreferrer"><code>warpAffine()</code></a>.</p> <p>But before that, I need to state (for future references) that my suspicion was right, you needed to pass the size of the destination when calling <a href="http://opencv.willowgarage.com/documentation/cpp/geometric_image_transformations.html#cv-warpaffine" rel="noreferrer"><code>warpAffine()</code></a>:</p> <pre><code>warpAffine(image, rotated_img, rot_matrix, rotated_img.size()); </code></pre> <p>As far as I can tell, the black border (caused by writing at an offset) drawed by this function seems to be it's standard behavior. I've noticed this with the C interface and also with the C++ interface of OpenCV running on Mac and Linux, using the versions 2.3.1a and 2.3.0.</p> <p>The solution I ended up using is <strong>much simpler</strong> than all this <em>warp thing</em>. You can use <a href="http://opencv.willowgarage.com/documentation/cpp/core_operations_on_arrays.html#cv-transpose" rel="noreferrer"><code>cv::transpose()</code></a> and <a href="http://opencv.willowgarage.com/documentation/cpp/core_operations_on_arrays.html#cv-flip" rel="noreferrer"><code>cv::flip()</code></a> to rotate an image by 90 degrees. Here it is:</p> <pre><code>Mat src = imread(argv[1], 1); cv::Mat dst; cv::transpose(src, dst); cv::flip(dst, dst, 1); imwrite("rotated90.jpg", dst); </code></pre> <p><img src="https://i.stack.imgur.com/Hyel9.jpg" width="250" height="250"> <strong>----I></strong> <img src="https://i.stack.imgur.com/4X4so.jpg" width="250" height="250"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload