Fill intensity grayscale with a colour channel
2 次查看(过去 30 天)
显示 更早的评论
I have read most of the posted questions but could not find a suitable solution for my problem. I have a grayscale image (uint16) that I would like to convert to RGB. I know that this is only possible with a pseudocolour map. Therefore, I created a colourmap with:
colourArray = 0:255;
colourArray = colourMap';
colourMap = [AcolourArray zeros(size(AcolourArray,1),2)];
Then I converted the image from uint16 to uint8 and convert the grayscale to a pseudo RGB:
rgbImage = cat(3, image, image, image)
What I want is to colorise the grayscale image in blue (smooth gradient) based on their intensities.
Due to the problem, that Matlab can not import .lsm files in colour I thought about this way to at least imitate the colour channel. Here is an example image how matlab shows it after import and how I would like to have it:
(Please ignore that the position I took the screenshot varies)
0 个评论
采纳的回答
Guillaume
2017-3-31
Converting the grey image to pure blue with the same intensity is actually very easy, just use that image as the blue colour plane, and put 0 everywhere in the red and green planes:
rgbimage = cat(3, zeros(size(greyimage)), zeros(size(greyimage)), greyimage);
Converting the grey image to a colour that is not one of the primary is a bit more difficult. The easiest way is to do the conversion in the HSV colour space first. The grey image becomes the luminance (value), and you fix the hue plane to whatever constant you want. Then convert the HSV image to RGB:
hue = 29/256; %for example, some sort of orange. Has to be double
hsvimage = cat(3, repmat(hue, size(greyimage)), ones(size(greyimage)), im2double(greyimage));
rgbimage = hsv2rgb(hsvimage);
2 个评论
Image Analyst
2017-4-29
See this paper for a variety of ways to composite (overlay) more than three images into one color image: http://my.ece.msstate.edu/faculty/du/JSTARS-VIS.pdf
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modify Image Colors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!