16位灰度图像热图 [英] 16bit greyscale image to heatmap
问题描述
我工作的科学成像软件为我的大学,我遇到的一大难题。在我的实验室科学相机(远地点阿尔塔U57)提供图像作为16bpp的阵列 - 它的每个像素值0-65535!我们要保持这个范围,但实际上我们不能监视(0-255灰度范围)上显示。于是,我找到了一种方法来解决这个问题 - 简单地利用色彩,作为一个热图显示整幅图像(从黑色,蓝色,绿色及红色,纯白色)。
I'm working on a scientific imaging software for my university, and I've encountered a major problem. Scientific camera (Apogee Alta U57) at my lab provides images as 16bpp array - it's 0-65535 values per pixel! We want to keep this range, but in fact we can't display them on monitor (0-255 grayscale range). So I found a way to resolve this problem - simply to make use of colors, and to display whole image as a heatmap (from black, blue, through green and red, to pure white).
我的意思是这样的 - 例如热图图像我想实现
I mean something like this - Example heatmap image I want to achieve
我唯一的问题是:如何高效的转换像素值的数组16bpp的完成在C#中的热图位图?是否有这样做的库?如果没有,我怎么实现,使用.NET资源?
My only question is: How to efficiently convert 16bpp array of pixel values to complete heatmap bitmap in c#? Are there any libraries for doing that? If not, how do I achieve that using .NET resources?
我的想法是创建函数,65536值映射到(255 R,255G,255B),但它是一个艰巨的任务 - 尤其是没有使用HSV模型
My idea was to create function that maps 65536 values into (255 R, 255G, 255B), but it's a tough job - especially without using HSV model.
我将非常感激所提供的任何帮助!
I would be much obliged for any help provided!
推荐答案
您的问题包括几部分组成:
Your question consist of several parts:
- 阅读中的16位像素数据值
- 将其映射至24位的RGB颜色
- 写出来,以一个图像文件
我将跳过部分之一,三年给你第2部分的一些想法。
I'll skip part one and three and give you a few ideas about part 2.
事实上,这是难度比它似乎。独特的映射不会丢失任何信息很简单,其实微不足道,只是一点点转移就行了。
It is in fact harder than it seems. A unique mapping that doesn't lose any information is simple, in fact trivial, just a little bit shifting will do.
但你也想要的结果直观地工作,这意味着没有那么多也是应该的视觉吸引力,但应该是有意义的一个人的眼睛。所以我们需要有一个可信又足够大的渐变映射。
But you also want the result to work visually, meaning not so much is should be visually appealing but should make sense to a human eye. so we need a mapping that has a credible yet large enough gradient.
有关这个你应该尝试一点点。我建议尽量使用一个LinearGradientBrush的,如我的此处。看一看在 interpolateColors
的功能!它仅使用6种颜色的例子中,方式少为你的情况!
For this you should experiment a little. I suggest to make use of the LinearGradientBrush, as I show here. Have a look at the interpolateColors
function! It uses only 6 colors in the example, way to few for your case!
您应该选择更多;你可能需要经过色彩空间螺旋..
You should pick many more; you may need to go through the color space in a spiral..
你的诀窍是选择既漂亮,足以停止色彩营造一个64K的大集独特的颜色,从青色最好去红..
The trick for you will be to choose both nice and enough stop colors to create a 64k large set of unique colors, best going from blueish to reddish..
您将需要测试的唯一的结果;其实你可能希望创建一对字典和词典的映射。
You will need to test the result for uniqueness; in fact you may want to create a pair of Dictionary and Dictionary for the mappings..
这篇关于16位灰度图像热图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!