将两个子图像添加到一个新图像中我有两个不同尺寸的图像,我想创建另一个包含它们的大图像垂直。使用emgu cv
private Image<Gray, Byte> newImage(Image<Gray, Byte> image1, Image<Gray, Byte> image2)
{
int ImageWidth = 0;
int ImageHeight = 0;
//get max width
if (image1.Width > image2.Width)
ImageWidth = image1.Width;
else
ImageWidth = image2.Width;
//calculate new height
ImageHeight = image1.Height + image2.Height;
//declare new image (large image).
Image<Gray, Byte> imageResult = new Image<Gray, Byte>(ImageWidth, ImageHeight);
imageResult.ROI = new Rectangle(0, 0, image1.Width, image1.Height);
image1.CopyTo(imageResult);
imageResult.ROI = new Rectangle(0, image1.Height, image2.Width, image2.Height);
image2.CopyTo(imageResult);
return imageResult;
}
返回的图像是一个黑色的图像,不包含这两个图像,请帮助我哪里的问题?
谢谢。
什么问题? – GPPK
我解决了这个问题,正确的方法是把我的答案放在这里或删除我的问题帖子或什么? – Abdo
将其发布为答案 – GPPK