Matab 灰度图 生成 伪彩色 图像 gray convert to pseudo color
来源:互联网 发布:八月经济数据 编辑:程序博客网 时间:2024/05/09 18:41
Matab 灰度图 生成 伪彩色 图像 gray convert to pseudo color
原文出处: http://www.alecjacobson.com/weblog/?p=1655
In matlab you can view a grayscale image with:
imshow(im)
Which for my image im
shows:
And you can also view this grayscale image using pseudocolors from a given colormap with something like:
imshow(im,'Colormap',jet(255))
Which shows:
But it’s not obvious how to use the colormap to actually retrieve the RGB values we see in the plot. Here’s a simple way to convert a grayscale image to a red, green, blue color image using a given colormap:
rgb = ind2rgb(gray2ind(im,255),jet(255));
Replace the 255
with the number of colors in your grayscale image. If you don’t know the number of colors in your grayscale image you can easily find out with:
n = size(unique(reshape(im,size(im,1)*size(im,2),size(im,3))),1);
It’s a little overly complicated to handle if im
is already a RGB image.
If you don’t mind if the rgb image comes out as a uint8 rather than double you can use the following which is an order of magnitude faster:
rgb = label2rgb(gray2ind(im,255),jet(255));
Then with your colormaped image stored in rgb
you can do anything you normally would with a rgb color image, like view it:
imshow(rgb);
which shows the same as above:
I = imread('G:\H1.png');I = rgb2gray(I);rgb = label2rgb(gray2ind(I, 255), jet(255));imshow(rgb);
- Matab 灰度图 生成 伪彩色 图像 gray convert to pseudo color
- OpenCV 生成 伪彩色图像 pseudo color image 易用colorbar 调节
- 双端滤波器应用于灰度和彩色图像Bilateral Filtering for Gray and Color Images
- 灰度图像转伪彩色
- 生成伪彩色图像
- 灰度图像转化为伪彩色图像
- 灰度图像的伪彩色处理
- 灰度图像的伪彩色处理
- 彩色图像--伪彩处理 灰度图转伪彩色图像
- 彩色图像转灰度图
- 图像处理--灰度图像伪彩色(MFC VC++)
- 【图像处理】灰度图(Gray Scale Image)
- 彩色图像->灰度图像:
- 灰度图像彩色图像
- 比较两幅相似图像的差异(灰度图转成伪彩色图识别)
- MATLAB几种 彩色图像to灰度图像 的方法
- Colorization, Gray, Color-to-Gray, Color Models
- Colorization, Gray, Color-to-Gray, Color Models
- 使用Ceph作为OpenStack的后端存储
- operator =注意事项
- 【快速幂】HDU4506小明系列故事——师兄帮帮忙
- 第一次写博客
- Flatten Nested List Iterator leetcode 341
- Matab 灰度图 生成 伪彩色 图像 gray convert to pseudo color
- 我的第一篇博客:Ubuntu之路(一)
- 【计算机组成原理】主板与总线
- GitBook安装与使用
- python调试
- 1.8.6
- 链表非降序列插入元素
- 天才在左疯子在右
- c语言中memset()的用法