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:
Comments
Post a Comment