how to generate hsv color and hsv range
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I want to generate hsv color automatically. The process is i have a matrix
color=zeros([10,10,3],'double');
i want to assign hue, saturation and value as follows:
color(:,:,1)=.001;//hue color(:,:,2)=.002;//saturation color(:,:,3)=.003;//value
then imshow(color);
i saved this file with imwrite function. Then I want to read the file and get the hsv value of color file.but it does not give me that value as I assigned.
How to get the appropriate value I assigned and also the range of
Hue,saturation and value i.e min and max range of Hue,saturation and value,
Can any one help me in this regard. Thanks
Golam Kibria
0 comentarios
Respuestas (1)
Walter Roberson
el 25 de Abr. de 2011
None of the file formats supported by imwrite() are able to write floating point numbers for the components. PPM files support raw binary of up to 16 bits per channel, but the smallest floating point format that MATLAB supports is 32 bits per channel. All other file formats for color images scale the RGB values by 2^N (where N is the number of bits per channel) and convert the result to integers. Depending on the file format chosen, 8 or 16 bits per channel are typical. A file format that only supports 8 bits per channel would have a minimum distinguishable RGB value of 1/256 which is about 0.004 . Therefore, unless you use a file format with more than 8 bits per channel, your values of 0.01 will be converted into binary 0.
imshow() is not able to display HSV images directly.
None of the file formats supported by imwrite() is intended to store HSV images; on the other hand, the lossless formats do not care what the components represent... just don't ask to display the resulting file. Beware that if you use a lossy image format such as JPEG that there will be assumptions about the meaning of the components, and so storing HSV values and allowing those to be compressed could potentially result in significant image alteration.
Please see rgb2hsv() and hsv2rgb().
0 comentarios
Ver también
Categorías
Más información sobre Modify Image Colors en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!