Coloring an image in matlab -


i know how color rectangle created in matlab following code:

rectangle = 255*ones(100,100); line1 = zeros(1,70); line2 = zeros(1,40); rectangle(1,1:70) = line1; rectangle(40,1:70) = line1; rectangle(1:40,1) = line2; rectangle(1:40,70) = line2; figure(1) imshow(rectangle); 

thanks help!

i'd suggest looking matlabs built in graphics objects rather making them scratch; save significant time. different method though - not manipulating matrices, using built in objects matlab has specified. can here more info, here's example might relevant:

figure; hold all; xlim([0,1]); ylim([0,1]); set(gca,'visible','off'); rectangle('position',[0,0,.5,.5],'facecolor',[1,0,0]); rectangle('position',[.5,.5,.2,.2],'facecolor',[0,0,1],'edgecolor',[0,0,0],'linewidth',4,'linestyle','--'); 

resulting picture:

enter image description here


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -