Opposite coordinate in the image

Hi!!!
I would like to find the opposite coordinate in the image according to the slope angle of a known vector. How can I achieve this?

9 Kommentare

DGM
DGM am 24 Jul. 2022
What exactly are the known pieces of information, and in what form are they given?
Ariane Moura
Ariane Moura am 24 Jul. 2022
I have the coordinate (x,y) (file in attachment).
Ariane Moura
Ariane Moura am 24 Jul. 2022
the vector is v = [0.154778 0.450424 0] and the angle is 1.2398.
Ariane Moura
Ariane Moura am 24 Jul. 2022
the attached file also has the unknown coordinates represented by ? in the drawing.
Ariane Moura
Ariane Moura am 24 Jul. 2022
DGM
DGM am 24 Jul. 2022
"file also has the unknown coordinates represented by ? in the drawing." ???
How would these be the unknown coordinates? They aren't on the edge of the image, nor are they unknown.
Is it safe to assume the coordinates are in pixels?
Which intersection are you trying to find? Since if these are in pixels, none of the points lie on the edge of the image. Each line can have two intersections, so which ones? All of them? Only intersections with the bottom edge? What if a line doesn't intersect the bottom edge?
Ariane Moura
Ariane Moura am 24 Jul. 2022
The coordinates are pixels and are on the edge on the image. All the pixels lie on the the edge of the image. It hard to explain.
Ariane Moura
Ariane Moura am 24 Jul. 2022
I would like to know the corresponding coordinates.
Ariane Moura
Ariane Moura am 24 Jul. 2022
@DGM, I tried to improve the figure:
The answer would be:
(x1,y1) (x4,y8)
(x2,y1) (x5,y8)
(x3,y1) (x6,y8)
(x4,y1) (x7,y8)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Matt J
Matt J am 24 Jul. 2022
Bearbeitet: Matt J am 24 Jul. 2022

0 Stimmen

Use linexlines2D, to be downloaded from,
load Vertices
Nv=size(Vg,1);
[ymax,xmax]=size(Image);
Vg(:,3)=1;
V=repmat(v,Nv,1);
E=cross(Vg,V).'; %line equations
points=linexlines2D(E, [0,ymax] , [xmax,ymax]); %the result

4 Kommentare

Ariane Moura
Ariane Moura am 24 Jul. 2022
I tried using your code and function and I was not successful. I tried to improve the figure:
Maybe the xyBoundary=linexlines2D(poly,[a,b,c]) resolve the problem?
Is it possible to find a equation for a vector?
Matt J
Matt J am 24 Jul. 2022
Bearbeitet: Matt J am 24 Jul. 2022
Here's a more concrete example to demonstrate that it works:
Vg=[0:3;zeros(1,4)]'
Vg = 4×2
0 0 1 0 2 0 3 0
v=[3,7,0];
Nv=size(Vg,1);
[ymax,xmax]=deal(7);
Vgh=Vg; Vgh(:,3)=1;
V=repmat(v,Nv,1);
E=cross(Vgh,V).'; %line equations
result=[Vg, linexlines2D(E, [0,ymax] , [xmax,ymax])'] %the result
result = 4×4
0 0 3 7 1 0 4 7 2 0 5 7 3 0 6 7
Thanks for your answer!
In my real data, the y max also varies, as you can see on the attachment.
v = [0.1548 0.4504 0]
Nv=size(Cd,1);
xmax = max(Cd(:,1));
ymax = max(Cd(:,2));
Cd(:,3)=1;
V=repmat(v1,Nv,1);
E=cross(Cd,V).'; %line equations
Cd_f=[Cd, linexlines2D(E, [0,ymax] , [xmax,ymax])'];
The image does not have a regular shape as in the schematic figure as shown above.
Is it possible to use you code in this case?
Matt J
Matt J am 25 Jul. 2022
Bearbeitet: Matt J am 25 Jul. 2022
The image does not have a regular shape as in the schematic figure as shown above.
The image in your schematic is rectangular, which is the only shape an image can have. [xmax,ymax] are the dimensions of the image - they should be fixed.

Melden Sie sich an, um zu kommentieren.

Produkte

Version

R2017b

Gefragt:

am 24 Jul. 2022

Bearbeitet:

am 25 Jul. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by