2016-04-05 142 views
3

有没有方法将EmguCV IImage转换为EmguCV结构?将IImage转换为结构

Image<Bgr, Byte> Frame;   // current frame from camera 
Image<Bgr, Byte> Previous_Frame; // previous frame aquired 
Image<Bgr, Byte> Difference;  // difference between the two frames 

double ContourThresh = 0.003; //stores alpha for thread access 
int Threshold = 60; //stores threshold for thread access 

private void ProcessFrame(object sender, EventArgs arg) 
{ 
    if (Frame == null) 
    { 
     Frame = imageBox1.Image; //error 
     Previous_Frame = imageBox2.Image; //error 
    } 
    else 
    { 
     Frame = imageBox1.Image;//error 
     Previous_Frame = imageBox2.Image;//error 

     Difference = Previous_Frame.AbsDiff(Frame); 
     Difference = Difference.ThresholdBinary(new Bgr(Threshold, Threshold, Threshold), new Bgr(255, 255, 255)); //if value > 60 set to 255, 0 otherwise 

     Previous_Frame = imageBox2.Image; 
    } 
} 

我越来越:

错误14无法隐式转换类型Emgu.CV.IImageEmgu.CV.Image<Emgu.CV.Structure.Bgr,byte>。一个显式转换存在(是否缺少强制转换?)d:\ ECE设计项目\ aslt软件\ aslt软件\ seatplan.cs 917 25 ASLT软件

我试图得到两个图像框之间的差异, imageBox1imageBox2

  • imageBox1是由摄像机拍摄的图像的处理图像,而* imageBox2是imageBox1的图像被保存到MS Access数据库..

我试图做的是在数据库中找到与imagebox1匹配的图像..是我在这里做的正确的,或者你们比使用absdiff有更好的选择?

+0

我通过快照先生加入编译器错误,对不起,如果我做错了...... –

+0

做过先生,感谢,并为错误道歉。 :) –

+0

感谢您的编辑。, 希望有人可以帮助 –

回答

0

冲浪后的一些文章我发现自己的答案是我自己的问题。

这是我做过什么..

  Frame = new Image<Bgr, Byte>(imageBox1.Image.Bitmap); 
      Previous_Frame = new Image<Bgr, Byte>(imageBox2.Image.Bitmap);