1
我打算轉換多光譜圖像爲rgb基於圖像 - (RGB values of visible spectrum)如何在R語言中將光譜圖像元素轉換爲RGB?
基本上,我通過「readPNG」功能R.讀取PNG光譜圖像
所以,我有2點512×512的尺寸矩陣。然後根據上面的鏈接我寫函數返回值R,G,B。
現在,我的問題是如何將這個RGB應用到我的圖像轉換爲rgb?
我的代碼一些部分:
img <-readPNG("sample_img.png") # 512 X 512 Matrix
# after calculate R,G,B
r = 1
g = 0.892
b = 0
el1 <- img * r
el2 <- img * g
el3 <- img * b
col <- as.matrix(el1, el2, el3)
plot (1:512 , type="n")
rasterImage(col, 1, 1, 512, 512)
我做這樣的代碼之上,並且仍無法轉換爲獲得彩色圖像。
(更多有關的光譜信息:multispectral)