How can i get the minimum and maximum values of h,s and v of HSV image?
8 views (last 30 days)
Show older comments
im working on a colour scale to determine the standard of my data(rgb images) and i have successfully converted my rgb image to hsv image. now to complete my colour scale, i need to find the range of each component of hsv by finding the minimum and maximum values for h, s and v of the converted image and display it in text form..but how do i do that?
i manage to find the min for RGB values but stuck on finding min and max of HSV values. below is some of my coding:
data=fopen('minvaluesRGB.txt','w+');
I_HSV = rgb2hsv(I_RGB);
slice_reshape=reshape(I_HSV,[],3);
[unique_RGB,m,n]=unique(slice_reshape,'rows');
minRGB2=sort(unique_RGB(:,:,1));
minRGB22=minRGB2(2,:);
[R]=minRGB22(:,1);
[G]=minRGB22(:,2);
[B]=minRGB22(:,3);
fprintf(data,'%f',[R]);
fprintf(data,'\n');
fprintf(data,'%f',[G]);
fprintf(data,'\n');
fprintf(data,'%f',[B]);
fprintf(data,'\n');
thanks.
0 Comments
Accepted Answer
Guillaume
on 30 Apr 2015
Finding the min of the HSV channels is exactly the same as finding the min of the RGB channels, but in the HSV space:
%minimum of RGB channels:
Rchannel = I_RGB(:, :, 1); Rmin = min(Rchannel(:))
Gchannel = I_RGB(:, :, 2); Gmin = min(Gchannel(:))
Bchannel = I_RGB(:, :, 3); Bmin = min(Bchannel(:))
%minimum of HSV channels:
I_HSV = rgb2hsv(I_RGB);
Hchannel = I_HSV(:, :, 1); Hmin = min(Hchannel(:))
Schannel = I_HSV(:, :, 2); Smin = min(Schannel(:))
Vchannel = I_HSV(:, :, 3); Vmin = min(Vchannel(:))
More Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!