Generate histogram of HSV quantized image
5 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Image Analyst
2020-8-8
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!