HOW TO CONVERT GRAY IMAGE TO HUE IMAGE?

1 view (last 30 days)
i am trying to find psnr value of hue image and gray image
i need to know how to convert gray image to hue

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 13 Jun 2019
Edited: KALYAN ACHARJYA on 13 Jun 2019
Have you read about Hue? Read here in wiki
I dont think there is any conversiotion way, if you do somehow, all gray pixels=0 in hue space (color appearance parameters).
Must read thread here
  5 Comments
tashu Dabariya
tashu Dabariya on 14 Jun 2019
img=imread('.jpg');
% imresize for resize image
img=imresize(img,[256 256]);
img=im2double(img);
figure,imshow(img),title('original image');
% convert rgb to hsv
img1=rgb2hsv(img);
H=img1(:,:,1);
S=img1(:,:,2);
V=img1(:,:,3);
H(:,:,1) = H(:,:,1) * 2.5; %increase hue image
figure(), subplot(2, 2, 1), imshow(img), title('Original')
subplot(2, 2, 2), imshow(H), title('Hue'), colorbar
subplot(2, 2, 3), imshow(S), title('Saturation'), colorbar
subplot(2, 2, 4), imshow(V), title('Value of Brightness'), colorbar
% otsu thresholding
fim=rgb2gray(img);
level=graythresh(fim);
bwfim=im2bw(fim,level);
figure(),imshow(bwfim),title('Otsu')
sir, I want to find accuracy through psnr and mse or any option to find the accuracy of hue image and binary image (Otsu)
I don't understand how to find the accuracy of hue and binary image
tashu Dabariya
tashu Dabariya on 14 Jun 2019
Edited: tashu Dabariya on 14 Jun 2019
H = (H);
bwfim =double (bwfim);
% Find the mean squared error
mse = sum((H(:)-bwfim(:)).^2) / numel(H)
% now find the psnr, as peak=255
psnr = 10*log10(255*255/mse)
want to know is it right code to find mse and psnr?

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 14 Jun 2019
The code you gave is irrelevant. It will produce bogus results. To compare colors you need to use Delta E. Plus, it's meaningless to compare the hue channel of a color image to a binary image. You need to describe what you want better so I know how to answer you. I do color image analysis every day (for decades), so I might know a little about it.
  6 Comments
tashu Dabariya
tashu Dabariya on 15 Jun 2019
i want accuracy of identification of greenness
how to find accuracy of identification?
Image Analyst
Image Analyst on 15 Jun 2019
None of what you said about PSNR makes sense.
To find accuracy of identification, you might use your binary image of what your algorithm found for "green" and compare it to what you hand drew with imfreehand(). Then use the Sorensen Dice coefficient (see Wikipedia).

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!