Ask Your Question
0

Calculating the distance between two points

asked 2016-02-11 07:48:17 -0600

super_man1993 gravatar image

How do i calculate the distance between two points in java/ opencv

Point point1 = new Point(10,10);
Point point2= new Point(56, 35);

line(image, point1, point2, new Scalar(100, 100, 100));
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-02-11 09:08:26 -0600

Guyygarty gravatar image

updated 2016-02-11 09:11:22 -0600

I'm not familiar with the Java interface but it should be something like

Point difference=Point1-Point2;
double distance =sqrt( difference.ddot(difference));

you are basically doing:

square root of (point1.x-point2.x)^2+(point1.y-point2.y)^2)

guy

edit flag offensive delete link more

Comments

also take a look at this post

sturkmen gravatar imagesturkmen ( 2016-02-12 09:22:29 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-02-11 07:48:17 -0600

Seen: 9,248 times

Last updated: Feb 11 '16