当前位置:网站首页>vc hacon 聯合編程 GenImage3Extern WriteImage
vc hacon 聯合編程 GenImage3Extern WriteImage
2022-06-12 19:06:00 【weixin_39926429】
//在以前的文章中描述了聯合編程讀圖,詳見vc halcon 聯合編程的配置 ReadImage demo_weixin_39926429的博客-CSDN博客
//本文描述生成圖片和保存圖片到硬盤。
void NewImage(HObject* pHobj)
{
unsigned char* image_red;
unsigned char* image_green;
unsigned char* image_blue;
int r, c;
image_red = (unsigned char*)malloc(640 * 480);
image_green =( unsigned char*) malloc(640 * 480);
image_blue = (unsigned char*)malloc(640 * 480);
for (r = 0; r < 480; r++)
for (c = 0; c < 640; c++)
{
image_red[r * 640 + c] = c % 255;
image_green[r * 640 + c] = (c + 64) % 255;
image_blue[r * 640 + c] = (c + 128) % 255;
}
//halcon 函數生成圖片
GenImage3Extern(pHobj, "byte", 640, 480, (Hlong)image_red, \
(Hlong)image_green, (Hlong)image_blue, (Hlong)free);
}
main()
{ HObject Image;
NewImage(&Image);
WriteImage(Image, "bmp", 0, "d:\\test1000.bmp");//保存圖片到硬盤
}
//保存的圖片打開後如下
边栏推荐
- 【图像去噪】基于正则化实现图像去噪附matlab代码
- Start with no place to live
- Standard library template learning introduction original
- A journey of database full SQL analysis and audit system performance optimization
- Delivery lead time lightweight estimation practice - Notes
- bilibili视频列表名字太长显示不全的解决方法
- Operational research optimization of meituan intelligent distribution system - Notes
- Experiment 10 Bezier curve generation - experiment improvement - control point generation of B-spline curve
- 美团获得小样本学习榜单FewCLUE第一!Prompt Learning+自训练实战
- leetcode:5259. Calculate the total tax payable [simple simulation + see which range]
猜你喜欢
CVPR 2022 Oral 大连理工提出SCI:快速、超强的低光照图像增强方法
Detailed explanation of yolox network structure
Redis中的事务
leetcode:5270. Minimum path cost in Grid [simple level DP]
Go package import mode member visibility
【0008】无序列表
收获满满的下午
leetcode:6094. Company name [group enumeration + cannot repeat set intersection + product Cartesian product (repeat indicates length)]
OpenGL shadow implementation (soft shadow)
A journey of database full SQL analysis and audit system performance optimization
随机推荐
数据库全量SQL分析与审计系统性能优化之旅
Leetcode 474. 一和零
Leetcode 474. One and zero
What is a network proxy
Cookie & Session & kaptcha验证码
leetcode:6096. Success logarithm of spells and potions [sort + dichotomy]
Cookie & Session & kaptcha驗證碼
Redis (XXXII) - using redis as a distributed lock
Hugo blog building tutorial
YOLOX网络结构详解
【图像去噪】基于正则化实现图像去噪附matlab代码
Transactions in redis
从应无所住说起
wireshark基本使用命令
Meituan won the first place in fewclue in the small sample learning list! Prompt learning+ self training practice
How to break the black screen after cleaning the dust and applying silicone grease on the laptop?
The solution of BiliBili video list name too long and incomplete display
OpenGL shadow implementation (hard shadow)
leetcode:6095. 强密码检验器 II【简单模拟 + 不符合直接False】
SCI Writing - Results