Distance between bounding corners

19 次查看(过去 30 天)
r_com3
r_com3 2019-12-17
评论: Adam Danz 2019-12-22
Hello, i am struggling with task of finding the distance between corners of bounding boxes of objects.
My image with bounding box around the objetcs looks like this:
im.jpg
The oriented bounding box is taken from the algorythm in this link :
My task is to find the green and blue distances on the image.
Anyone has idea how to perform it ?
Thanks in advance :)
im2.jpg

回答(1 个)

Adam Danz
Adam Danz 2019-12-17
编辑:Adam Danz 2019-12-17
You could probably achieve the same results using regionprops from the Image Processing Toolbox (see BoundingBox property). In either case, you need to get the coordinates of the rectangle from the function output. Then you can use the pythagorean distance formula [video][literature] or Matlab's, pdist2() to compute the distance between the corners of each bounding box. It's probably easiest just to compute the distance between all 4 corners of box N and box N+1 and then the two closest corners are the ones you're interested in.
If you get stuck, show us how far you got and we can help out with the next steps.
  7 个评论
Image Analyst
Image Analyst 2019-12-21
Which bounding box do you mean? Like:
  1. one from regionprops(), or
  2. the tilted one you got somehow, or
  3. the corners of the entire image?
You might also be interested in simply Using John D'Errico's bounding rectangle app: A suite of minimal bounding objects. It's a "Suite of tools to compute minimal bounding circles, rectangles, triangles, spheres, incircles, etc."
screenshot.jpg

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by