引发异常:Emgu.CV.dll中的“ System.TypeInitializationException”

时间:2019-12-18 10:51:26

标签: c# .net opencv emgucv

当我尝试使用按钮打开文件时,我遇到Exception thrown: 'System.TypeInitializationException' in Emgu.CV.dll的问题。

  

抛出异常:Emgu.CV.dll中的'System.TypeInitializationException'

我遇到了这个错误

'Week_14.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Week_14.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\Plyang\source\repos\Computer Vision\Week_14\bin\Debug\Week_14.exe'. Symbols loaded.
'Week_14.exe' (CLR v4.0.30319: Week_14.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Week_14.exe' (CLR v4.0.30319: Week_14.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Week_14.exe' (CLR v4.0.30319: Week_14.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Week_14.exe' (CLR v4.0.30319: Week_14.exe): Loaded 'C:\Users\Plyang\source\repos\Computer Vision\Week_14\bin\Debug\Emgu.CV.dll'. Module was built without symbols.
'Week_14.exe' (CLR v4.0.30319: Week_14.exe): Loaded 'C:\Users\Plyang\source\repos\Computer Vision\Week_14\bin\Debug\Emgu.Util.dll'. Module was built without symbols.
'Week_14.exe' (CLR v4.0.30319: Week_14.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Week_14.exe' (CLR v4.0.30319: Week_14.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Week_14.exe' (CLR v4.0.30319: Week_14.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Week_14.exe' (CLR v4.0.30319: Week_14.exe): Loaded 'C:\Users\Plyang\source\repos\Computer Vision\Week_14\bin\Debug\Emgu.CV.UI.dll'. Module was built without symbols.
Exception thrown: 'System.TypeInitializationException' in Emgu.CV.dll
The program '[6760] Week_14.exe' has exited with code 0 (0x0).

代码:

Image<Bgr, Byte> imgSceneColor = null;
        Image<Bgr, Byte> imgToFindColor = null;
        Image<Bgr, Byte> imgCopyOfImageToFindWidthBorder = null;

        bool blnImageSceneLoaded = false;
        bool blnImageToFindLoaded = false;

        static Image<Bgr, Byte> imgResult = null;

        Bgr bgrKeyPointColor = new Bgr(Color.Blue);
        Bgr bgrMatchingLinesColor = new Bgr(Color.Green);
        Bgr bgrFoundImageColor = new Bgr(Color.Red);

        Stopwatch stopwatch = new Stopwatch();

        public Form1()
        {
            InitializeComponent();
        }

        private void buttonImageScene_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            DialogResult dialogResult = openFile.ShowDialog();
            if ((dialogResult == DialogResult.OK) || (dialogResult == DialogResult.Yes))
                textImageScene.Text = openFile.FileName;
            else
                return;
            try
            {
                imgSceneColor = new Image<Bgr, Byte>(textImageScene.Text);
                //'Image(Of Bgr, Byte) My_Image = New Image(Of Bgr, Byte)(txtImageScene.Text)
                //'imgSceneColor = imgSceneColor.ToBitmap();
            }
            catch (Exception ex)
            {
                this.Text = ex.Message;
                return;
            }
            blnImageSceneLoaded = true;
            if (blnImageToFindLoaded == false)
                imageBoxResult.Image = imgSceneColor;
            else
                imageBoxResult.Image = imgSceneColor.ConcateHorizontal(imgCopyOfImageToFindWidthBorder);
        }

有人可以帮忙吗?

0 个答案:

没有答案