halcon如何从内存流中读图像
展开全部
看这里有你要的信息
void NewImage(Hobject *new)
{
unsigned char *image;
int r,c;
image = malloc(640*480);
for (r=0; r<480; r++)
for (c=0; c<640; c++)
image[r*640+c] = c % 255;
gen_image1_extern(new,"byte",640,480,(long)image,(long)free);
}
gen_image3_extern
void NewImage(Hobject *new)
{
unsigned char *image_red;
unsigned char *image_green;
unsigned char *image_blue;
int r,c;
image_red = malloc(640*480);
image_green = malloc(640*480);
image_blue = 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;
}
gen_image3_extern(new,"byte",640,480,(long)image_red,(long)image_green,(long)image_blue,(long)free);
}
追问
1.Halcon打开相机没厂家的SDK稳定;2.如果采集的图像存硬盘后Halcon再从硬盘读会浪费时间;所以Halcon只能从指针和内存中读取,开发平台为C#。虽你的回答对我无助,但还是谢谢你.
追答
关键的是gen_image1_extern算子啊,不知道你用的是c#,c#不支持指针
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询