overpaint_regionoverpaint_regionOverpaintRegionOverpaintRegionoverpaint_region (算子)

名称

overpaint_regionoverpaint_regionOverpaintRegionOverpaintRegionoverpaint_region — 在图像中覆盖区域。

签名

overpaint_region(Image, Region : : Grayval, Type : )

Herror overpaint_region(const Hobject Image, const Hobject Region, double Grayval, const char* Type)

Herror T_overpaint_region(const Hobject Image, const Hobject Region, const Htuple Grayval, const Htuple Type)

void OverpaintRegion(const HObject& Image, const HObject& Region, const HTuple& Grayval, const HTuple& Type)

void HImage::OverpaintRegion(const HRegion& Region, const HTuple& Grayval, const HString& Type) const

void HImage::OverpaintRegion(const HRegion& Region, double Grayval, const HString& Type) const

void HImage::OverpaintRegion(const HRegion& Region, double Grayval, const char* Type) const

void HImage::OverpaintRegion(const HRegion& Region, double Grayval, const wchar_t* Type) const   ( Windows only)

void HRegion::OverpaintRegion(const HImage& Image, const HTuple& Grayval, const HString& Type) const

void HRegion::OverpaintRegion(const HImage& Image, double Grayval, const HString& Type) const

void HRegion::OverpaintRegion(const HImage& Image, double Grayval, const char* Type) const

void HRegion::OverpaintRegion(const HImage& Image, double Grayval, const wchar_t* Type) const   ( Windows only)

static void HOperatorSet.OverpaintRegion(HObject image, HObject region, HTuple grayval, HTuple type)

void HImage.OverpaintRegion(HRegion region, HTuple grayval, string type)

void HImage.OverpaintRegion(HRegion region, double grayval, string type)

void HRegion.OverpaintRegion(HImage image, HTuple grayval, string type)

void HRegion.OverpaintRegion(HImage image, double grayval, string type)

def overpaint_region(image: HObject, region: HObject, grayval: MaybeSequence[Union[int, float]], type: str) -> None

描述

overpaint_regionoverpaint_regionOverpaintRegionOverpaintRegionOverpaintRegionoverpaint_region paints the regions given in RegionRegionRegionRegionregionregion with a constant gray value into the image given in ImageImageImageImageimageimage. These gray values can either be specified for each channel once, valid for all regions, or for each region separately. To define the latter, group the channel gray values g of each region and concatenate them to a tuple according to the regions' order, e.g., for a three channel image: [g(channel1,region1), g(channel2,region1), g(channel3,region1), g(channel1,region2), ... ]. If the input 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. The parameter TypeTypeTypeTypetypetype determines whether the region should be painted filled ('fill'"fill""fill""fill""fill""fill") or whether only its boundary should be painted ('margin'"margin""margin""margin""margin""margin").

If you do not want to modify ImageImageImageImageimageimage itself, you can use the operator paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region, which returns the result in a newly created image.

注意

overpaint_regionoverpaint_regionOverpaintRegionOverpaintRegionOverpaintRegionoverpaint_region 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 (or vice versa), overpaint_regionoverpaint_regionOverpaintRegionOverpaintRegionOverpaintRegionoverpaint_region will also modify the image matrix of this other image object. Therefore, overpaint_regionoverpaint_regionOverpaintRegionOverpaintRegionOverpaintRegionoverpaint_region should only be used to overpaint newly created image objects. Typical operators for this task are, e.g., gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const (creates a new image with a specified size), gen_image_protogen_image_protoGenImageProtoGenImageProtoGenImageProtogen_image_proto (creates an image with the size of a specified prototype image) or copy_imagecopy_imageCopyImageCopyImageCopyImagecopy_image (creates an image as the copy of a specified image).

执行信息

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

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

参数

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

Image in which the regions are to be painted.

RegionRegionRegionRegionregionregion (输入对象)  region(-array) objectHRegionHObjectHRegionHobject

Regions to be painted into the input image.

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

Desired gray values of the regions.

默认值: 255.0

建议值: 0.0, 1.0, 2.0, 5.0, 10.0, 16.0, 32.0, 64.0, 128.0, 253.0, 254.0, 255.0

TypeTypeTypeTypetypetype (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Paint regions filled or as boundaries.

默认值: 'fill' "fill" "fill" "fill" "fill" "fill"

值列表: 'fill'"fill""fill""fill""fill""fill", 'margin'"margin""margin""margin""margin""margin"

示例(HDevelop)

* Paint a rectangle into a new image (New1)

gen_rectangle1(Rectangle,100.0,100.0,300.0,300.0)
* generate a black image
gen_image_const(New1,'byte', 768, 576)
* paint a white rectangle
overpaint_region(New1,Rectangle,255.0,'fill')

示例(C)

/* Paint a rectangle into a new image (New1) */

gen_rectangle1(&Rectangle,100.0,100.0,300.0,300.0);
/* generate a black image */
gen_image_const(&New1,"byte", 768, 576)
/* paint a white rectangle */
overpaint_region(New1,Rectangle,255.0,"fill");

示例(HDevelop)

* Paint a rectangle into a new image (New1)

gen_rectangle1(Rectangle,100.0,100.0,300.0,300.0)
* generate a black image
gen_image_const(New1,'byte', 768, 576)
* paint a white rectangle
overpaint_region(New1,Rectangle,255.0,'fill')

示例(HDevelop)

* Paint a rectangle into a new image (New1)

gen_rectangle1(Rectangle,100.0,100.0,300.0,300.0)
* generate a black image
gen_image_const(New1,'byte', 768, 576)
* paint a white rectangle
overpaint_region(New1,Rectangle,255.0,'fill')

示例(HDevelop)

* Paint a rectangle into a new image (New1)

gen_rectangle1(Rectangle,100.0,100.0,300.0,300.0)
* generate a black image
gen_image_const(New1,'byte', 768, 576)
* paint a white rectangle
overpaint_region(New1,Rectangle,255.0,'fill')

结果

overpaint_regionoverpaint_regionOverpaintRegionOverpaintRegionOverpaintRegionoverpaint_region 在所有参数正确时返回 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, gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const, gen_image_protogen_image_protoGenImageProtoGenImageProtoGenImageProtogen_image_proto, reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain

替代

set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval, paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region, paint_xldpaint_xldPaintXldPaintXldPaintXldpaint_xld

另见

reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain, set_drawset_drawSetDrawSetDrawSetDrawset_draw, paint_graypaint_grayPaintGrayPaintGrayPaintGraypaint_gray, overpaint_grayoverpaint_grayOverpaintGrayOverpaintGrayOverpaintGrayoverpaint_gray, gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const

模块

基础