halcon xld/region转换成HImage

halcon xld/region转换成HImage

方法1:

*Halcon感兴趣区域填充特定颜色
color24 := [255,0,0]
color8 := 255
gen_region_contour_xld (UnionContoursCircles, Region1, 'filled')
region_to_bin(Region, Binary, 0, 255, Width, Height)
overpaint_region (Binary, Region1, color8, 'fill')
write_image (Binary, 'bmp', 0, 'E:/Org.bmp')

方法2:

*创建空白图像,将得到的区域贴到上面
get_image_size (ImageReduced, Width1, Height1)
gen_image_proto (ImageReduced, ImageCleared, 128)
paint_region (Region, ImageCleared, ImageResult1, 255, 'fill')

方法3:xld->region->image

*无效set_system ('init_new_image', 'false')
gen_region_contour_xld (ObjectSelected, Region, 'filled')
gen_image_const (NewImage, 'byte', Width, Height)
*Create an image with a specified constant gray value
gen_image_proto (NewImage, ImageCleared1, 255)
*Paint regions into an image
paint_region (Region, ImageCleared1, ImageResult, 0, 'fill')

write_image (ImageResult, 'jpeg', 0, 'D:/1111.jpg')

*Overpaint regions in an image
gen_image_proto (NewImage, ImageCleared2, 255)
overpaint_region(ImageCleared2, Region, 0, 'fill')

注:paint_region 和overpaint_region最终的输出结果是一样的
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值