16 位 TIFF 圖像導入JMP 希望能夠加載灰度超過 256 級的灰度數據。 我建議在嘗試之前使用 Python 可能是一種合理的方法。 我用 Gimp 創建的第一個測試文件在 Python 中產生了一條奇怪的錯誤消息,我追踪到它的意思是“Python 無法導入 16 位灰度數據,除非沒有其他通道(如 alpha 通道,或其他層)。” Gimp 中的默認設置有一個 alpha 通道,並且在沒有它的情況下重新導出會生成 Python 可以加載的 16 位灰度文件。 以下是 8 位 PNG 屏幕截圖。 第一張圖片是 Gimp 的一點熔岩,它被保存為 16 位灰度。
The delta noise image is multiplied by 30 to make the noise visible. It is nearly uniform gray on my display at < 10X. The truncation error is about 1/255 of the gray scale range.The delta noise image is multiplied by 30 to make the noise visible. It is nearly uniform gray on my display at < 10X. The truncation error is about 1/255 of the gray scale range.The delta noise image is multiplied by 30 to make the noise visible. It is nearly uniform gray on my display at < 10X. The truncation error is about 1/255 of the gray scale range.The delta noise image is multiplied by 30 to make the noise visible. It is nearly uniform gray on my display at < 10X. The truncation error is about 1/255 of the gray scale range.The delta noise image is multiplied by 30 to make the noise visible. It is nearly uniform gray on my display at < 10X. The truncation error is about 1/255 of the gray scale range.增量噪聲圖像乘以 30 使噪聲可見。 在 < 10X 時,它在我的顯示器上幾乎是均勻的灰色。 截斷誤差約為灰度範圍的 1/255。
兩張橙色圖片看起來一模一樣。 底部圖像上光譜顏色的轉換是使用 16 位數據完成的,因此可能存在一些差異。 微弱紋理的藍色/灰色/紅色圖像代表了製作兩個橙色圖像的數據之間的差異。 如果您的相機實際上可以產生 10 位或 12 位甚至 14 位數據,那麼額外的精度可能很重要。 或者,動態範圍可能很重要。
Python Init();
path = Convert File Path(
Save Text File( "$temp/deleteme.tiff", // the 2channel file will fail - see link in message
Load Text File( "16bitgray1channel.tif", blob() ) // pic is part of the project, move to $temp
),
"windows"
);
// first import it using built-in image that truncates the bit depth
truncated = Color To RGB( New Image( path ) << getpixels )[1]; // use the red channel
// stretch truncated image bit depth 0 to 1
r = Range( truncated );//[0.00784 0.803]
min = r[1];
max = r[2];
truncated = (truncated - min) / (max - min); // 0 to 1
timage = New Image( Heat Color( 1 - truncated, "spectral" ) );
// now import with Python PIL to preserve the 16-bit depth
rc = Python Execute( {path}, {im}, "\[
import numpy as np
import PIL
from PIL import Image
try:
im = np.array(Image.open(path))
except Exception as e:
print("make sure there is only one channel (no alpha for example) see https://github.com/python-pillow/Pillow/issues/1888",e)
]\" );
If( rc, Throw( "python code failed" ) );
// stretch full image bit depth 0 to 1
r = Range( im ); //[530 52698]
min = r[1];
max = r[2];
full = (im - min) / (max - min);
fimage = New Image( Heat Color( 1 - full, "spectral" ) );
// diff and magnify the difference
magnify = 30;
delta = (full - truncated) * magnify; // small negative and positive diffs, scaled up to be visible
delta = delta + .5; // center
dimage = New Image( Heat Color( delta ) );
New Window( "compare", Lineup Box( N Col( 2 ),
textbox("original\!ngray\!nscale"),New Image( path ),
Text Box( "truncated\!nheatcolor\!nspectral" ), timage,
Text Box( evalinsert("delta\!ntimes ^magnify^\!nblue\!nto gray\!nto red\!n\!nfullres -\!ntruncated") ),
dimage, Text Box( "full res\!nheatcolor\!nspectral" ), fimage, ) );
項目文件 (JMP 16) 附有兩個 TIF;一個失敗是因為額外的 alpha 數據通道。 刪除 JMP 16 的 .zip,或者如果您使用的是舊版 JMP,則使用您的壓縮工具。
謝謝@RJ_Bailey !