lut_transT_lut_transLutTransLutTranslut_trans (算子)

名称

lut_transT_lut_transLutTransLutTranslut_trans — 使用灰度值查找表变换图像。

签名

lut_trans(Image : ImageResult : Lut : )

Herror T_lut_trans(const Hobject Image, Hobject* ImageResult, const Htuple Lut)

void LutTrans(const HObject& Image, HObject* ImageResult, const HTuple& Lut)

HImage HImage::LutTrans(const HTuple& Lut) const

static void HOperatorSet.LutTrans(HObject image, out HObject imageResult, HTuple lut)

HImage HImage.LutTrans(HTuple lut)

def lut_trans(image: HObject, lut: Sequence[int]) -> HObject

描述

lut_translut_transLutTransLutTransLutTranslut_trans transforms an image ImageImageImageImageimageimage by using a gray value look-up-table LutLutLutLutlutlut. This table acts as a transformation function. In the case of byte-images, LutLutLutLutlutlut has to be a tuple of length 256. In the case of int2-images, LutLutLutLutlutlut has to be a tuple of length 256 <= length <= 65536. If the length of the LutLutLutLutlutlut is <= 32768, the transformation is applied to the positive gray values only, i.e., the first element of the LutLutLutLutlutlut specifies the new gray value for the gray value 0. If the LutLutLutLutlutlut is longer than 32768, exactly 65536 must be passed. In this case, the positive and negative gray values are transformed. In this case, the first element indicates the new gray value for the gray value -32768 of the input image, while the last element of the tuple indicates the new gray value for the gray value 32767. In all cases, the gray values of values outside the range of LutLutLutLutlutlut are set to 0. In the case of uint2-images, LutLutLutLutlutlut has to be a tuple of length 256 <= length <= 65536. Gray values outside the range of LutLutLutLutlutlut are set to 0.

注意

lut_translut_transLutTransLutTransLutTranslut_trans 可在 OpenCL 设备上执行。

执行信息

参数

ImageImageImageImageimageimage (输入对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte* / int2* / uint2*) *允许用于计算设备

Image whose gray values are to be transformed.

ImageResultImageResultImageResultImageResultimageResultimage_result (输出对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject * (byte / int2 / uint2)

转换后的图像。

LutLutLutLutlutlut (输入控制)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Table containing the transformation.

示例(HDevelop)

* Apply a gamma correction to an image.
Gamma := 2.2
GammaLUT := []
for G := 0 to 255 by 1
    GammaLUT := [GammaLUT,round(255.0*pow(G/255.0,1.0/Gamma))]
endfor
read_image (Image, 'mreut')
lut_trans (Image, ImageGamma, GammaLUT)

结果

算子 lut_translut_transLutTransLutTransLutTranslut_trans 在参数正确时返回值 2 ( H_MSG_TRUE )。否则将抛出异常。

模块

基础