將兩個子圖像添加到一個新圖像中我有兩個不同尺寸的圖像,我想創建另一個包含它們的大圖像垂直。使用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