Reputation: 23
I have labelled image objects with their respective height ,width and coordinates of bounding box around them in pixels. I have calculated the mid point of both the bounding box.how to compare the mid point of both the objects and calculate distance between two them.
Upvotes: 0
Views: 1856
Reputation: 1927
I assume you mean the 2D distance within the image? In this case, find the Euclidean distance:
const double dx = a.x - b.x;
const double dy = a.y - b.y;
const double distance = sqrt(dx * dx + dy * dy);
where a
and b
are your mid-points.
Upvotes: 1