使用右上角的选项卡切换到不同的编程语言。

使用右上角的选项卡切换到不同的编程语言。

使用右上角的选项卡切换到不同的编程语言。

使用右上角的选项卡切换到不同的编程语言。

dev_set_shapedev_set_shapeDevSetShapeDevSetShapedev_set_shape开发设置形状(算子)

名称

dev_set_shapedev_set_shapeDevSetShapeDevSetShapedev_set_shape — 定义区域输出形状。

签名

dev_set_shape( : : Shape : )

Herror dev_set_shape(const char* Shape)

Herror T_dev_set_shape(const Htuple Shape)

void DevSetShape(const HTuple& Shape)

static void HWindow::DevSetShape(const HString& Shape)

static void HWindow::DevSetShape(const char* Shape)

static void HWindow::DevSetShape(const wchar_t* Shape)   ( Windows only)

static void HOperatorSet.DevSetShape(HTuple shape)

static void HWindow.DevSetShape(string shape)

def dev_set_shape(shape: str) -> None

描述

dev_set_shapedev_set_shapeDevSetShapeDevSetShapeDevSetShapedev_set_shape 用于定义显示区域所使用的形状。可通过 query_shapequery_shapeQueryShapeQueryShapeQueryShapequery_shape 查询可用的形状。

支持以下形状:

'original'"original""original""original""original""original"

形状显示保持不变。不过,可以通过 dev_set_line_widthdev_set_line_widthDevSetLineWidthDevSetLineWidthDevSetLineWidthdev_set_line_width 等参数进行修改。这一点也适用于所有其他模式。

'outer_circle'"outer_circle""outer_circle""outer_circle""outer_circle""outer_circle"

每个区域由其外围的最小圆表示。(参见 smallest_circlesmallest_circleSmallestCircleSmallestCircleSmallestCirclesmallest_circle。)

'inner_circle'"inner_circle""inner_circle""inner_circle""inner_circle""inner_circle"

每个区域由其包含的最大圆表示。(参见 inner_circleinner_circleInnerCircleInnerCircleInnerCircleinner_circle。)

'ellipse'"ellipse""ellipse""ellipse""ellipse""ellipse"

每个区域由一个具有相同矩和方向的椭圆表示。(参见 elliptic_axiselliptic_axisEllipticAxisEllipticAxisEllipticAxiselliptic_axis。)

'rectangle1'"rectangle1""rectangle1""rectangle1""rectangle1""rectangle1"

每个区域由与坐标轴平行的最小包围矩形显示。(参见 smallest_rectangle1smallest_rectangle1SmallestRectangle1SmallestRectangle1SmallestRectangle1smallest_rectangle1。)

'rectangle2'"rectangle2""rectangle2""rectangle2""rectangle2""rectangle2"

每个区域由最小包围矩形显示。(参见 smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2。)

'convex'"convex""convex""convex""convex""convex"

每个区域通过其凸包显示(参见 shape_transshape_transShapeTransShapeTransShapeTransshape_trans。)

'icon'"icon""icon""icon""icon""icon"

每个区域通过在质心处使用 set_iconset_iconSetIconSetIconSetIconset_icon 设置的图标显示。

更多信息请参阅算子 set_shapeset_shapeSetShapeSetShapeSetShapeset_shape 的说明。不过,与该算子不同的是,所选形状也会应用于之后打开的所有新图形窗口。

注意

使用 HDevelop 的代码导出功能时,为该算子生成的代码的行为可能与相关的 HALCON 算子有所不同。有关 HDevelop 图形算子导出到不同编程语言的详细说明,请参阅 “HDevelop 用户指南” 中的 代码导出 -> 代码生成的通用方面 -> 图形窗口 一章。

参数

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

区域输出模式。

默认值: 'original' "original" "original" "original" "original" "original"

值列表: 'convex'"convex""convex""convex""convex""convex", 'ellipse'"ellipse""ellipse""ellipse""ellipse""ellipse", 'icon'"icon""icon""icon""icon""icon", 'inner_circle'"inner_circle""inner_circle""inner_circle""inner_circle""inner_circle", 'original'"original""original""original""original""original", 'outer_circle'"outer_circle""outer_circle""outer_circle""outer_circle""outer_circle", 'rectangle1'"rectangle1""rectangle1""rectangle1""rectangle1""rectangle1", 'rectangle2'"rectangle2""rectangle2""rectangle2""rectangle2""rectangle2"

示例(HDevelop)

read_image(Image,'monkey')
threshold(Image,Region,128,255)
connection(Region,Regions)
dev_set_shape('rectangle1')
dev_set_draw('margin')
dev_set_line_width(5)
dev_clear_window()
dev_display(Regions)

结果

如果指定参数的值正确,dev_set_shapedev_set_shapeDevSetShapeDevSetShapeDevSetShapedev_set_shape 返回 2 (H_MSG_TRUE)。否则,将抛出一个异常并返回错误代码。

可能的后继

dev_displaydev_displayDevDisplayDevDisplayDevDisplaydev_display, dev_set_colordev_set_colorDevSetColorDevSetColorDevSetColordev_set_color

另见

set_shapeset_shapeSetShapeSetShapeSetShapeset_shape, dev_set_line_widthdev_set_line_widthDevSetLineWidthDevSetLineWidthDevSetLineWidthdev_set_line_width

模块

基础