Show the object in boundary box
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to use boundary box for each objects and then calculate color histogram for each object !
Here in my code, I tried to show the object which is "white square"
[row , col ] = size (bbox);
for i =1 : row
x = bbox(i,1);
y =bbox(i,2);
w=bbox(i,3);
h=bbox(i,4);
TestImage = OriginalImage(x:(x+w), y:(y+h),:);
r = TestImage(:,:,1);
g = TestImage(:,:,2);
b = TestImage(:,:,3);
subplot(2,2,3)
imshow(TestImage);
end
but the result isn't what I expected, see the image ! Any advice please :)

0 comentarios
Respuestas (1)
Image Analyst
el 6 de Feb. de 2018
This is a very common beginner mistake.
You think arrays are indexed as OriginalImage(x, y). They ARE NOT. They are indexed as OriginalImage(row, column), which is OriginalImage(y, x). Reverse your indexes:
TestImage = OriginalImage(y:(y+h), x:(x+w), :);
0 comentarios
Ver también
Categorías
Más información sobre Computer Vision with Simulink 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!