gamma_imageGammaImageGammaImagegamma_imagegamma_image
説明
gamma_imageGammaImageGammaImagegamma_imagegamma_image — 画像のガンマエンコーディングまたはデコーディングを実行する。
書式
gamma_image( image Image, out image GammaImage, real Gamma, real Offset, real Threshold, number MaxGray, string Encode )void GammaImage( const HObject& Image, HObject* GammaImage, const HTuple& Gamma, const HTuple& Offset, const HTuple& Threshold, const HTuple& MaxGray, const HTuple& Encode )static void HOperatorSet.GammaImage( HObject image, out HObject gammaImage, HTuple gamma, HTuple offset, HTuple threshold, HTuple maxGray, HTuple encode )def gamma_image( image: HObject, gamma: float, offset: float, threshold: float, max_gray: Union[float, int], encode: str ) -> HObject
Herror gamma_image( const Hobject Image, Hobject* GammaImage, double Gamma, double Offset, double Threshold, double MaxGray, const char* Encode )
Herror T_gamma_image( const Hobject Image, Hobject* GammaImage, const Htuple Gamma, const Htuple Offset, const Htuple Threshold, const Htuple MaxGray, const Htuple Encode )
HImage HImage::GammaImage( double Gamma, double Offset, double Threshold, const HTuple& MaxGray, const HString& Encode ) const
HImage HImage::GammaImage( double Gamma, double Offset, double Threshold, double MaxGray, const HString& Encode ) const
HImage HImage::GammaImage( double Gamma, double Offset, double Threshold, double MaxGray, const char* Encode ) const
HImage HImage::GammaImage( double Gamma, double Offset, double Threshold, double MaxGray, const wchar_t* Encode ) const (Windows only)
HImage HImage.GammaImage( double gamma, double offset, double threshold, HTuple maxGray, string encode )
HImage HImage.GammaImage( double gamma, double offset, double threshold, double maxGray, string encode )
説明
gamma_imageGammaImage は、入力画像 Imageimageimage に汎用の
ガンマエンコーディング
またはデコーディングを実行し、その結果画像を
GammaImagegammaImagegamma_image に格納します。
汎用のガンマエンコーディングは次のように記述されます。
\[\begin{eqnarray*}
G' = \left\{
\begin{array}{ll}
m \left( (1+o) (G/m)^\gamma - o \right), & t < G/m \le 1 \\
s G, & 0 \le G/m \le t
\end{array}
\right.
\end{eqnarray*}\]
ここで、\(G'\) はガンマエンコーディングされるグレイ値、\(G\) は
線形グレイ値、\(\gamma = \textrm{Gamma}\)、
\(o = \textrm{Offset}\)、\(m = \textrm{MaxGray}\)、
\(t = \textrm{Threshold}\) です。
また、\(s\) は、この変換の線形部分と指数部分が
連続するように、Gammagammagamma、Offsetoffsetoffset、
Thresholdthresholdthreshold、および MaxGraymaxGraymax_gray から計算される
係数です。
同様に、汎用のガンマデコーディングは次のように記述されます。
\[\begin{eqnarray*}
G = \left\{
\begin{array}{ll}
m \left( \frac{G'/m + o}{1+o} \right)^{1/\gamma}, & t' < G'/m \le 1 \\
G'/s, & 0 \le G'/m \le t'
\end{array}
\right.
\end{eqnarray*}\]
これらの変数の意味はガンマエンコーディングの場合と同じで、
\(t' = s t\) です。
例えば、sRGB 標準に必要なガンマエンコーディングまたはデコーディングは、
\(\textrm{Gamma} = 1.0/2.4\)、\(\textrm{Offset} = 0.055\)、および
\(\textrm{Threshold} = 0.0031308\) の設定によって得ることができます。
同様に、HDTV ビデオ標準に必要なガンマエンコーディングまたは
デコーディングは、\(\textrm{Gamma} = 0.45\)、\(\textrm{Offset} = 0.099\)、
および \(\textrm{Threshold} = 0.018\) の設定によって得ることができます。
どの場合も、Imageimageimage の画像タイプに合わせて適切に
MaxGraymaxGraymax_gray を設定する必要があります(例えば、
byte 画像の場合は 255.0)。
注意
byte、uint2、および real 型の画像の場合、gamma_imageGammaImage は
OpenCL デバイスで実行できます。演算は、CPU の場合の倍精度浮動小数点
ではなく単精度で行われるため、OpenCL 実装の結果は CPU 実装の
結果とは多少異なる可能性があります。
実行情報
実行情報
パラメーター
Imageimageimage (input_object) (multichannel-)image(-array) → object (byte* / uint2* / real*)HObject (byte* / uint2* / real*)HImage (byte* / uint2* / real*)HObject (byte* / uint2* / real*)Hobject (byte* / uint2* / real*) *計算デバイスに対して有効
入力画像
GammaImagegammaImagegamma_image (output_object) (multichannel-)image(-array) → object (byte / uint2 / real)HObject (byte / uint2 / real)HImage (byte / uint2 / real)HObject (byte / uint2 / real)Hobject * (byte / uint2 / real)
出力画像
Gammagammagamma (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)
変換の指数部分のガンマ係数
初期値: 0.4166666666670.416666666667
推奨値: 0.416666666667, 0.450.416666666667, 0.45
Offsetoffsetoffset (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)
変換の指数部分のオフセット
初期値: 0.0550.055
推奨値: 0.055, 0.0990.055, 0.099
Thresholdthresholdthreshold (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)
線形変換から指数変換に切り替える基準となるガンマ値
初期値: 0.00313080.0031308
推奨値: 0.0031308, 0.0180.0031308, 0.018
MaxGraymaxGraymax_gray (input_control) number → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)
入力画像タイプの最大グレイ値
初期値: 255.0255.0
推奨値: 1.0, 255.0, 511.0, 1023.0, 4095.0, 16383.0, 65535.01.0, 255.0, 511.0, 1023.0, 4095.0, 16383.0, 65535.0
Encodeencodeencode (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)
'true'"true" の場合は、ガンマエンコーディングを
実行します。
そうでない場合は、ガンマデコーディングを実行します
初期値: 'true'"true"
値のリスト: 'false', 'true'"false", "true"
他のオペレーターとの組み合わせ
組み合わせ
他の選択候補
pow_imagePowImage
関連項目
sqrt_imageSqrtImage, exp_imageExpImage, log_imageLogImage
参考文献
Erik Reinhard, Erum Arif Khan, Ahmet Oguz Akyüz, Garret M. Johnson:
“Color Imaging: Fundamentals and Applications.” A K Peters, Ltd.,
2008.
CEI/IEC 61966-2-1:1999: ``Colour management – Default RGB colour
space – sRGB.’‘
ITU-R BT.709-5: ``Parameter values for the HDTV standards for
production and international programme exchange.’‘
モジュール
Foundation