Shifting XY- coordinate system (normally known as left-hand coordinate system) from top left to conventional (right handed) coordinate system?

13 ビュー (過去 30 日間)
waqas
waqas 2020 年 8 月 5 日
回答済み: Gaurav Garg 2020 年 8 月 10 日
Hi,
I want to transform my matrix origin from top left corner (showed in Red color in the plot) to bottom left corner (showed as purple color).
I have already implemented
axis ij
So, it is not just about visualization but I want to do the transformation so that the second plot would flip too resulting in upper half to be positive (as the displacement is towards the top) and bottom half to be negative as the displacement is downwards for that. I need to further process the data based on the normal Cartesian coordinate system.
I have looked at the rotation matrix and different other articles online but could not figure out how exactly to implement this.
File size is larger than 5MBs so I am sharing a googledrive link: [https://drive.google.com/drive/folders/11W-JzQcugCYNft44zdtCikgrRWzwqndq?usp=sharing]. Following code should give you the plots that I have uploaded:
[rows,cols] = size(imread('test1_0000.tif'));
ref = NaN(rows,cols);
X = datafile(:,1); Y = datafile(:,2);
idnx = sub2ind(size(ref),Y,X);
ref(idnx) = datafile(:,3);
subplot(2,1,1)
imshow(imread('test1_0000.tif'),[])
subplot(2,1,2)
ax = pcolor(ref); colormap((parula))
axis ij tight equal;colorbar
ax.LineStyle = 'none';ax.EdgeColor = 'flat';ax.FaceColor = 'flat';
  2 件のコメント
Alan Stevens
Alan Stevens 2020 年 8 月 5 日
Does flipud (on the data) do what you want?
waqas
waqas 2020 年 8 月 5 日
I tried that. But, it changes the crack location and it does not fall exactly where it should be in the first image. If then I use axis ij, I end up with the same problem as I mentioned in the original post.
I think the solution should be with the rotation/transformation matrix.

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

回答 (1 件)

Gaurav Garg
Gaurav Garg 2020 年 8 月 10 日
Hi,
You can transpose the image and then work on it.
image = image(end:-1:1,:)
This will be equivalent to shifting the co-ordinate system to bottom-to-top.

カテゴリ

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