2016-04-05 28 views
1

我想知道如何(在代碼中)使用顏色查找表(LUT)將多個灰度圖像合併爲單個16位RGB彩色圖像。將灰度通道合併爲彩色合成

在ImageJ中,人們可以拍攝7個不同的16位灰度圖像,並將它們的值合併爲一個彩色複合圖像。

ImageJ Merge Channels

這是平凡的,你必須<= 3圖像的情況下,與輸入圖像的顏色信道所期望的映射是唯一的。也就是說,如果我有三個16位灰度圖像,並且我希望圖像1爲紅色,2爲藍色,3爲綠色,那麼我只需將相應的輸出圖像像素設置爲RGB(input1, input2, input3)即可。

然而,在使用ImageJ有合併多於三個顏色通道的選項,包括本身是R,G的組合的顏色,或B.這是可能選擇具有以下期望otuput顏色5個灰度圖像:

Input image: desired color in output image 
== 
input 1: Red 
input 2: Green 
input 3: Blue 
input 4: Magenta // Combination of R + B 
input 5: Cyan // Combination of R + G 

假設中的LUT映射輸入(灰度)輸出(RGB)是:

Red:  input -> (input, 0,  0 ) 
Green: input -> (0,  input, 0 ) 
Blue: input -> (0,  0,  input) 
Magenta: input -> (input, 0,  input) 
Cyan: input -> (input, input, 0 ) 

在輸出圖像時,應通過簡單地平均超過有助於彩色通道的所有輸入圖像創建複合?還是有更復雜的方法?我天真的做法將是:

Output pixel = R: (input1+input4+input5)/3 
       G: (input2+input5)/2 
       B: (input3+input4)/2 

我不知道正確的算法是用於混合顏色作爲ImageJ。事實上,代碼在這裏,但對我來說是難以逾越的:https://github.com/imagej/ImageJA/blob/3ed2e1a1d785eda3c9dfdb330030aee968c242b8/src/main/java/ij/plugin/RGBStackMerge.java

在此先感謝您的任何指點!

回答

0

我找到答案了 - 它變成了ImageJ使用簡單的顏色通道添加(使用鉗位),而不是將它們平均。平均來自輸入的R,G,B值會產生無趣的值,而求和和鉗位會產生明亮的值,這正是我所尋找的。

看到這個職位的更多信息:Algorithm for Additive Color Mixing for RGB Values