how can we change the color of the portion of a color image

i've divided my image into 8x8 non overlapping blocks with the function
grayImage(row1:row2,col1:col2);
that mean i've total of 64 blocks... i want to change color or intensity of the block number 30 and block 12 what should i do?

 Accepted Answer

8 Comments

The following i've tried is this correct?
clc;
I=imread('C:\Users\Public\Pictures\Sample Pictures\desert.jpg');
[row col band]=size(I);
for i= 50:100
for j=50:100
I(i,j)=2;
end
end
imshow(I);
Well, that is likely to change the color and intensity of part of the image, but it will destroy all existing information in that part of the image as it does so.
Note: the code could be simplified to remove the "for" loops and then
I(50:100, 50:100) = 2;
ya sir.. and thank you for telling me ..
I=imread('C:\Users\Public\Pictures\Sample Pictures\desert.jpg');
Y=gamma_correction(I, [1 255], [0 255], 0.4);
% figure,imshow(I);
% figure,imshow((Y),[]);
i tried but this shows the following error:
Undefined function 'gamma_correction' for input arguments of type 'uint8'.
is gamma_correction an inbuilt function()?
Did you install (and license) the Computer Vision toolbox? Or did you install FEX contribution #26523 and add it to your MATLAB path?
no sir.. what is the procedure for it?
Where did you get this equation in the first place:
Y=gamma_correction(I, [1 255], [0 255], 0.4);
How and why is that the way you want to change your intensity of blocks 30 and 12? And why do you want to change only those two blocks out of the 64 total blocks? Why do you say " i want to change color or intensity" as if you don't care at all what happens to them? In fact you changed them to 2 in your code above and you seemed to think that was okay. I'm baffled as to why you just want to change the color or intensity, but don't seem to care how it gets changed, what it gets changed to, or what it ends up looking like.
On the page http://www.mathworks.com/matlabcentral/fileexchange/26523-the-inface-toolbox-v2-0-for-illumination-invariant-face-recognition click on the blue box "Download submission". That will allow you to download a .zip file to your disk. Save that file to a convenient location, and unzip it. That will probably create a new directory named INFace_zip_no_mex . Open that directory. Inside there will be a directory named INface_tool . Move (or copy) that directory (the whole directory, keeping the name) to a place that you keep your MATLAB source structures. Once you have it moved, go into MATLAB and "cd" to the INface_tool directory that you just established. Then at the MATLAB command prompt, give the command
install_INface
and it will handle the rest of the installation.
Note: you will need to have previously installed a compiler for your system, and then used
mex -setup
to tell MATLAB which compiler you are using.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!