【机器视觉】 dev_open_window算子 £神魔★判官ぃ 2022-10-07 11:00 120阅读 0赞 ## 00. 目录 ## ### 文章目录 ### * * 00. 目录 * 01. 概述 * 02. 签名 * 03. 描述 * 04. 注意 * 05. 参数 * 06. 结果 * 07. 附录 ## 01. 概述 ## dev\_open\_window - 打开一个新的图形窗口。 ## 02. 签名 ## `dev_open_window( : : Row, Column, Width, Height, Background : WindowHandle)` ## 03. 描述 ## dev\_open\_window 打开一个新的图形窗口,可用于显示图像、区域和线条等标志性对象以及执行文本输出。 此窗口自动变为活动状态,这意味着所有输出(dev\_display 和操作员结果的自动显示)都重定向到此窗口。 这由活动按钮上的发光灯显示。 标准HALCON显示,绘图,鼠标,文本输出和可视化参数算子(如disp\_image,disp\_region,draw\_circle,get\_mbutton,write\_string,set\_rgb等)需要在参数WindowHandle中返回的逻辑窗口号,它显示在图形窗口的标题栏。 Background中指定的颜色为创建的窗口背景颜色。 该参数不适用于算子open\_window。 在那里,需要通过预先调用set\_window\_attr(::‘background\_color’,Background :)可以实现相同的行为。 关闭图形窗口可以通过按下窗口框的关闭按钮或通过可视化菜单,或者通过调用dev\_close\_window。 图形窗口的原点是坐标为(0,0)的左上角。 x值(column)从左到右增加,y值(row)从上到下增加。 默认情况下,坐标系的设置方式是在不剪切图像的情况下显示图像,并完全适合图形窗口。 对于在程序重置或新程序加载之后显示的第一图像,或者如果当前图像具有与之前显示的图像不同的图像大小,根据此规则,坐标系会适应于窗口大小。 窗口的大小不会自动调整,因此,如果图像的宽高比与窗口的长宽比不同,则图像会变形以适合窗口。 这可以通过“窗口大小”菜单进行更改。 通过滚动鼠标滚轮,使用“移动”或“缩放”模式,通过“图像大小”菜单,借助“可视化参数”对话框上的“缩放”选项卡或使用操作符dev\_set\_part,可以交互式更改可见图像部分。 每个图形窗口都有一个历史记录,包含: objects 显示参数 历史记录会记录从最近的清除动作或显示全图像以来已经显示或改变了的图形。 如果窗口的重绘被触发,例如在改变窗口尺寸之后,为了重建完整的窗口内容会利用历史记录。 其他使用HALCON算子(如disp\_image或disp\_region,text(write\_string)或geometric对象(disp\_line,disp\_circle等))显示的图形输出不是历史记录的一部分,因此不能重绘。 只有使用HDevelop操作符dev\_display或HDevelop操作(如双击图标)显示的对象类image,region和XLD才是历史记录的一部分。 按清空按钮清除图形窗口的内容和窗口的历史。 这也可以通过使用算子dev\_clear\_window来实现。 这不会影响当前的显示参数。 图形窗口的大小可以通过用鼠标拖动窗口边界交互地改变。 此外,可以通过“窗口大小”菜单将窗口大小调整为图像大小(或其一部分或它的多倍)。 之后,使用与以前相同的可视部分自动重新显示窗口内容(Afterwards, the window content is redisplayed automatically using the same visible part as before.)。 图形窗口的显示参数可以通过其context menu,可视化菜单,可视化参数对话框或适当的HDevelop算子(如dev\_set\_color,dev\_set\_line\_width,dev\_set\_draw)来指定。 根据“立即应用”首选项,参数更改将应用于最后显示的对象,或者从现在开始应用于所有后续对象。 与标准的HALCON窗口算子相反,新的设置也用于所有新的图形窗口。 有关HALCON窗口的更多底层信息,请参见“HDevelop Reference Manual”以及“HDevelop用户指南”的Graphical User Interface -> Graphics Window一章。 **原文描述**: dev\_open\_window opens a new graphics window, which can be used to display iconic objects like images, regions, and lines as well as to perform textual output. This window automatically becomes active, which means that all output (dev\_display and automatic display of operator results) is redirected to this window. This is shown by the lucent lamp on the Active button. The standard HALCON display, drawing, mouse, text output, and visualization parameter operators (like disp\_image, disp\_region, draw\_circle, get\_mbutton, write\_string, set\_rgb, etc.) need the logical window number that is returned in the parameter WindowHandle and displayed in the title bar of the graphics window. The background of the created window is set to the color specified in Background. This parameter is not available for the operator open\_window. There, the same behavior can be achieved by calling set\_window\_attr(::‘background\_color’,Background:) in advance. The graphics window is closed by pressing the Close button of the window frame, via the Visualization menu, or by calling dev\_close\_window. The origin of the graphics window is the upper left corner with the coordinates (0,0). The x values (columns) increase from left to right, the y values (rows) increase from top to bottom. As a default, the coordinate system is set in a way that images are displayed without clipping and fitting completely into the graphics window. The coordinate system is adapted to the windows size according to this rule for the first image that is displayed after a program reset or the loading of a new program or if the current image has a different image size than the image that was displayed before. The size of the window is not adapted automatically, hence, if the aspect ratio of the image differs from that of the window, the image is distorted to fit into the window. This can be changed via the Window Size menu. The visible image part can be changed interactively by spinning the mouse wheel, using the Move or Zoom mode, via the Image Size menu, with the help of the Zoom tab card on the Visualization Parameters dialog, or with the operator dev\_set\_part. Each graphics window manages a history which contains the objects and display parameters which have been displayed or changed since the most recent clear action or display of a full image. This history is used if a redraw of the window is triggered, e.g., after a change of the windows size, in order to reconstruct the complete window contents. Other iconic output that was displayed using HALCON operators like disp\_image or disp\_region, text (write\_string), or geometric objects (disp\_line, disp\_circle, etc.) are not part of the history, and can therefore not be redrawn. Only the object classes image, region, and XLD that are displayed with the HDevelop operator dev\_display or by HDevelop actions like double clicking on an icon are part of the history. Pressing the Clear button clears the graphics window contents and the history of the window. This can also be achieved by using the operator dev\_clear\_window. This will not effect the current display parameters. The size of the graphics window can be changed interactively by dragging the window border with the mouse. Furthermore, it is possible to adapt the window size to the image size (or a part or multiple of it) via the Window Size menu. Afterwards, the window content is redisplayed automatically using the same visible part as before. The display parameters of the graphics window can be specified via its context menu, the Visualization menu, the Visualization Parameters dialog, or the appropriate HDevelop operators like dev\_set\_color, dev\_set\_line\_width, dev\_set\_draw. Depending on the Apply Immediately preference, the parameter changes are applied to the lastly displayed object or apply from now on for all following objects. In contrast to the standard HALCON window operators, the new settings are also used for all new graphics windows. Additional information about the underlying HALCON window can be found at open\_window and about the HDevelop graphics window in the “HDevelop Reference Manual” chapter Graphical User Interface -> Graphics Window as well as in the “HDevelop User’s Guide”. ## 04. 注意 ## 使用HDevelop的代码导出功能,为该算子生成的代码可能与相关的HALCON算子具有不同的行为。 有关将HDevelop图形算子导出为不同编程语言的代码的详细说明,请参阅“HDevelop User’s Guide”中的 Code Export -> General Aspects of Code Generation -> Graphics Windows一章。 ## 05. 参数 ## **Row (input\_control) rectangle.origin.y → (integer)** Row index of upper left corner. Default value: 0 Typical range of values: 0 ≤ Row Minimum increment: 1 Recommended increment: 1 Restriction: Row >= 0 **Column (input\_control) rectangle.origin.x → (integer)** Column index of upper left corner. Default value: 0 Typical range of values: 0 ≤ Column Minimum increment: 1 Recommended increment: 1 Restriction: Column >= 0 **Width (input\_control) rectangle.extent.x → (integer)** Width of the window. Default value: 256 Typical range of values: 0 ≤ Width Minimum increment: 1 Recommended increment: 1 Restriction: (Width > 0) || (Width == -1) **Height (input\_control) rectangle.extent.y → (integer)** Height of the window. Default value: 256 Typical range of values: 0 ≤ Height Minimum increment: 1 Recommended increment: 1 Restriction: (Height > 0) || (Height == -1) **Background (input\_control) integer → (integer / string)** Color of the background of the new window. Default value: ‘black’ **WindowHandle (output\_control) window → (integer)** Window identifier. **HDevelop例程** > stamp\_catalogue.hdev Segment and group characters on a cluttered page > measure\_screw.hdev Measure several features of a screw > fit\_ellipse\_tooth\_rim\_xld.hdev Approximate the contour of a tooth rim with an ellipse to find its center > find\_pads.hdev Find pads on a die > display\_operators.hdev Visualize results > dev\_open\_window.hdev Open graphics windows in HDevelop > dev\_close\_window.hdev Close graphics windows in HDevelop > critical\_points\_sub\_pix.hdev Detect critical points with subpixel accuracy > clip\_contours\_xld.hdev Clip an XLD contour > advanced\_visualization\_settings.hdev Improve the visualization with transparency, anti-aliasing, and more **程序示例** dev_close_window () read_image (For5, 'for5') get_image_size (For5, Width, Height) dev_open_window (0, 0, Width, Height, 'black', WindowHandle) dev_display (For5) dev_set_lut ('rainbow') dev_display (For5) stop () dev_set_lut ('default') dev_display (For5) stop () dev_set_part (100, 100, 300, 300) dev_display (For5) ## 06. 结果 ## 如果指定参数的值正确,则dev\_open\_window返回2(H\_MSG\_TRUE)。 否则会引发异常并返回错误代码。 ## 07. 附录 ## **7.1 机器视觉博客汇总** 网址:[https://dengjin.blog.csdn.net/article/details/116837497][https_dengjin.blog.csdn.net_article_details_116837497] [https_dengjin.blog.csdn.net_article_details_116837497]: https://dengjin.blog.csdn.net/article/details/116837497
相关 【机器视觉】 switch算子 00. 目录 文章目录 00. 目录 01. 概述 02. 签名 03. 描述 04. 注意 £神魔★判官ぃ/ 2022年10月07日 06:59/ 0 赞/ 234 阅读
相关 【机器视觉】 endswitch算子 00. 目录 文章目录 00. 目录 01. 概述 02. 签名 03. 描述 04. 注意 Love The Way You Lie/ 2022年10月07日 06:46/ 0 赞/ 192 阅读
相关 【机器视觉】 endif算子 00. 目录 文章目录 00. 目录 01. 概述 02. 签名 03. 描述 04. 注意 Myth丶恋晨/ 2022年10月07日 06:00/ 0 赞/ 192 阅读
相关 【机器视觉】 elseif算子 00. 目录 文章目录 00. 目录 01. 概述 02. 签名 03. 描述 04. 注意 野性酷女/ 2022年10月07日 06:00/ 0 赞/ 191 阅读
相关 【机器视觉】 default算子 00. 目录 文章目录 00. 目录 01. 概述 02. 签名 03. 描述 04. 注意 素颜马尾好姑娘i/ 2022年10月07日 05:59/ 0 赞/ 195 阅读
相关 【机器视觉】 stop算子 00. 目录 文章目录 00. 目录 01. 概述 02. 签名 03. 描述 04. 注意 妖狐艹你老母/ 2022年10月07日 05:53/ 0 赞/ 181 阅读
相关 【机器视觉】 global算子 00. 目录 文章目录 00. 目录 01. 概述 02. 签名 03. 描述 04. 注意 妖狐艹你老母/ 2022年10月07日 05:51/ 0 赞/ 213 阅读
相关 【机器视觉】 exit算子 00. 目录 文章目录 00. 目录 01. 概述 02. 签名 03. 描述 04. 注意 太过爱你忘了你带给我的痛/ 2022年10月07日 04:52/ 0 赞/ 203 阅读
还没有评论,来说两句吧...