How can I correction hue values of image

4 次查看(过去 30 天)
How can I correction hue values of image
  2 个评论
Fu-An Nung
Fu-An Nung 2016-10-17
I have a wrong tonal image.I want to make it have correct tonal.

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2016-10-17
You need to snap an image of a color standard with known color values. The usual standard is the x-rite Color Checker Chart. Then you have known XYZ values. You can use least squares to derive a transform to convert your RGB values, of the color chips on a picture of that chart that you have taken, into XYZ values. Then you can use analytical formulas to convert XYZ into LAB or other calibrated color spaces.
  4 个评论
Fu-An Nung
Fu-An Nung 2016-10-17
编辑:Image Analyst 2016-10-17
Excuse me I have run this code . but I only got a all black image. Did I do something wrong?
clc, clear;
fi = imread('sofa_1.jpg');
hsvImage = rgb2hsv(fi);
someFactor = 0.77; % or whatever.
hsvImage(:,:,1) = hsvImage(:,:,1)*someFactor ;
rgbImage = uint8(hsv2rgb(hsvImage));
imshow(rgbImage);
Image Analyst
Image Analyst 2016-10-17
Try this:
clc;
clearvars;
close all;
workspace;
fontSize = 15;
format compact
format short g;
rgbImage = imread('peppers.png');
subplot(2, 4, 1);
imshow(rgbImage);
axis on;
title('Original Image', 'FontSize', fontSize);
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
hsvImage = rgb2hsv(rgbImage);
hImage = hsvImage(:, :, 1);
sImage = hsvImage(:, :, 2);
vImage = hsvImage(:, :, 3);
subplot(2, 4, 2);
imshow(hImage, [0, 1]);
title('Hue Image', 'FontSize', fontSize);
subplot(2, 4, 3);
imshow(sImage, []);
title('Saturation Image', 'FontSize', fontSize);
subplot(2, 4, 4);
imshow(vImage, []);
title('Value Image', 'FontSize', fontSize);
someFactor = 1.6; % or whatever.
% Use mod to "wrap around" values more than 1.
hImageNew = mod(hImage * someFactor, 1);
subplot(2, 4, 6);
imshow(hImageNew, [0, 1]);
title('New Hue Image', 'FontSize', fontSize);
% Create new image
hsvImage = cat(3, hImageNew, sImage, vImage);
% Convert back to RGB color space.
rgbImageNew = hsv2rgb(hsvImage); % It's double in the range of 0-1 here.
% Convert to uint8 in the range 0-255
rgbImageNew = uint8(255 * mat2gray(rgbImageNew));
subplot(2, 4, 5);
imshow(rgbImageNew);
title('Changed Image', 'FontSize', fontSize);

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by