フィルターのクリア

How to retain the size of image when we rotate image?

19 ビュー (過去 30 日間)
binbin cui
binbin cui 2016 年 8 月 6 日
コメント済み: binbin cui 2016 年 8 月 6 日
I was using the imrotate to rotate an image B = imrotate( image,20) and the image was rotated. After certain manipulations, I wanted to make it back to its original image, so I used C = imrotate(B,-20). But I find the size of image C is changed, which is bigger than original image. And the original image lies in the center of image C .Does anyone know how to ensure the size of the image exactly same as the original image after the twice rotation?
  1 件のコメント
binbin cui
binbin cui 2016 年 8 月 6 日
In fact, I wanna get the exact original image after rotation.

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2016 年 8 月 6 日
When it rotates, it enlarges the canvas. You'll have to store the original size so that you can crop it after a round trip rotation. Like if it was 1000 rows, then after rotation it was 1200 rows tall, then when you rotate it back you need to crop off 100 rows from the top and bottom. Same for the right and left sides. I'm sure you can handle the math. Let me know if you can't.
  4 件のコメント
binbin cui
binbin cui 2016 年 8 月 6 日
I do crop it. But the result is totally out of expectation. I find most of the original image is removed after the crop.
binbin cui
binbin cui 2016 年 8 月 6 日
I get it, thank you very much. I should directly retrieve the target matrix from the matrix C but not to crop it.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by