set_grayvalset_grayvalSetGrayvalSetGrayvalset_grayval (算子)

名称

set_grayvalset_grayvalSetGrayvalSetGrayvalset_grayval — 在图像中设置单个灰度值。

签名

set_grayval(Image : : Row, Column, Grayval : )

Herror set_grayval(const Hobject Image, const Hlong Row, const Hlong Column, double Grayval)

Herror T_set_grayval(const Hobject Image, const Htuple Row, const Htuple Column, const Htuple Grayval)

void SetGrayval(const HObject& Image, const HTuple& Row, const HTuple& Column, const HTuple& Grayval)

void HImage::SetGrayval(const HTuple& Row, const HTuple& Column, const HTuple& Grayval) const

void HImage::SetGrayval(Hlong Row, Hlong Column, double Grayval) const

static void HOperatorSet.SetGrayval(HObject image, HTuple row, HTuple column, HTuple grayval)

void HImage.SetGrayval(HTuple row, HTuple column, HTuple grayval)

void HImage.SetGrayval(int row, int column, double grayval)

def set_grayval(image: HObject, row: MaybeSequence[int], column: MaybeSequence[int], grayval: MaybeSequence[Union[int, float]]) -> None

描述

set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval sets the gray values of the input image ImageImageImageImageimageimage at the positions (RowRowRowRowrowrow,ColumnColumnColumnColumncolumncolumn) to the values specified by GrayvalGrayvalGrayvalGrayvalgrayvalgrayval. If ImageImageImageImageimageimage is a multi-channel image, you can either set a single gray value for a pixel and thus set it for all available channels, or you can set the gray values g for all channels individually by concatenating them within GrayvalGrayvalGrayvalGrayvalgrayvalgrayval. For example, for a three-channel image three gray values (according to the order of the channels) are specified for each pixel: [g(channel0,pixel0), g(channel1,pixel0), g(channel2,pixel0), g(channel0,pixel1), ... ]. Please note that for complex or vector field images, two gray values per pixel must be specified (per channel).

If the image is of type direction, gray values that are not in the value range that is valid for direction images are set to the value 255 to mark them as invalid.

注意

算子 set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval produces quite some overhead. Typically, it is used to set single gray values of an image. It is not suitable for programming image processing operations such as filters. In this case it is more useful to use the operator get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1get_image_pointer1 and to directly use the C or C++ interface for integrating own procedures.

Note also that set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval modifies the content of an already existing image (ImageImageImageImageimageimage). Besides, even other image objects may be affected: For example, if you created ImageImageImageImageimageimage via copy_objcopy_objCopyObjCopyObjCopyObjcopy_obj from another image object, set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval will also modify the image matrix of this other image object. Therefore, set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval should only be used to overpaint newly created image objects.

执行信息

此算子修改后续输入参数的状态:

在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。

参数

ImageImageImageImageimageimage (input_object, state is modified)  (multichannel-)image objectHImageHObjectHImageHobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)

Image to be modified.

RowRowRowRowrowrow (输入控制)  point.y(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row coordinates of the pixels to be modified.

默认值: 0

建议值: 0, 10, 50, 127, 255, 511

值范围: 0 ≤ Row Row Row Row row row

限制: 0 <= Row && Row < height(Image)

ColumnColumnColumnColumncolumncolumn (输入控制)  point.x(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column coordinates of the pixels to be modified.

默认值: 0

建议值: 0, 10, 50, 127, 255, 511

值范围: 0 ≤ Column Column Column Column column column

限制: 0 <= Column && Column < width(Image)

GrayvalGrayvalGrayvalGrayvalgrayvalgrayval (输入控制)  grayval(-array) HTupleMaybeSequence[Union[int, float]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Gray values to be used.

默认值: 255.0

建议值: 0.0, 1.0, 10.0, 128.0, 255.0

结果

set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval 在所有参数正确时返回 2 ( H_MSG_TRUE )。 如果输入为空则可设置行为通过 set_system(::'no_object_result',<Result>:)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)。如有必要,则抛出异常。

可能的前趋

read_imageread_imageReadImageReadImageReadImageread_image, get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1get_image_pointer1, gen_image_protogen_image_protoGenImageProtoGenImageProtoGenImageProtogen_image_proto, gen_image1gen_image1GenImage1GenImage1GenImage1gen_image1

替代

get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1get_image_pointer1, paint_graypaint_grayPaintGrayPaintGrayPaintGraypaint_gray, paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region

另见

get_grayvalget_grayvalGetGrayvalGetGrayvalGetGrayvalget_grayval, gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const, gen_image1gen_image1GenImage1GenImage1GenImage1gen_image1, gen_image_protogen_image_protoGenImageProtoGenImageProtoGenImageProtogen_image_proto

模块

基础