What does the below line illustrate in finding bounding box coordinates?

1 回表示 (過去 30 日間)
ezhil K
ezhil K 2019 年 2 月 10 日
コメント済み: Image Analyst 2019 年 2 月 10 日
I have obtained the code for finding the coordinates of bounding box.I could'nt understand the logic behind the code.Can anyone help me in understanding it?
I have attached the code.Please help me in understanding the code.
% // Calculate top left corner
topLeftCoords = bboxCoords(:,1:2);
% // Calculate top right corner
topRightCoords = [topLeftCoords(:,1) + bboxCoords(:,3) topLeftCoords(:,2)];
% // Calculate bottom left corner
bottomLeftCoords = [topLeftCoords(:,1) topLeftCoords(:,2) + bboxCoords(:,4)];
% // Calculate bottom right corner
bottomRightCoords = [topLeftCoords(:,1) + bboxCoords(:,3) ...
topLeftCoords(:,2) + bboxCoords(:,4)];
% // Calculating the minimum and maximum X and Y values
finalCoords = [topLeftCoords; topRightCoords; bottomLeftCoords; bottomRightCoords];

採用された回答

Image Analyst
Image Analyst 2019 年 2 月 10 日
The form for the bounding box is [xLeft, yTop, width, height].
So to get the x on the right, you do
xRight = xLeft + width;
To get the y on the bottom row, you do
yBottom = yTop + height;
Knowing that you can get the (x,y) coordinates of any corner in the box.
  3 件のコメント
ezhil K
ezhil K 2019 年 2 月 10 日
what does bboxCoords(:,1:2); indicate?
Image Analyst
Image Analyst 2019 年 2 月 10 日
Like I said, they're in the bounding box array - whatever you used to construct bboxCoords. Let's say you called it bbox
xLeft = bbox(1);
yTop = bbox(2);
width = bbox(3);
height = bbox(4);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by