How to rotate a line about center point??

1 回表示 (過去 30 日間)
Heera Bhadrecha
Heera Bhadrecha 2014 年 10 月 20 日
コメント済み: Image Analyst 2014 年 10 月 22 日
I have an image i want to rotate line between two point by center point .
  1 件のコメント
Image Analyst
Image Analyst 2014 年 10 月 22 日
It's not clear to me. Post an image (screenshot) showing the image, the "center point" and the line. Then explain if you just want to "rotate line" (rotate the line itself and not the image) like you said, or if you want to rotate the image . And what does "between two point" mean? Do you mean a line segment where the line is defined just as going between one point and another point rather than off to infinity in both directions? And that line rotates around the "center point"? And is that "center point" the center point of the whole image, or the center point of the line segment?

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

採用された回答

Mohammad Abouali
Mohammad Abouali 2014 年 10 月 21 日
Let's say you want to rotate around and arbitrary points designated by (ro,co);
Here how you can do it:
% Top left corner as center of rotation
ro=1;
co=1;
I=imread('peppers.png');
[r,c,nB]=size(I);
I2=zeros(2*r,2*c,nB,'like', I);
I2(r-ro+1:2*r-ro,c-co+1:2*c-co,:)=I;
Irotated=imrotate(I2,45);

その他の回答 (2 件)

michael scheinfeild
michael scheinfeild 2014 年 10 月 20 日
use imrotate or calculate the affine transform
  1 件のコメント
Heera Bhadrecha
Heera Bhadrecha 2014 年 10 月 21 日
but i have a center point ,left top and right top point.i want to line rotate a line between left top and right top.

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


Heera Bhadrecha
Heera Bhadrecha 2014 年 10 月 21 日
Thanks How to calculate the angle between two line when one line is rotating???
  1 件のコメント
Mohammad Abouali
Mohammad Abouali 2014 年 10 月 22 日
編集済み: Mohammad Abouali 2014 年 10 月 22 日
use dot (inner) product

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

カテゴリ

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