Skip to content

set_grayvalSetGrayvalSetGrayvalset_grayvalset_grayval🔗

Short description🔗

set_grayvalSetGrayvalSetGrayvalset_grayvalset_grayval — Set single gray values in an image.

Signature🔗

set_grayval( image Image, point.y Row, point.x Column, grayval Grayval )void SetGrayval( const HObject& Image, const HTuple& Row, const HTuple& Column, const HTuple& Grayval )static void HOperatorSet.SetGrayval( HObject image, HTuple row, HTuple column, HTuple grayval )def set_grayval( image: HObject, row: MaybeSequence[int], column: MaybeSequence[int], grayval: MaybeSequence[Union[int, float]] ) -> None

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 HImage::SetGrayval( const HTuple& Row, const HTuple& Column, const HTuple& Grayval ) const

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

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

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

Description🔗

set_grayvalSetGrayval sets the gray values of the input image Imageimageimage at the positions (Rowrowrow,Columncolumncolumn) to the values specified by Grayvalgrayvalgrayval. If Imageimageimage 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 Grayvalgrayvalgrayval. 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.

Attention🔗

The operator set_grayvalSetGrayval 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_pointer1GetImagePointer1 and to directly use the C or C++ interface for integrating own procedures.

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

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters🔗

Imageimageimage (input_object, state is modified) (multichannel-)image → object (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)HObject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)HImage (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)HObject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)Hobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)

Image to be modified.

Rowrowrow (input_control) point.y(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Row coordinates of the pixels to be modified.

Default: 00
Suggested values: 0, 10, 50, 127, 255, 5110, 10, 50, 127, 255, 511
Value range: 0 ≤ Row
Restriction: 0 <= Row && Row < height(Image)

Columncolumncolumn (input_control) point.x(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Column coordinates of the pixels to be modified.

Default: 00
Suggested values: 0, 10, 50, 127, 255, 5110, 10, 50, 127, 255, 511
Value range: 0 ≤ Column
Restriction: 0 <= Column && Column < width(Image)

Grayvalgrayvalgrayval (input_control) grayval(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

Gray values to be used.

Default: 255.0255.0
Suggested values: 0.0, 1.0, 10.0, 128.0, 255.00.0, 1.0, 10.0, 128.0, 255.0

Result🔗

set_grayvalSetGrayval returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behavior can be set via set_system(::'no_object_result',<Result>:). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

read_imageReadImage, get_image_pointer1GetImagePointer1, gen_image_protoGenImageProto, gen_image1GenImage1

Alternatives

get_image_pointer1GetImagePointer1, paint_grayPaintGray, paint_regionPaintRegion

See also

get_grayvalGetGrayval, gen_image_constGenImageConst, gen_image1GenImage1, gen_image_protoGenImageProto

Module🔗

Foundation