1

I was wondering if there is a way to choose a fixed hue, so I could unify the the color of multiple images at once (using a Matlab code, not manually in Photoshop). I am using a code which rotates the color while presenting the image on screen (using mouse movements, via LAB colormap), but if I choose images which are colored differently initially, the colors in the color wheel aren't similar for each image (some are very bright, other dark). I thought that if I could unify the original color into the same hue, this could help. I tried using the following code in order to get all images red, but, the red color isn't identical between images - leading to a major variety in colors when rotating them.

items = 101:116;

for i = 1:length(items) 

    filename = sprintf('%d.jpg',items(i)); 
    img = imread(fullfile('StudyImages', filename)); 
    h = rgb2hsv(img);
    h(:,:,1) = 1;
    h=hsv2rgb(h);
    imshow(h)
    newfilename = fullfile('StudyImages/fixed_color',filename);
    imwrite(h,newfilename) 

end
Suever
  • 64,497
  • 14
  • 82
  • 101
natalie
  • 11
  • 2
  • 2
    It's hard to understand what you're trying to do. Can you post some example images of what you want the output to look like, and some examples of what it does look like (where it doesn't work)? – user20160 Jun 04 '16 at 21:25
  • @user20160. Sure. See in the following google drive link, an example of 3 pictures which were handled manually to get a fixed color and the same pictures which i changed their color using the code above (with a fixed hue of 0.99). Note that the color of the images isn't similar in the second example - this is the same hue value, but it looks different (pink, red..). [link] (https://drive.google.com/folderview?id=0B56OTSrVSfYBT3YyakdPRC1OUjg&usp=sharing) – natalie Jun 05 '16 at 08:44
  • The color looks different between your outputs because--although you're setting the hue to a fixed value--the saturation and value channels can vary (e.g. pink and red have the same hue, but red has higher saturation). The program will probably have to do something more akin to what you're doing in the manually adjusted images. Can you explain how the manual adjustment works? I.e. what is it that you're adjusting? Also, can you post the original, unaltered images? – user20160 Jun 05 '16 at 23:44
  • @user20160. I have a memory experiment, in which items are presented in different colors during study, and in test they are presented in gray color, and subjects turn a color wheel in order to choose their correct color. i want to unify the basic color of all images, so the colors in the color wheel will be perceived as identical between images. manually, we try to turn each image to a specific color. gray scale areas will remain gray, and only colored areas will change their color. is my description helpful or am i missing something? i added the original colored images to the google folder. – natalie Jun 06 '16 at 10:08
  • In the google folder, you originally put some manually adjusted images, which you'd like the program to reproduce. What I'm trying to understand is the specific operations you used to produce those images (because the program would need to do something equivalent). – user20160 Jun 06 '16 at 10:22
  • @user20160. these images were manually adjusted in Photoshop - by adjusting the hue and saturation parameters like stated in this link: [link] (https://www.youtube.com/watch?v=ZVIpwxlhd0A). unfortunately, each image got a different value to get the same color (which was determined subjectively). – natalie Jun 07 '16 at 09:19
  • You'll have to mimic the manual operations in a program. Operating on local parts of the image will be much more challenging than global operations (like shifting the hue of all pixels by the same amount). You need a measure of how perceptually close colors in the two images are. Look at colorspaces like CIELAB that are meant to capture this. You also need a way to adjust colors. This could be hue/saturation adjustment (as you've been doing), or some operation in CIELAB colorspace. (continued...) – user20160 Jun 09 '16 at 21:05
  • Treat the problem as a search problem. Perform the adjustment (e.g. shift the hue/saturation), and measure the similarity. Do this for many values of the adjustment. Keep the adjustment that yields the best similarity. – user20160 Jun 09 '16 at 21:06

0 Answers0