how to change the color of one portion of an image to another portion of the same image using MATLAB -
i have color image. image consists of object has shadow. have removed shadow shadow portion's color not similar background color .now how can match color using matlab coding?
you can change matlab matrix (here called img) corresponds image. example, changed pixels of shadows -20. can indexes doing
indexes = (img == -20)
to change values background color, assumed equals 100 example, set doing
img(indexes) = 100
since you're working color images, need 3 color matrices corresponds image. in case have background color each layer, repeat process
indexes1 = (img(:, :, 1) == shadow_color_layer_1)
indexes2 = (img(:, :, 2) == shadow_color_layer_2)
indexes3 = (img(:, :, 3) == shadow_color_layer_3)
img(indexes,1) = background_color_layer_1
img(indexes,2) = background_color_layer_2
img(indexes,3) = background_color_layer_3
Comments
Post a Comment