Plot a 2D image in projected coordinate systems.

12 views (last 30 days)
Haraldur Blöndal Kristjánsson
Edited: Matt J on 25 Sep 2020
I am not sure if the title describes my problem well enough - trying to get used to the notation and things like that in linear algebra and geography.
To start with then I have this image and it is represented in a 2D matrix, call it A. I want to project it onto a plane normal to n=[1,2,3]. I believe I have understood how to find the perpendular vectors from A to the normal plane.
(hope I am using the right words but meaning the vector going from the origin, parallell to the normal vector creates a 90 degree corner with the vector going from the normal plain to another vector in the original image 2D - creating right triangle)
Anyhow I will describe it a bit, so if you have the mathimatical understanding to tell me wrong it would be nice, because then I do not need the Matlab help yet. My matrix A started with [1; -90] so I used that as the origin (x0,y0,z0) (z would be 0 right in 2D?) then I took just the next vector from the A [1; -91] as (x1,y1,z1) n = (a,b,c) then I need to find t so that (x0,y0,z0) (x1,x2,x3) and (x0+ta,y0+tb,z0+tc) make right triangle and then the point (x0+ta,y0+tb,z0+tc) is the projection of [1;-91].
t = ((a*x1-ax0)+(b*x1-b*x0) + (c*x1-c*x0))/(a² + b² + c²)
t = 0.142857 and the I could find the projected image by A (original image) + t*n(the normal vector).
Ok, hope someone understood my... my Matlab question is how can I plot visually this new 3*10095 matrix so I have the three axis in the plot (seeing the image laying down on the z axis after the transformation)?

Answers (1)

Matt J
Matt J on 25 Sep 2020
Edited: Matt J on 25 Sep 2020
I do not understand how a 3*10095 matrix is being interpreted as an image. You don't to have any pixel values, as far as I can see. If you just want to plot a cloud of 3D points, you would use scatter3().
Matt J
Matt J on 25 Sep 2020
Yes, you can use hold():
hold on
scatter3(R(1,:,:),R(2,:,:),R(3,:,:),1,[0 0 0])
scatter3(A(1,:,:),A(2,:,:),A(3,:,:),1,[0 0 0])
hold off

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!