Borrar filtros
Borrar filtros

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

4 visualizaciones (últimos 30 días)
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];

Respuesta aceptada

Image Analyst
Image Analyst el 10 de Feb. de 2019
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 comentarios
ezhil K
ezhil K el 10 de Feb. de 2019
what does bboxCoords(:,1:2); indicate?
Image Analyst
Image Analyst el 10 de Feb. de 2019
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);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Automotive en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by