Generating Colour Image Using Matlab -


i want draw color image in matlab of size 200*200 pixel ,type rgb , square size of green color in middle i-e 76 row , 125 column.

enter image description here

then want draw 20*20 pixels square of red, green, blue , black in corner's of same image. don't know how or draw color boxes (rgb) in matlab.

enter image description here

i have done in binary shown in following fig:enter image description here

you need define 3 components mentioned: r, g, b. if want work color channels integers 0..255, need convert matrix type integer:

img = ones(256,256,3) * 255;    % 3 channels: r g b img = uint8(img);               % using integers 0 .. 255 % top left square: img(1:20, 1:20, 1) = 255;       % set r component maximum value img(1:20, 1:20, [2 3]) = 0;     % clear g , b components % top right square: img(1:20, 237:256, [1 3]) = 0;  % clear r , b components img(1:20, 237:256, 2) = 255;    % set g component maximum % bottom left square: img(237:256, 1:20, [1 2]) = 0; img(237:256, 1:20, 3) = 255; % bottom right square: img(237:256, 237:256, [1 2 3]) = 0;  imshow(img); 

hope helps idea.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

debian - 500 Error upon login into Plesk Admin - auth.php3? -