how to put border on the image over top and bottom

조회 수: 9 (최근 30일)
arbab umair
arbab umair 2019년 11월 24일
답변: Akira Agata 2019년 11월 26일
i have sucessfully implemented the border on left and right but unable to do on top and bottom
code that i have used for this program is
a = imread('imagea.jpg');
b = imread('imageb.jpg');
close all;
[y,x,c] = size(a);
c = uint8(zeros(y,10,c));
d=[a,c,b];
c(:,:,1) = 255;
d=[c,a,c,b,c];
imshow(d);
Out put result of this is like that
left_right_border.jpg
now i want border on top and bottom, but no progress

답변 (2개)

Bryan
Bryan 2019년 11월 24일
could you not just do
plot([min(xlim) max(xlim)],[max(ylim) max(ylim)], 'r-', 'linewidth', 2)
plot([min(xlim) max(xlim)],[min(ylim) min(ylim)], 'r-', 'linewidth', 2)

Akira Agata
Akira Agata 2019년 11월 26일
Assuming "imagea.jpg" and "imageb.jpg" have the same size, how about the following?
a = imread('imagea.jpg');
b = imread('imageb.jpg');
sz = size(a);
Iab = [a,b];
figure
imshow(Iab)
hold on
rectangle(...
'Position', [1 1 sz(2)-1 sz(1)-1],...
'LineWidth',2,...
'EdgeColor','r')
rectangle(...
'Position',[sz(2) 1 sz(2)-1 sz(1)-1],...
'LineWidth',2,...
'EdgeColor','r')

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by