Fill intensity grayscale with a colour channel
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kamu
am 31 Mär. 2017
Kommentiert: Image Analyst
am 29 Apr. 2017
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 Kommentare
Akzeptierte Antwort
Guillaume
am 31 Mär. 2017
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 Kommentare
Image Analyst
am 29 Apr. 2017
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Modify Image Colors finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!