How to draw a rectangle in matlab with only his center ?
25 次查看(过去 30 天)
显示 更早的评论
I would like to draw a rectangle with only one informatiom which is his center . I have the coordinates X and Y of fis Center and like to draw a rectangle with specific dimesions . I would like to know if theres a function which do it
0 个评论
回答(1 个)
Image Analyst
2017-12-14
The rectangle function.
width = 100; % whatever
height = 50; % whatever...
xCenter = 400; % Wherever...
yCenter = 800; % Wherever...
xLeft = xCenter - width/2;
yBottom = yCenter - height/2;
rectangle('Position', [xLeft, yBottom, width, height], 'EdgeColor', 'b', 'FaceColor', 'r', 'LineWidth', 4);
xlim([340, 460]);
ylim([740, 860]);
grid on;
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!