halcon学习-vector_to_rigid/similarity/创建灰度渐变/创建及加入队列,例程

1.vector_to_rigid 从点对应近似刚性仿射变换。
vector_to_similarity 从点对应近似一个相似变换。

2.principal_comp(MultichannelImage ,PCAImage ,InfoPerComp)
算子principal_comp使用主成分分析将一个(多通道)图像MultichannelImage 转换为包含相同数量通道的输出图像PCAImage。参数InfoPerComp包含每个输出通道的相关信息内容。

3.水平对齐图像中心的建筑,并从图像中裁剪出来。

read_image (Image, 'mreut')
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_translate (HomMat2DIdentity, -110, -190, HomMat2DTranslate)
hom_mat2d_rotate (HomMat2DTranslate, rad(-10), 0, 0, HomMat2DRotate)
affine_trans_image_size (Image, ImageAffineTrans, HomMat2DRotate, 'constant', 80, 80)* Align the building in the center of the image horizontally and crop it out of the image.
read_image (Image, 'mreut')
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_translate (HomMat2DIdentity, -110, -190, HomMat2DTranslate)
hom_mat2d_rotate (HomMat2DTranslate, rad(-10), 0, 0, HomMat2DRotate)
affine_trans_image_size (Image, ImageAffineTrans, HomMat2DRotate, 'constant', 80, 80)

4.gen_image_gray_ramp 创建一个灰度值渐变。

5.create_message_queue 准备队列来存储获取的图像
create_message
enqueue_message 将一个或多个消息排队到消息队列。
clear_message
get_message_queue_param 查询消息队列参数或有关队列的信息。
dequeue_message 从消息队列接收一条或多条消息。
clear_message_queue

例程:(message_queue_as_container.hdev)

create_message_queue (Queue)
* 
dev_close_window ()
dev_open_window (0, 0, 640, 480, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
* 
*获取图像并将其推入消息队列,以便稍后处理。
*注意:这种方法可能是内存密集型的,这取决于存储在队列中的数据量。
disp_message (WindowHandle, 'Acquire images and push them to the message queue\nfor later processing', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* 
create_message (MessageOut)
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, 'default', 'xing', 'default', -1, -1, AcqHandle)
for Index := 0 to 100 by 1
    grab_image (AcquiredImage, AcqHandle)
    * Overwrite the old key content
    set_message_obj (AcquiredImage, MessageOut, 'image')
    set_message_tuple (MessageOut, 'id', Index)
    * Note that other information about the image could be appended to the message as well.
    enqueue_message (Queue, MessageOut, [], [])
endfor
close_framegrabber (AcqHandle)
clear_message (MessageOut)
* 
* When finished with the acquisition, process all the data from the queue. In this example processing means simply to display the images...完成获取后,处理队列中的所有数据。在这个例子中,处理意味着简单地显示图像…
dev_clear_window ()
disp_message (WindowHandle, 'Get and display all the data from the message queue', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
while (1)
    get_message_queue_param (Queue, 'is_empty', QueueIsEmpty)
    if (QueueIsEmpty)
        break
    endif
    dequeue_message (Queue, 'timeout', 'infinite', MessageIn)
    get_message_obj (ReceivedImage, MessageIn, 'image')
    get_message_tuple (MessageIn, 'id', ImageId)
    clear_message (MessageIn)
    dev_display (ReceivedImage)
    disp_message (WindowHandle, 'Image Id: ' + ImageId, 'window', 10, 10, 'black', 'true')
    wait_seconds (0.05)
endwhile
* 
clear_message_queue (Queue)
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值