필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
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 CenterFile Exchange에서 Automotive에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by