halcon保存带文字的无压缩原图

* 读取图像
read_image(Image, 'C:/Users/Administrator/Desktop/1.bmp')

* 获取图像尺寸
get_image_size(Image, Width, Height)

* 创建一个空白图像作为背景
gen_image_const(TextImage, 'byte', Width, Height)

* 设置绘图参数
dev_set_color('red')
#dev_set_font('-*-arial-*-20-*')

* 创建一个用于文字显示的窗口
dev_open_window(0, 0, Width, Height, 'black', WindowID)
dev_set_window(WindowID)
dev_display(TextImage)

* 在图像上添加文字
disp_text(WindowID, 'Hello HALCON!', 'image', 100, 100, 'red', [], [])

* 获取带有文字的图像
dump_window_image(TextImageWithText, WindowID)

* 关闭窗口
dev_close_window ()

*获取原图通道
count_channels (Image, Channels)
if (Channels == 1)
    *如果原图是单通道需要转三通道
compose3 (Image, Image, Image, Image)
endif

* 将文字图像合并到原图像上
add_image(Image, TextImageWithText, ImageWithText, 1, 0)

* 保存图像为无压缩格式
write_image(ImageWithText, 'bmp', 0, 'C:/Users/Administrator/Desktop/2.bmp')


  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值