LEADTOOLS Support
General
LEADTOOLS SDK Examples
How To: Mimic Photoshop's "black body" colorization function
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Tuesday, June 16, 2009 10:16:05 AM(UTC)
Groups: Registered
Posts: 2
Photoshop has a color pallet function that will take a grayscale image and map the pixel values to a color pallet consisting of black, red, and yellow. Essentially blacks stay black, but as the pixel values get "brighter" they turn into red and finally yellow/almost-white. Here is an example of it being used:
http://www.moesrealm.com/photoshop/flaming.html.I am building an image processing application for x-ray images and our customer has required us to include this feature. Starting with a grayscale RasterImage, can someone please suggest the process by which I could reproduce this effect in Leadtools?
#2
Posted
:
Wednesday, June 17, 2009 6:20:52 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
If the image is 8 bits per pixel or less, you can directly manipulate the palette entries to convert the gray shades to color.
For example, the following code converts gray shades to red shades:
===============================================
if (rasterImageViewer1.Image.BitsPerPixel > 8)
{
MessageBox.Show("Palettes only exist in 8-bit or less images");
return;
}
Leadtools.RasterColor[] p = rasterImageViewer1.Image.GetPalette();
for (int i = 0; i < p.Length; ++i)
if (i < 128)
p[i] = new RasterColor(i * 2, 0, 0);
else
p[i] = new RasterColor(255, (i - 128) * 2, (i - 128) * 2);
rasterImageViewer1.Image.SetPalette(p, 0, p.Length);
===============================================
You can choose a range of the palette to modify, and you can also use a different algorithm to do the mapping.
For other types of gray images (extended grayscale such as 12-bit and 16-bit), there is no palette, but there is a similar concept called lookup table and Window Leveling.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#3
Posted
:
Thursday, September 30, 2010 10:32:14 PM(UTC)
Groups: Registered
Posts: 53
Hi Badwan
Can i get the range of other peletts like
1. blackbody(given by you)
2. Cardiac
3. Fiveramp
4. Flow
5. Fusion16
6. GE_Color
7. GrayRain
8. Hotiron
9. NIH
10. Spectrum
11. Slope.
Waiting for your reply.
#4
Posted
:
Saturday, October 2, 2010 11:13:08 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
You should be able to implement any algorithm you want for changing the palette entries. However, since I don't have the details of these algorithms, I'm afraid it will be up to you to do the implementation details for these algorithms.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
LEADTOOLS Support
General
LEADTOOLS SDK Examples
How To: Mimic Photoshop's "black body" colorization function
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.