Drawing a coloured border around an image in MATLAB? -


hey i'm trying put coloured border around image in matlab , can't life of me see why isn't working:

clear, close all, clc  = imread('syd.jpg')  [m n o] = size(a) border_width = 25;  border = zeros(m+(border_width*2),n+(border_width*2),3);  c = [randi(255) randi(255) randi(255)];  border(:,:,1) = c(1); border(:,:,2) = c(2); border(:,:,3) = c(3);  = 1 : m     j = 1 : n         border(m+border_width,n+border_width,:) = a(m,n,:);     end end  imshow(uint8(border)); 

all block coloured image, maybe i'm missing small, doing wrong?

in for-loop, indexing m , n, instead of i , j. variables m , n constants, meaning setting value of 1 pixel in code.

try this:

for = 1 : m     j = 1 : n         border(i+border_width,j+border_width,:) = (a(i,j,:));     end end 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -