首页 > 解决方案 > Emgu CV Ram问题

问题描述

我有大约 100 张图像,所以我开始将它们一张一张地发送到ProcessImage函数中。它一直使用如此多的 Ram,直到达到 5 GB 左右,然后我的程序崩溃如前所述:.SmoothGaussian在当前图像中执行高斯平滑并返回结果。

请注意:我开始删除部分代码,直到达到 100% 的程度,我的 Ram 问题是由突出显示的代码行引起的!我也在使用 Emgu CV 3.4.3 版

我尝试输入两者:temp.Dispose();temp=null();在声明后但没有工作!

using Emgu.CV;
using Emgu.CV.Structure;
using Emgu.CV.Util;

private void OpenFolder_Click(object sender, EventArgs e)
{
    OpenFileDialog open = new OpenFileDialog();
    open.Multiselect = true;
    if (open.ShowDialog() == DialogResult.OK)
    {
        for (int i = 0; i < open.FileNames.Count(); i++)
        {
            using (Image<Bgr, byte> ToProcess = new Image<Bgr,byte> (open.FileNames[i]))
            {
                ProcessImage(ToProcess, i);
            }
        }
    }
}

处理图像功能:

private void ProcessImage (Image<Bgr, byte> imgInput, int counter)
{
    //This line of code causes the problem!
    var temp = imgInput.SmoothGaussian(5);
}

标签: c#emgucv

解决方案


推荐阅读