//实例化输入图像1,2 格式为CogImage8Grey
CogImage8Grey Image1 = (CogImage8Grey) mToolBlock.Inputs["Image1"].Value;
CogImage8Grey Image2 = (CogImage8Grey) mToolBlock.Inputs["Image2"].Value;
//声明一个整数变量取两个图像最大的高度赋值给 heing
int maxheing = Image1.Height > Image2.Height ? Image1.Height : Image2.Height;
//实例化一个画布 (宽度,高度)画布的名字叫OUTBitmap
Bitmap OUTBitmap = new Bitmap(Image1.Width + Image2.Width, maxheing);
//实例化一个画布名字叫c
Graphics g = Graphics.FromImage(OUTBitmap);
//转换两个图像类型为Bitmap 名字叫ImageBitmapl
Bitmap ImageBitmapl = Image1.ToBitmap();
Bitmap ImageBitmap2 = Image2.ToBitmap();
//将名字叫ImageBitmapl的图像放在g上
g.DrawImage(ImageBitmapl, 0, 0, Image1.Width, Image1.Height);
g.DrawImage(ImageBitmap2, Image1.Width, 0, Image2.Width, Image2.Height);
// 受保护的Dispose方法,用于清理资源
ImageBitmapl.Dispose();
ImageBitmap2.Dispose();
//实例化CogImage8Grey OUTBitmap的图像转换回CogImage8Grey类型
CogImage8Grey OutputImage = new CogImage8Grey (OUTBitmap);
/将拼接好并且转换好的OutputImage输出给 CogToolBlock1的输出 OutputImage
mToolBlock.Outputs["OutputImage"].Value = OutputImage;/
要拼接图像格式CogImage8Grey
否则