Colorbars of image in matab
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi i have a image in .JPG format. I have imported the image into matlab and have used the imshow command to plot the image. Know i want to display the color-bar containing the same colors in the image. I am using MATLAB R2015a. Can anyone suggest any codes which i can use.
0 commentaires
Réponses (2)
Walter Roberson
le 11 Sep 2018
No, that is not possible.
In order to draw a colorbar you have to have a scalar value for each distinct color. You arrange the scalar values in order and draw the corresponding color at the correct relative position according to the scalar values, and call the result a colorbar.
However you can never do that for color jpeg. Jpeg supports scalar values at positions for grayscale (though this is very rare to encounter in practice), and jpeg supports RGB in which there are three values per pixel (not a scalar). Jpeg does not support indexed (colormapped) images, which is a system of linear values per pixel and an associated colormap indicating which color is associated with which pixel.
So color jpeg are never composed of scalar values, only of triplets per pixel. Therefore you cannot associate a scalar with each location as required to construct a colorbar.
0 commentaires
Image Analyst
le 11 Sep 2018
You need to use the function colorcloud(). This will show you the 3 dimensional color gamut of your image. The complete color gamut cannot be shown in a bar, it has to be shown in a scatterplot-like format like colorcloud() gives you.
0 commentaires
Voir également
Catégories
En savoir plus sur Red dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!