What does the below line illustrate in finding bounding box coordinates?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
ezhil K
el 10 de Feb. de 2019
Comentada: Image Analyst
el 10 de Feb. de 2019
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];
0 comentarios
Respuesta aceptada
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
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);
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing and Computer Vision en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!