//Halcon图像转VP图像*******************
HTuple type, width, height, pointer;
HalconDotNet.HOperatorSet.ReadImage(out ho_Image, OpenImageDialog.FileName);
HalconDotNet.HOperatorSet.GetImagePointer1(ho_Image, out pointer, out type, out width, out height); //拿H图像的指针
CogImage8Root tmpCogImage8Root = new CogImage8Root();
tmpCogImage8Root.Initialize(width, height, (IntPtr)pointer, width, null);
CogImage8Grey outVproImage = new CogImage8Grey();
outVproImage.SetRoot(tmpCogImage8Root);
DisplayVP_Scource.Image = outVproImage; //显示转换后的图像到CogDisplay
//VP图像转Halcon图像****************************
pointer=outVproImage.Get8GreyPixelMemory(CogImageDataModeConstants.Read, 0, 0, outVproImage.Width, outVproImage.Height).Scan0; //拿VP图像的指针
HalconDotNet.HOperatorSet.GenImage1(out ho_Image2, "byte", outVproImage.Width, outVproImage.Height, pointer); //创建H图像
hwindow = HWindowControl1.HalconWindow;
HTuple hv_Width = new HTuple();
HTuple hv_Height = new HTuple();
HOperatorSet.GetImageSize(ho_Image2, out hv_Width, out hv_Height);
HOperatorSet.SetPart(hwindow, 0, 0, hv_Height, hv_Width);
HOperatorSet.DispObj(ho_Image2, hwindow); //显示转换后的图像到HWindowControl
//**************************************************************