Colorbars of image in matab
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Walter Roberson
2018 年 9 月 11 日
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 件のコメント
Image Analyst
2018 年 9 月 11 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Red についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!