Halcon:在Halcon窗口缩放图片时部分object消失?

1. 背景

  在对某一芯片图片进行检测时,需要显示许多object,部分代码大致如下所示。程序运行时,Halcon窗口可以正常显示所有的object,但当使用鼠标缩放图片详细查看每个object时,发现只能显示49个新的object,之前的object都会消失。

for Index := 1 to 50 by 1
	dev_display (Rectangle1)
	dev_display (Rectangle2)
	dev_display (Rectangle3)
	dev_display (Rectangle4)
	dev_display (Rectangle5)

2. 尝试

  详细查看halcon文档,发现可能是set_system的原因,故尝试在程序第一行添加set_system ('graphic_stack_size', 0),但并没有任何效果,原因不明。

set_system (Operator)
‘graphic_stack_size’:
Once a drawing object or an image is attached to a HALCON window with attach_drawing_object_to_window or attach_background_to_window, all displayed objects are internally stored in a stack. The size of this stack is limited per default. As soon as the number of displayed objects reaches the limit, the oldest entries in the stack are removed and substituted by the new objects. One can change this behavior by setting this limit to a bigger number or to zero. In the latter case the stack is unlimited, i.e., it will store as many objects as necessary. Calling clear_window empties the stack. Setting the limit only applies to windows opened after calling set_system, i.e., it does not apply to already opened windows.
Value: Size of the graphic stack
Default: 50

机器翻译如下:
‘graphic_stack_size’:
一旦使用attach_drawing_object_to_window或 attach_background_to_window将图形对象或图像附加到HALCON窗口后 ,所有显示的对象都将内部存储在堆栈中。默认情况下,此堆栈的大小受到限制。一旦显示的对象数达到限制,堆栈中最旧的条目将被删除,并由新对象代替。可以通过将此限制设置为更大的数字或设置为零来更改此行为。在后一种情况下,堆栈是无限的,即它将存储所需数量的对象。调用 clear_window将清空堆栈。设置限制仅适用于在调用set_system之后打开的窗口,即不适用于已打开的窗口。
值:图形堆栈的大小
默认值:50

3. 解决方法

  既然是因为显示object数量过多,故尝试将object连接后再集中显示,发现确实可行。大致代码修改如下所示。

gen_empty_obj (Rectangle)
for Index := 1 to 50 by 1
	concat_obj (Rectangle, Rectangle1, Rectangle)
	concat_obj (Rectangle, Rectangle2, Rectangle)
	concat_obj (Rectangle, Rectangle3, Rectangle)
	concat_obj (Rectangle, Rectangle4, Rectangle)
	concat_obj (Rectangle, Rectangle5, Rectangle)
dev_display (Rectangle)
  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值