How to compare one H,S and V histogram with another H,S and V histogram

2 views (last 30 days)
Hello,
I have genereted H, S and V histograms of two images. Anyone can give me suggestion for how to compare them for similarity. I have used the below code
rgbImage = imread('0.JPG');
rgbImage2 = imread('1.JPG');
hsvImage = rgb2hsv(rgbImage);
hImage = hsvImage(:, :, 1);
sImage = hsvImage(:, :, 2);
vImage = hsvImage(:, :, 3);
hsvImage2 = rgb2hsv(rgbImage2);
hImage2 = hsvImage2(:, :, 1);
sImage2= hsvImage2(:, :, 2);
vImage2 = hsvImage2(:, :, 3);
figure;
subplot(2,2,1);
hHist = histogram(hImage);
grid on;
title('Hue Histogram');
subplot(2,2,2);
sHist = histogram(sImage);
grid on;
title('Saturation Histogram');
subplot(2,2,3);
vHist = histogram(vImage);
grid on;
title('Value Histogram');
subplot(2,2,2);
imshow(rgbImage);
subplot(2,2,3);
hHist = histogram(hImage2);
grid on;
title('Hue Histogram');
subplot(2,2,2);
sHist = histogram(sImage2);
grid on;
title('Saturation Histogram');
subplot(2,2,3);
vHist = histogram(vImage2);
title('Value Histogram');
subplot(2,2,4);
imshow(rgbImage2);
Thank you.
  1 Comment
Sudheer Bhimireddy
Sudheer Bhimireddy on 9 Aug 2020
missing the code.
If your image sizes are equal, then you can compare them directly. Example, img_1 == img_2. If not you may want to scale.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 9 Aug 2020
Perhaps you just want to take the mean and standard deviation of each histogram. Why don't you look into CBIR papers to see how they do it?

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!