gpt4 book ai didi

c# - 将图像转换为结构

转载 作者:行者123 更新时间:2023-11-30 18:21:03 25 4
gpt4 key购买 nike

有没有办法将 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;
}
}

我得到:

Error 14 Cannot implicitly convert type Emgu.CV.IImage to Emgu.CV.Image<Emgu.CV.Structure.Bgr,byte>. An explicit conversion exists (are you missing a cast?) d:\ece design project\aslt software\aslt software\seatplan.cs 917 25 ASLT Software

我试图找出两个图像框之间的区别,imageBox1imageBox2 .

  • imageBox1是来自相机捕获的图像的处理图像,而 * imageBox2是 imageBox1 中的图像,已保存到 ms access 数据库中..

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

最佳答案

在浏览了一些文章后,我找到了自己问题的答案。

这就是我做的..

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

关于c# - 将图像转换为结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36422996/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com