测试了下它们彩色图像转灰色图像的速度 彩色图像大小1426*890
private void button1_Click(object sender, EventArgs e)
{
Mat gray=new Mat();
st = new Stopwatch();
st.Start();
CvInvoke.CvtColor(mypic1, gray, Emgu.CV.CvEnum.ColorConversion.Bgr2Gray);
st.Stop();
imageBox1.Image = gray;
textBox1.Text = st.ElapsedMilliseconds.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
st2 = new Stopwatch();
st2.Start();
ApplyFilter(Grayscale.CommonAlgorithms.BT709);
st2.Stop();
pictureBox1.Image = gray2;
textBox2.Text = st2.ElapsedMilliseconds.ToString();
}
private void ApplyFilter(IFilter fiter)
{
gray2 = fiter.Apply(mypic2);
}
首次运行
后面几次运行
打开其他图片,运行测试
private void button3_Click(object sender, EventArgs e)
{
OpenFileDialog op = new OpenFileDialog();
if (op.ShowDialog() == DialogResult.OK)
{
mypic1 = new Mat(op.FileName, Emgu.CV.CvEnum.ImreadModes.Color);
mypic2 = (Bitmap)Bitmap.FromFile(op.FileName);
imageBox1.Image = mypic1;
pictureBox1.Image = mypic2;
}
}
首次打开程序,用emgu处理图像,速度不理想,而后面不管再次处理此图,或处理新图片。速度一般比Aforge快4-5倍。
Aforge速度每次都差不多。