简体   繁体   English

使用Emgucv时C#GTK 2和3发生冲突

[英]c# GTK 2 & 3 conflict when using Emgucv

I found a strange confict when using Emgu with class 'ImageViewer' 当将Emgu与类'ImageViewer'一起使用时,我发现了一个奇怪的冲突

When I have no static class member, everything work just fine. 当我没有静态的类成员时,一切正常。 for example, code like below 例如下面的代码

using Emgu.CV;
using Emgu.CV.Util;
using Emgu.CV.UI;

namespace TmpTest
{
    class TmpTest
    {
        private Mat img = new Mat();  // a non-static class member is OKey
        public static void Main(string[] arg)
        {
            SDKWrapper util = new SDKWrapper();
            ImageViewer viewer = new ImageViewer ();
            VideoCapture capture = new VideoCapture ();

            Application.Idle += new EventHandler (delegate(object sender, EventArgs e) {
                Mat read_frame = capture.QueryFrame();
                util.processFrame(read_frame);
                util.drawSkeleton(read_frame);
                viewer.Image = read_frame;
            });
            viewer.ShowDialog ();  
            return;
        }
    }
}

But as soon as I add a static class member, for example, change private Mat img into private static Mat img , I got an runtime error immediately like this 但是,一旦我添加了静态类成员,例如,将private Mat img更改为private static Mat img ,我就立即遇到运行时错误

Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

I'm using ubuntu 16.04 and monodevelopment, does anyone knows what had happened and how to solve it? 我正在使用ubuntu 16.04和monodevelopment,有人知道发生了什么事以及如何解决它?

Emgu CV is a .Net wrapper to OpenCV. Emgu CV是OpenCV的.Net包装器。 Depending on the OpenCV version you use, it can be build against GTK 2 or GTK 3, but usually is against GTK 2. However, an application can't use GTK 2 and GTK 3 at the same time. 根据您使用的OpenCV版本,它可以针对GTK 2或GTK 3构建,但通常针对GTK2。但是,应用程序不能同时使用GTK 2和GTK 3。 So I think the OpenCv part uses GTK 2 and you have something else pulling GTK 3. You should check on which libraries the binaries of emgu CV you're using depend. 因此,我认为OpenCv部分使用GTK 2,而您还有其他方面可以使用GTK3。您应该检查所使用的emgu CV二进制文件依赖于哪些库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM