paint_regionpaint_regionPaintRegionPaintRegionpaint_region (算子名称)
名称
paint_regionpaint_regionPaintRegionPaintRegionpaint_region — Paint regions into an image.
参数签名
void PaintRegion(const HObject& 区域, const HObject& Image, HObject* ImageResult, const HTuple& Grayval, const HTuple& Type)
HImage HImage::PaintRegion(const HRegion& 区域, const HTuple& Grayval, const HString& Type) const
HImage HImage::PaintRegion(const HRegion& 区域, double Grayval, const HString& Type) const
HImage HImage::PaintRegion(const HRegion& 区域, double Grayval, const char* Type) const
HImage HImage::PaintRegion(const HRegion& 区域, double Grayval, const wchar_t* Type) const
(
Windows only)
HImage HRegion::PaintRegion(const HImage& Image, const HTuple& Grayval, const HString& Type) const
HImage HRegion::PaintRegion(const HImage& Image, double Grayval, const HString& Type) const
HImage HRegion::PaintRegion(const HImage& Image, double Grayval, const char* Type) const
HImage HRegion::PaintRegion(const HImage& Image, double Grayval, const wchar_t* Type) const
(
Windows only)
static void HOperatorSet.PaintRegion(HObject 区域, HObject image, out HObject imageResult, HTuple grayval, HTuple type)
HImage HImage.PaintRegion(HRegion 区域, HTuple grayval, string type)
HImage HImage.PaintRegion(HRegion 区域, double grayval, string type)
HImage HRegion.PaintRegion(HImage image, HTuple grayval, string type)
HImage HRegion.PaintRegion(HImage image, double grayval, string type)
def paint_region(区域: HObject, image: HObject, grayval: MaybeSequence[Union[int, float]], type: str) -> HObject
描述
paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region paints the regions given in 区域区域区域区域区域区域 with a
constant gray value into the image given in ImageImageImageImageimageimage and returns the
result in ImageResultImageResultImageResultImageResultimageResultimage_result. 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").
As an alternative to paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region, you can use 该算子
overpaint_regionoverpaint_regionOverpaintRegionOverpaintRegionOverpaintRegionoverpaint_region, which directly paints the regions into
ImageImageImageImageimageimage.
运行信息
- 多线程类型:可重入(与非独占操作符并行运行)。
- 多线程作用域:全局(可以从任何线程调用)。
- 未经并行化处理。
参数表
区域区域区域区域区域区域 (input_object) region(-array) → objectHRegionHObjectHRegionHobject
Regions to be painted into the input image.
ImageImageImageImageimageimage (input_object) (multichannel-)image → objectHImageHObjectHImageHobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex)
Image in which the regions are to be painted.
ImageResultImageResultImageResultImageResultimageResultimage_result (output_object) image → objectHImageHObjectHImageHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex)
Image containing the result.
GrayvalGrayvalGrayvalGrayvalgrayvalgrayval (input_control) number(-array) → HTupleMaybeSequence[Union[int, float]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Desired gray values of the regions.
Default:
255.0
Suggested values:
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 (input_control) string → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Paint regions filled or as boundaries.
Default:
'fill'
"fill"
"fill"
"fill"
"fill"
"fill"
List of values:
'fill'"fill""fill""fill""fill""fill", 'margin'"margin""margin""margin""margin""margin"
例程 (HDevelop)
* Paint a rectangle into the image 'monkey'
read_image(Image,'monkey')
gen_rectangle1(Rectangle,100.0,100.0,300.0,300.0)
* paint a white rectangle
paint_region(Rectangle,Image,ImageResult,255.0,'fill')
例程 (C)
/* Paint a rectangle into the image 'monkey' */
read_image(&Image,"monkey");
gen_rectangle1(&Rectangle,100.0,100.0,300.0,300.0);
/* paint a white rectangle */
paint_region(Rectangle,Image,&ImageResult,255.0,"fill");
例程 (HDevelop)
* Paint a rectangle into the image 'monkey'
read_image(Image,'monkey')
gen_rectangle1(Rectangle,100.0,100.0,300.0,300.0)
* paint a white rectangle
paint_region(Rectangle,Image,ImageResult,255.0,'fill')
例程 (HDevelop)
* Paint a rectangle into the image 'monkey'
read_image(Image,'monkey')
gen_rectangle1(Rectangle,100.0,100.0,300.0,300.0)
* paint a white rectangle
paint_region(Rectangle,Image,ImageResult,255.0,'fill')
例程 (HDevelop)
* Paint a rectangle into the image 'monkey'
read_image(Image,'monkey')
gen_rectangle1(Rectangle,100.0,100.0,300.0,300.0)
* paint a white rectangle
paint_region(Rectangle,Image,ImageResult,255.0,'fill')
结果
paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region 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>:)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,
overpaint_regionoverpaint_regionOverpaintRegionOverpaintRegionOverpaintRegionoverpaint_region,
paint_xldpaint_xldPaintXldPaintXldPaintXldpaint_xld
参考其它
reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain,
paint_graypaint_grayPaintGrayPaintGrayPaintGraypaint_gray,
overpaint_grayoverpaint_grayOverpaintGrayOverpaintGrayOverpaintGrayoverpaint_gray,
set_drawset_drawSetDrawSetDrawSetDrawset_draw,
gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const
模块
Foundation