paint_xldpaint_xldPaintXldPaintXldpaint_xld (算子)

名称

paint_xldpaint_xldPaintXldPaintXldpaint_xld — 将 XLD 对象绘制到图像中。

签名

paint_xld(XLD, Image : ImageResult : Grayval : )

Herror paint_xld(const Hobject XLD, const Hobject Image, Hobject* ImageResult, double Grayval)

Herror T_paint_xld(const Hobject XLD, const Hobject Image, Hobject* ImageResult, const Htuple Grayval)

void PaintXld(const HObject& XLD, const HObject& Image, HObject* ImageResult, const HTuple& Grayval)

HImage HImage::PaintXld(const HXLD& XLD, const HTuple& Grayval) const

HImage HImage::PaintXld(const HXLD& XLD, double Grayval) const

HImage HXLD::PaintXld(const HImage& Image, const HTuple& Grayval) const

HImage HXLD::PaintXld(const HImage& Image, double Grayval) const

static void HOperatorSet.PaintXld(HObject XLD, HObject image, out HObject imageResult, HTuple grayval)

HImage HImage.PaintXld(HXLD XLD, HTuple grayval)

HImage HImage.PaintXld(HXLD XLD, double grayval)

HImage HXLD.PaintXld(HImage image, HTuple grayval)

HImage HXLD.PaintXld(HImage image, double grayval)

def paint_xld(xld: HObject, image: HObject, grayval: MaybeSequence[Union[int, float]]) -> HObject

描述

paint_xldpaint_xldPaintXldPaintXldPaintXldpaint_xld paints the XLD objects XLDXLDXLDXLDXLDxld of type contour or polygon with the constant gray values GrayvalGrayvalGrayvalGrayvalgrayvalgrayval into each channel of the background image given in ImageImageImageImageimageimage and returns the result in ImageResultImageResultImageResultImageResultimageResultimage_result. Open contours of XLD objects are closed and their enclosed regions are filled up. The rim of the subpixel XLD objects is painted onto the background image using anti-aliasing.

Filling up XLD-objects that have crossings or segments that are very close (lying in neighboring pixels) does not work correctly and leads to artifacts. The set_systemset_systemSetSystemSetSystemSetSystemset_system parameter 'neighborhood'"neighborhood""neighborhood""neighborhood""neighborhood""neighborhood" defines whether diagonal neighbors are filled as well as orthogonal neighbors.

GrayvalGrayvalGrayvalGrayvalgrayvalgrayval contains the gray values for painting the XLD objects. These gray values can either be specified for each channel once, valid for all XLD objects, or for each XLD object separately. To define the latter, group the channel gray values g of each XLD object and concatenate them to a tuple according to the order of the XLD objects, e.g., for a three channel image:

[g(channel1,xld1), g(channel2,xld1), g(channel3,xld1), g(channel1,xld2), ... ]. 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.

执行信息

参数

XLDXLDXLDXLDXLDxld (输入对象)  xld(-array) objectHXLDHObjectHXLDHobject

XLD objects to be painted into the input image.

ImageImageImageImageimageimage (输入对象)  (multichannel-)image objectHImageHObjectHImageHobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real / complex)

Image in which the xld objects are to be painted.

ImageResultImageResultImageResultImageResultimageResultimage_result (输出对象)  image objectHImageHObjectHImageHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real / complex)

Image containing the result.

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

Desired gray value of the xld object.

默认值: 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

示例(HDevelop)

* Paint colored xld objects into a gray image

* read and copy image to generate a three channel image
read_image(Image1,'green-dot')
copy_image(Image1,Image2)
copy_image(Image1,Image3)
compose3(Image1,Image2,Image3,Image)
* extract subpixel border
threshold_sub_pix(Image1,Border,128)
* select the circle and the arrows
select_obj(Border,circle,14)
select_obj(Border,arrows,16)
concat_obj(circle,arrows,green_dot)
* paint a green circle and white arrows (to paint all
* objects e.g., blue, pass [0,0,255] tuple for GrayVal)
paint_xld(green_dot,Image,ImageResult,[0,255,0,255,255,255])

示例(C)

/* Paint colored xld objects into a gray image */

/* read and copy image to generate a three channel image */
read_image(&Image1,"green-dot");
copy_image(Image1,&Image2);
copy_image(Image1,&Image3);
compose3(Image1,Image2,Image3,&Image);
/* extract subpixel border */
threshold_sub_pix(Image1,&Border,128);
/* select the circle and the arrows */
select_obj(Border,&circle,14);
select_obj(Border,&arrows,16);
concat_obj(circle,arrows,&green_dot);
/* paint a green circle and white arrows,
 * therefore define tuple grayval:=[0,255,0,255,255,255].
 * (to paint all objects e.g., blue define grayval:=[0,0,255]) */
T_paint_xld(green_dot,Image,&ImageResult,grayval);

示例(HDevelop)

* Paint colored xld objects into a gray image

* read and copy image to generate a three channel image
read_image(Image1,'green-dot')
copy_image(Image1,Image2)
copy_image(Image1,Image3)
compose3(Image1,Image2,Image3,Image)
* extract subpixel border
threshold_sub_pix(Image1,Border,128)
* select the circle and the arrows
select_obj(Border,circle,14)
select_obj(Border,arrows,16)
concat_obj(circle,arrows,green_dot)
* paint a green circle and white arrows (to paint all
* objects e.g., blue, pass [0,0,255] tuple for GrayVal)
paint_xld(green_dot,Image,ImageResult,[0,255,0,255,255,255])

示例(HDevelop)

* Paint colored xld objects into a gray image

* read and copy image to generate a three channel image
read_image(Image1,'green-dot')
copy_image(Image1,Image2)
copy_image(Image1,Image3)
compose3(Image1,Image2,Image3,Image)
* extract subpixel border
threshold_sub_pix(Image1,Border,128)
* select the circle and the arrows
select_obj(Border,circle,14)
select_obj(Border,arrows,16)
concat_obj(circle,arrows,green_dot)
* paint a green circle and white arrows (to paint all
* objects e.g., blue, pass [0,0,255] tuple for GrayVal)
paint_xld(green_dot,Image,ImageResult,[0,255,0,255,255,255])

示例(HDevelop)

* Paint colored xld objects into a gray image

* read and copy image to generate a three channel image
read_image(Image1,'green-dot')
copy_image(Image1,Image2)
copy_image(Image1,Image3)
compose3(Image1,Image2,Image3,Image)
* extract subpixel border
threshold_sub_pix(Image1,Border,128)
* select the circle and the arrows
select_obj(Border,circle,14)
select_obj(Border,arrows,16)
concat_obj(circle,arrows,green_dot)
* paint a green circle and white arrows (to paint all
* objects e.g., blue, pass [0,0,255] tuple for GrayVal)
paint_xld(green_dot,Image,ImageResult,[0,255,0,255,255,255])

结果

paint_xldpaint_xldPaintXldPaintXldPaintXldpaint_xld 在所有参数正确时返回 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, gen_contour_polygon_xldgen_contour_polygon_xldGenContourPolygonXldGenContourPolygonXldGenContourPolygonXldgen_contour_polygon_xld, threshold_sub_pixthreshold_sub_pixThresholdSubPixThresholdSubPixThresholdSubPixthreshold_sub_pix

替代

set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval, paint_graypaint_grayPaintGrayPaintGrayPaintGraypaint_gray, paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region

另见

gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const

模块

基础