有没有办法将EmguCV IImage转换为EmguCV结构?
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.IImage
隐式转换为Emgu.CV.Image<Emgu.CV.Structure.Bgr,byte>
。存在显式转换(您是否缺少演员?)d:\ ece design project \ aslt software \ aslt software \ seatplan.cs 917 25 ASLT Software
我正在尝试区分两个图像框imageBox1
和imageBox2
。
imageBox1
是由相机捕获的图像处理过的图像,而* imageBox2
是来自imageBox1的图像,保存到ms访问数据库。我要做的是在数据库中找到与imagebox1匹配的图像..这是我在这里做的正确还是你们有比使用absdiff更好的选择?
答案 0 :(得分:0)
这就是我所做的..
Frame = new Image<Bgr, Byte>(imageBox1.Image.Bitmap);
Previous_Frame = new Image<Bgr, Byte>(imageBox2.Image.Bitmap);