Opencv 转成Halcon格式

Hobject IplImageToHImage(IplImage *img)
{
 char messege[1024];
 Herror HalconError;
 Hobject Hobj;
 //IplImage *img = cvLoadImage("d:/04.jpg", 0); 
 HalconError=gen_image1(&Hobj,"byte",img->width,img->height,(Hlong)(img->imageData));
 if(HalconError!=H_MSG_TRUE)
 {
  get_error_text(HalconError,messege);  
  
 }
 else
 {
  HalconError=write_image(Hobj,HTuple("bmp"),HTuple(0),HTuple("d:\\bing.bmp"));
  if(HalconError!=H_MSG_TRUE)
  {
   get_error_text(HalconError,messege);
  }
 }
 cvReleaseImage(&img);
 return Hobj;

你可能感兴趣的:(halcon,opencv)