使用OpenCVSharp时遇到问题-VS2010-最新的OpenCV 3.2.1 64位 [英] Having trouble with OpenCVSharp - VS2010 - Latest OpenCV 3.2.1 64-bit

查看:307
本文介绍了使用OpenCVSharp时遇到问题-VS2010-最新的OpenCV 3.2.1 64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台Windows 7 Intel i7笔记本电脑(东芝Qosmio).我为
下载了OpenCV Windows和Windows的OpenCVSharp.我尝试运行简单的示例-with
没有成功.

编译良好-在调试模式下执行时出现以下错误:

使用(CvCapture cap = CvCapture.FromCamera(0))
未处理TypeInitializationException
"OpenCvSharp.CvInvoke"阈值和异常的类型初始化器.




我尝试了很多事情-没运气.我尝试将OpenCV .dll复制到
调试目录-找不到正确的DLL-它们全都导致
与"opencv_core230.dll".我不认为OpenCvSharp希望它们命名为
这样.

希望得到您的帮助.

谢谢,
艺术

I have a Windows 7 Intel i7 laptop (Toshiba Qosmio). I downloaded OpenCV for
Windows and OpenCVSharp for Windows. I tried to run the simple example - with
no success.

Compiles fine - I get the following error when executed in debug mode:

using (CvCapture cap = CvCapture.FromCamera(0))
TypeInitializationException was unhandled
The type initializer for ''OpenCvSharp.CvInvoke'' thres and exception.




I tried lots of things - no luck. I tried copying OpenCV .dll''s into
the Debug directory - cannot find the right DLL''s - they all lead
with "opencv_core230.dll". I do not think OpenCvSharp wants them named
this way.

I would appreciate help.

Thanks,
Art

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Runtime.InteropServices;
using OpenCvSharp;

using System.Threading;
using System.Reflection;
using System.Runtime.CompilerServices;
//using System.Diagnostics;

namespace OpenCvSharp_Proj_1
{
    public partial class OpenCvSharp_Proj_1 : Form
    {
        public OpenCvSharp_Proj_1()
        {
            InitializeComponent();

            using (CvCapture cap = CvCapture.FromCamera(0))
            using (CvWindow w = new CvWindow("OpenCV Example"))
            {
                while (CvWindow.WaitKey(10) < 0)
                {
                    using (IplImage src = cap.QueryFrame())
                    using (IplImage gray = new IplImage(src.Size, BitDepth.U8, 1))
                    using (IplImage dstCanny = new IplImage(src.Size, BitDepth.U8, 1))
                    {
                        src.CvtColor(gray, ColorConversion.BgrToGray);
                        Cv.Canny(gray, dstCanny, 50, 50, ApertureSize.Size3);
                        w.Image = dstCanny;
                    }
                }
            }
        }
    }
}

推荐答案

Try to add References:
   - OpenCVSharp
   - OpenCVSharp.Blob
   - OpenCVSharp.Extensions
   - OpenCVSharp.MachineLearning
   - OpenCVSharp.UserInterface


这篇关于使用OpenCVSharp时遇到问题-VS2010-最新的OpenCV 3.2.1 64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆