我正在做一个项目,其中一部分是使用 Emgu.cv 拼接图像;要求用户导入图像。一旦用户按下“拼接”按钮,图像必须使用图片框拼接并显示为一个图像,但不是这样,而是出现了错误:
我按照本教程尝试使用 Vb 而不是 c#:http ://www.youtube.com/watch?v=Lk37LR50viw 但该项目未构建。
按钮中的 c# 代码:
Stitcher x = new Stitcher(false);
Image<Bgr, Byte> result = x.Stitch(images);
imageBox.Image = result.ToBitmap();
虽然图像是:
Image<Bgr, Byte>[] images = new Image<Bgr, Byte>[9];
存储所有导入的图像:
private void importbuofd_FileOk(object sender, CancelEventArgs e)
{
switch (x)
{
case 1: pictureBox1.ImageLocation = importbuofd.FileName; x = x + 1; images[0] = new Image<Bgr, Byte>(new Bitmap(pictureBox1.Image)); count++; break;
case 2: pictureBox2.ImageLocation = importbuofd.FileName; x = x + 1; images[1] = new Image<Bgr, Byte>(new Bitmap(pictureBox2.Image)); count++; break;
case 3: pictureBox3.ImageLocation = importbuofd.FileName; x = x + 1; images[2] = new Image<Bgr, Byte>(new Bitmap(pictureBox3.Image)); count++; break;
case 4: pictureBox4.ImageLocation = importbuofd.FileName; x = x + 1; images[3] = new Image<Bgr, Byte>(new Bitmap(pictureBox4.Image)); count++; break;
case 5: pictureBox5.ImageLocation = importbuofd.FileName; x = x + 1; images[4] = new Image<Bgr, Byte>(new Bitmap(pictureBox5.Image)); count++; break;
case 6: pictureBox6.ImageLocation = importbuofd.FileName; x = x + 1; images[5] = new Image<Bgr, Byte>(new Bitmap(pictureBox6.Image)); count++; break;
case 7: pictureBox7.ImageLocation = importbuofd.FileName; x = x + 1; images[6] = new Image<Bgr, Byte>(new Bitmap(pictureBox7.Image)); count++; break;
case 8:pictureBox8.ImageLocation = importbuofd.FileName; x = x + 1; images[7] = new Image<Bgr, Byte>(new Bitmap(pictureBox8.Image)); count++; break;
case 9: pictureBox9.ImageLocation = importbuofd.FileName; x = x + 1; images[8] = new Image<Bgr, Byte>(new Bitmap(pictureBox9.Image)); count++; break;
default: MessageBox.Show("Sorry, This is the maximum number You can import"); break;
}
}
我该怎么办?!