Generate histogram of HSV quantized image

4 views (last 30 days)
Hello,
I have tried to quantize the HSV color space but I can not, can anyone help me please?
I want to Quantization HSV Space by assigning 8 level each to hue, saturation and value to give a quantized HSV space with 8x8x8=512 histogram bins.
I have used the following code for that but I am getting an error in rescale function. Can anyone help me to sort out this problem?
rgbImage = imread('1.jpg');
hsvImage = rgb2hsv(rgbImage);
montage(hsvImage,'Size', [1, 3]); title('Before Quantization'); colorbar;
threshRGB = multithresh(hsvImage, 8);
threshForPlanes = zeros(3, 8);
for i = 1:3
threshForPlanes(i, :) = multithresh(hsvImage(:, :, i), 8);
end
quantPlane = zeros(size(hsvImage));
for i = 1:3
value = [0 threshForPlanes(i, 2:end) 1];
quantPlane(:, :, i) = imquantize(hsvImage(:, :, i), threshForPlanes(i, :), value);
end
quantPlane = double(rescale(quantPlane, 0, 1));
figure; montage(quantPlane, 'Size', [1,3]); title('After Quantization');
colormap(parula(8)); colorbar;
% Error: Undefined function 'rescale' for input arguments of type 'double'.
quantPlane = double(rescale(quantPlane, 0, 1));
Thank you.

Accepted Answer

Image Analyst
Image Analyst on 8 Aug 2020
Why are you calling multithresh() and imquantize() to quantize it. Just call histogram() if you want the histogram. Your subject line says you want to "Generate histogram of HSV quantized image". Quantizing it will not create a histogram. The histogram() function will.
  4 Comments
Priyanka Mehta
Priyanka Mehta on 11 Aug 2020
As an input I will give one image. its matching images should be retrived from the dataset. this should be done using histogram of HSV image.
Image Analyst
Image Analyst on 11 Aug 2020
You should Google "CBIR" and see what algorithms people are using.

Sign in to comment.

More Answers (0)

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!