Halcon 里Hobject 转HImage

c#
HobjectToRGBHimage 
//声明参数 
public HImage image; 
public HObject hobject; 
//初始化参数 
 image = new HImage(); 
HOperatorSet.GenEmptyObj(out hobject); 


//获得Hobject对象 
hobject.Dispose(); 
HOperatorSet.DumpWindowImage(out hobject, hWindowControl1.HalconWindow); 


//将Hobject对象转换为Himage对象 
HobjectToHimage(hobject,ref image); 


//函数原型 
private void HobjectToHimage(HObject hobject, ref HImage image) 
{ 
            HTuple pointer, type, width, height; 
            HOperatorSet.GetImagePointer1(hobject, out pointer, out type, out width, out height); 
            image.GenImage1(type, width, height, pointer); 
} 

        //新增的另一个转换彩色图像的方法 
private void HobjectToRGBHimage(HObject hobject, ref HImage image) 
 { 
            HTuple pointerRed, pointerGreen, pointerBlue, type,width,height; 
            HOperatorSet.GetImagePointer3(hobject, out pointerRed, out  pointerGreen, out  pointerBlue, out  type, out  width, out  height); 
            image.GenImage3(type, width, height, pointerRed, pointerGreen, pointerBlue); 
}

 

你可能感兴趣的:(C#)