Image rotation along the frame

1 回表示 (過去 30 日間)
Kiran Pandiri
Kiran Pandiri 2020 年 9 月 1 日
コメント済み: Mohammad Sami 2020 年 9 月 4 日
I am trying to rotate an image but the out image has the black background at the tilted edges. I have attached both the input and output images. In the output image there is black background after rotation of the image. Could you please suggest how to avoid this. I need only my image in that place. When you see the brick.000 and brick.030 images even after rotation there is no black background in brick.030

回答 (1 件)

Mohammad Sami
Mohammad Sami 2020 年 9 月 1 日
You have to crop the image to get rid of the black border. If you want to get the same size as the input image the you have to resize it after cropping.
See this answer for more details. https://stackoverflow.com/questions/5789239/calculate-largest-rectangle-in-a-rotated-rectangle#7519376
  2 件のコメント
Kiran Pandiri
Kiran Pandiri 2020 年 9 月 3 日
Hi Sami,
Thank you for the response. I have checked the code in stackoverflow and it gives an error at the line
tl = round(max(size(B)/2 - hw/2,1));
because of the dimensions mismatch. I have tried to resolve it but not able to get the output.
Mohammad Sami
Mohammad Sami 2020 年 9 月 4 日
Change it to as follows. The size mismatch is due to author not considering the color (3rd) dimension.
tl = round(max(size(B,[1 2])/2 - hw/2,1));

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

カテゴリ

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