how to create bouding box
조회 수: 2 (최근 30일)
이전 댓글 표시
I have centroid of picture I want create bounding box upper and lower from center point of picture
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161047/image.jpeg)
댓글 수: 0
답변 (1개)
Image Analyst
2017년 3월 4일
Use rectangle() and your x and y centroid which you say you already have:
[rows, columns, numberOfColorChannels] = size(mask);
imshow(mask);
axis on;
hold on
% Specify half height of the rectangle.
halfHeight = 200; % Whatever you want.
% Plot rectangle in upper half.
rectangle('Position',[1, yCentroid - halfHeight, columns, 2*halfHeight], ...
'LineWidth', 3, 'EdgeColor', 'b');
% Plot star in middle
plot(xCentroid, yCentroid, 'b*', 'MarkerSize', 30)
hold off
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!