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

DGM
DGM 2022년 7월 24일
What exactly are the known pieces of information, and in what form are they given?
Ariane Moura
Ariane Moura 2022년 7월 24일
I have the coordinate (x,y) (file in attachment).
Ariane Moura
Ariane Moura 2022년 7월 24일
the vector is v = [0.154778 0.450424 0] and the angle is 1.2398.
Ariane Moura
Ariane Moura 2022년 7월 24일
the attached file also has the unknown coordinates represented by ? in the drawing.
Ariane Moura
Ariane Moura 2022년 7월 24일
DGM
DGM 2022년 7월 24일
"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 2022년 7월 24일
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 2022년 7월 24일
I would like to know the corresponding coordinates.
Ariane Moura
Ariane Moura 2022년 7월 24일
@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)

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt J
Matt J 2022년 7월 24일
편집: Matt J 2022년 7월 24일

0 개 추천

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

Ariane Moura
Ariane Moura 2022년 7월 24일
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 2022년 7월 24일
편집: Matt J 2022년 7월 24일
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 2022년 7월 25일
편집: Matt J 2022년 7월 25일
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.

댓글을 달려면 로그인하십시오.

제품

릴리스

R2017b

질문:

2022년 7월 24일

편집:

2022년 7월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by