日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【机器视觉】 dev_disp_text算子

發布時間:2024/4/24 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【机器视觉】 dev_disp_text算子 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

00. 目錄

文章目錄

    • 00. 目錄
    • 01. 概述
    • 02. 簽名
    • 03. 描述
    • 04. 注意
    • 05. 參數
    • 06. 結果
    • 07. 附錄

01. 概述

dev_disp_text — 在當前圖形窗口中顯示文本。

02. 簽名

dev_disp_text( : : String, CoordSystem, Row, Column, Color, GenParamName, GenParamValue : )

03. 描述

dev_disp_text 在當前圖形窗口的位置 (Row,Column) 顯示文本。

如果只定義了一個位置,則為 String 的每個元素顯示一個文本行。 此外, ‘\n’ 將被解釋為換行符,即執行換行符。

如果定義了多個位置,String 中只允許單個字符串或每個位置一個字符串。 在這種情況下,必須使用 ‘\n’ 強制換行。

String 末尾的換行符 (’\n’) 將被忽略。

文本的位置可以在窗口坐標 (CoordSystem = ‘window’) 或圖像坐標 (CoordSystem = ‘image’) 中指定,這在使用縮放圖像時很有用。

除了提供 (Row,Column) 坐標外,還可以將預定義的值傳遞給 Row 和 Column 以在窗口中的固定位置顯示文本(僅當 CoordSystem = ‘window’ 時):

‘top’, ‘left’ ‘top’, ‘center’ ‘top’, ‘right’
‘center’, ‘left’ ‘center’, ‘center’ ‘center’, ‘right’
‘bottom’, ‘left’ ‘bottom’, ‘center’ ‘bottom’, ‘right’

參數 Color 也接受值的元組。 在這種情況下,如果使用單個位置,則為每個新文本位置或每個新文本行循環使用指定的顏色。

通用參數

disp_text 可以在框中顯示字符串(默認)。 此行為和框的外觀由 GenParamName 和 GenParamValue 中的通用參數定義。

'box' If 'box' is set to 'true', the text is written within a box. The look of the box and its optional shadow can be configured with the generic parameters below.possible values: 'true' and 'false'default value: 'true''box_color' Sets the color of the box.possible values: a string containing the color name (e.g. 'white', 'red', or '#aa00bba0')default value: '#fce9d4' (which is a light orange)'shadow' If 'shadow' is set to 'true', an additional shadow is displayed beneath the box (if 'box' is 'true').possible values: 'true' and 'false'default value: 'true' if 'box_color' is set to a color without alpha value, 'false' otherwise'shadow_color' Sets the color of the shadow if 'shadow' is 'true'.possible values: a string containing the color name (e.g. 'black', 'red', or '#aa00bba0')default value: '#f28d26' (which is a darker orange) if 'box_color' is not set, 'white' otherwise'border_radius' Controls the roundness of the box's corners. For sharp corners set it to 0, for smoother corners to higher values.possible values: positive real numbers or 0default value: 2'box_padding' Controls to which amount in pixels the box is extended around the text.possible values: positive real numberdefault value: 0'shadow_sigma' Controls to which amount the shadow beneath the box is blurred. Set it to 0 for a sharp shadow.possible values: positive real number or 0default value: 1.5'shadow_dx' and 'shadow_dy' Controls the offset of the shadow in column ('shadow_dx') and row ('shadow_dy') direction in pixels.possible values: any real numberdefault_value: 2

原文描述

dev_disp_text displays text in the current graphics window at the position (Row,Column).

If only a single position is defined, one text line is displayed for each element of String. Also, ‘\n’ will be interpreted as a newline character, i.e., a line break is performed.

If multiple positions are defined, only a single string or one string for each position is allowed in String. In this case, line breaks have to be forced with ‘\n’.

Newlines (’\n’) at the end of String are ignored.

The position of the text may be specified in window coordinates (CoordSystem = ‘window’) or in image coordinates (CoordSystem = ‘image’), which is useful when using zoomed images.

In addition to supplying (Row,Column) coordinates, it is also possible to pass predefined values to Row and Column to display the text at a fixed position in the window (only if CoordSystem = ‘window’).:

‘top’, ‘left’ ‘top’, ‘center’ ‘top’, ‘right’
‘center’, ‘left’ ‘center’, ‘center’ ‘center’, ‘right’
‘bottom’, ‘left’ ‘bottom’, ‘center’ ‘bottom’, ‘right’

The parameter Color also accepts tuples of values. In that case, the specified colors are used cyclically for every new text position or for every new line of text if a single position is used.

Generic Parameters

disp_text may display the String within a box (default). This behavior and the look of the box are defined with the generic parameters in GenParamName and GenParamValue.

‘box’
If ‘box’ is set to ‘true’, the text is written within a box. The look of the box and its optional shadow can be configured with the generic parameters below.

possible values: ‘true’ and ‘false’

default value: ‘true’

‘box_color’
Sets the color of the box.

possible values: a string containing the color name (e.g. ‘white’, ‘red’, or ‘#aa00bba0’)

default value: ‘#fce9d4’ (which is a light orange)

‘shadow’
If ‘shadow’ is set to ‘true’, an additional shadow is displayed beneath the box (if ‘box’ is ‘true’).

possible values: ‘true’ and ‘false’

default value: ‘true’ if ‘box_color’ is set to a color without alpha value, ‘false’ otherwise

‘shadow_color’
Sets the color of the shadow if ‘shadow’ is ‘true’.

possible values: a string containing the color name (e.g. ‘black’, ‘red’, or ‘#aa00bba0’)

default value: ‘#f28d26’ (which is a darker orange) if ‘box_color’ is not set, ‘white’ otherwise

‘border_radius’
Controls the roundness of the box’s corners. For sharp corners set it to 0, for smoother corners to higher values.

possible values: positive real numbers or 0

default value: 2

‘box_padding’
Controls to which amount in pixels the box is extended around the text.

possible values: positive real number

default value: 0

‘shadow_sigma’
Controls to which amount the shadow beneath the box is blurred. Set it to 0 for a sharp shadow.

possible values: positive real number or 0

default value: 1.5

‘shadow_dx’ and ‘shadow_dy’
Controls the offset of the shadow in column (‘shadow_dx’) and row (‘shadow_dy’) direction in pixels.

possible values: any real number

default_value: 2

04. 注意

使用HDevelop的代碼導出功能,為該算子生成的代碼可能與相關的HALCON算子具有不同的行為。 有關將HDevelop圖形算子導出為不同編程語言的代碼的詳細說明,請參閱“HDevelop User’s Guide” 中的Code Export -> General Aspects of Code Generation -> Graphics Windows一章。

05. 參數

String (input_control) string(-array) → (string)
A tuple of strings containing the text message to be displayed. Each value of the tuple will be displayed in a single line.

Default value: ‘hello’

CoordSystem (input_control) string → (string)
If set to ‘window’, the text position is given with respect to the window coordinate system. If set to ‘image’, image coordinates are used (this may be useful in zoomed images).

Default value: ‘window’
List of values: ‘image’, ‘window’

Row (input_control) point.y(-array) → (integer / real / string)
The vertical text alignment or the row coordinate of the desired text position.

Default value: 12

List of values: 12, ‘bottom’, ‘center’, ‘top’

Column (input_control) point.x(-array) → (integer / real / string)
The horizontal text alignment or the column coordinate of the desired text position.

Default value: 12

List of values: 12, ‘center’, ‘left’, ‘right’

Color (input_control) string(-array) → (string)
A tuple of strings defining the colors of the texts.

Default value: ‘black’
List of values: ‘black’, ‘blue’, ‘coral’, ‘cyan’, ‘forest green’, ‘green’, ‘lime green’, ‘magenta’, ‘red’, ‘slate blue’, ‘yellow’

GenParamName (input_control) attribute.name(-array) → (string)
Generic parameter names.

Default value: []

List of values: ‘border_radius’, ‘box’, ‘box_color’, ‘box_padding’, ‘shadow’, ‘shadow_color’, ‘shadow_dx’, ‘shadow_dy’, ‘shadow_sigma’

GenParamValue (input_control) attribute.value(-array) → (string / integer / real)
Generic parameter values.

Default value: []

List of values: 5.0, ‘black’, ‘blue’, ‘false’, ‘forest green’, ‘red’, ‘true’, ‘white’

06. 結果

如果指定參數的值正確,則 dev_disp_text 返回 2 (H_MSG_TRUE)。 否則會引發異常并返回錯誤代碼。

HDevelop例程

reconstruct_surface_stereo_pairwise_workflow.hdev Explain how to reconstruct a 3D object model with multi-view stereo using the ‘surface_pairwise’ method
reconstruct_surface_stereo_fusion_workflow.hdev Explain how to reconstruct a 3D object model with multi-view stereo using the ‘surface_fusion’ method
reconstruct_surface_stereo_fusion.hdev Reconstruct a 3D object model with multi-view stereo using the ‘surface_fusion’ method
dev_disp_text.hdev Explain the usage of dev_disp_text and its generic parameters
advanced_visualization_settings.hdev Improve the visualization with transparency, anti-aliasing, and more

程序示例

dev_open_window (0, 0, 512, 512, 'black', WindowHandle) dev_disp_text ('Display some text in a box', 'window', 12, 12, \'black', [], [])

07. 附錄

7.1 機器視覺博客匯總
網址:https://dengjin.blog.csdn.net/article/details/116837497

總結

以上是生活随笔為你收集整理的【机器视觉】 dev_disp_text算子的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。