基于halcon的凹痕检测

举报
川川菜鸟 发表于 2022/04/14 02:03:42 2022/04/14
【摘要】 测试图 代码 * This procedure displays text in a graphics window. * * Input parameters: * WindowHandle:...

测试图

在这里插入图片描述

代码

* This procedure displays text in a graphics window.
* 
* Input parameters:
* WindowHandle: The WindowHandle of the graphics window, where
*    the message should be displayed
* String: A tuple of strings containing the text message to be displayed
* CoordSystem: 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.)
* Row: The row coordinate of the desired text position
*    A tuple of values is allowed to display text at different
*    positions.
* Column: The column coordinate of the desired text position
*    A tuple of values is allowed to display text at different
*    positions.
* Color: defines the color of the text as string.
*    If set to [], '' or 'auto' the currently set color is used.
*    If a tuple of strings is passed, the colors are used cyclically...
*    - if |Row| == |Column| == 1: for each new textline
*    = else for each text position.
* Box: If Box[0] is set to 'true', the text is written within an orange box.
*      If set to' false', no box is displayed.
*      If set to a color string (e.g. 'white', '#FF00CC', etc.),
*        the text is written in a box of that color.
*      An optional second value for Box (Box[1]) controls if a shadow is displayed:
*        'true' -> display a shadow in a default color
*        'false' -> display no shadow
*        otherwise -> use given string as color string for the shadow color
* 
* It is possible to display multiple text strings in a single call.
* In this case, some restrictions apply:
* - Multiple text positions can be defined by specifying a tuple
*   with multiple Row and/or Column coordinates, i.e.:
*   - |Row| == n, |Column| == n
*   - |Row| == n, |Column| == 1
*   - |Row| == 1, |Column| == n
* - If |Row| == |Column| == 1,
*   each element of String is display in a new textline.
* - If multiple positions or specified, the number of Strings
*   must match the number of positions, i.e.:
*   - Either |String| == n (each string is displayed at the
*                           corresponding position),
*   - or     |String| == 1 (The string is displayed n times).
* 
* 
* Convert the parameters for disp_text.
if (Row == [] or Column == [])
    return ()
endif
if (Row == -1)
    Row := 12
endif
if (Column == -1)
    Column := 12
endif
* 
* Convert the parameter Box to generic parameters.
GenParamName := []
GenParamValue := []
if (|Box| > 0)
    if (Box[0] == 'false')
        * Display no box
        GenParamName := [GenParamName,'box']
        GenParamValue := [GenParamValue,'false']
    elseif (Box[0] != 'true')
        * Set a color other than the default.
        GenParamName := [GenParamName,'box_color']
        GenParamValue := [GenParamValue,Box[0]]
    endif
endif
if (|Box| > 1)
    if (Box[1] == 'false')
        * Display no shadow.
        GenParamName := [GenParamName,'shadow']
        GenParamValue := [GenParamValue,'false']
    elseif (Box[1] != 'true')
        * Set a shadow color other than the default.
        GenParamName := [GenParamName,'shadow_color']
        GenParamValue := [GenParamValue,Box[1]]
    endif
endif
* Restore default CoordSystem behavior.
if (CoordSystem != 'window')
    CoordSystem := 'image'
endif
* 
if (Color == '')
    * disp_text does not accept an empty string for Color.
    Color := []
endif
* 
disp_text (WindowHandle, String, CoordSystem, Row, Column, Color, GenParamName, GenParamValue)
return ()

结果

在这里插入图片描述

文章来源: chuanchuan.blog.csdn.net,作者:川川菜鸟,版权归原作者所有,如需转载,请联系作者。

原文链接:chuanchuan.blog.csdn.net/article/details/121779246

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。