locked
EmguCV 的程序从 win7 64bit 移植到 wnidows embedded standard 7 中出现了System.TypeInitialization的问题 RRS feed

  • 问题


  • 这个程序在win7 64位旗舰版上能顺利运行 可是到了wnidows embedded standard 7就会出现下面的错误。

    希望好心的各位能给我点建议。

    Description:

      Stopped working

    Problem signature:
      Problem Event Name: CLR20r3
      Problem Signature 01: tnnder.exe
      Problem Signature 02: 1.0.0.0
      Problem Signature 03: 4ff843b0
      Problem Signature 04: Emgu.CV
      Problem Signature 05: 2.3.0.1416
      Problem Signature 06: 4e9ce990
      Problem Signature 07: 13a
      Problem Signature 08: a2
      Problem Signature 09: System.TypeInitialization
      OS Version: 6.1.7601.2.1.0.320.65
      Locale ID: 2052

    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.Threading;
    using Emgu.CV;
    using Emgu.Util;
    using Emgu.CV.Structure;
    using Emgu.CV.UI;
    using Emgu.CV.Util;
    
    namespace TNNDer
    {
        public partial class Form1 : Form
        {
            private System.Drawing.PointF[] srcPoints;//透视变换的原始坐标
            private System.Drawing.PointF[] distPoints;//透视变换的目标坐标
            private byte mouseClickCount;
            private bool navigateStartFlag;
            private bool prtTransStartFlag;
            private System.Threading.Thread prtTransThrd;//启动变换的线程
    
            public void OnNavigating(object obj, System.Windows.Forms.MouseEventArgs e)//定位目标坐标
            {
                if (this.navigateStartFlag == true)
                {
                    this.mouseClickCount %= 4;
                    this.distPoints[mouseClickCount] = e.Location;
                    this.mouseClickCount++;
                    if (this.mouseClickCount == 4)
                    {
                        this.navigateStartFlag = false;
                        this.button1.Text = "NaviFinish";
                    }
                }
            }
    
            public void TransForm()//进行透视变换的函数
            {
                while (true)
                {
                    using (Bitmap srcBitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height))
                    {
                        using (Graphics g = Graphics.FromImage(srcBitmap))
                        {
                            //截屏 并对所获图像进行透视变换
                            g.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(1366, 768));
                            using (Emgu.CV.Matrix<double> mat = new Emgu.CV.Matrix<double>(3, 3))//透视变换的3*3矩阵
                            {
                                using (Image<Bgra, byte> srcimage = new Emgu.CV.Image<Bgra, byte>(srcBitmap))
                                {
                                    Emgu.CV.CvInvoke.cvGetPerspectiveTransform(srcPoints, distPoints, mat);
                                    using (Image<Bgra, byte> distimage = srcimage.WarpPerspective(mat, Emgu.CV.CvEnum.INTER.CV_INTER_NN, Emgu.CV.CvEnum.WARP.CV_WARP_FILL_OUTLIERS, new Bgra(0, 0, 0, 0)))
                                    {
                                        this.panAndZoomPictureBox1.Image = distimage.ToBitmap();
                                        Thread.Sleep(35);
                                    }
                                }
                            }
                        }
                    }
                }
            }
    
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                Form1.CheckForIllegalCrossThreadCalls = false;
                this.navigateStartFlag = false;
                this.prtTransStartFlag = false;
                this.srcPoints = new PointF[4];
                this.srcPoints[0] =new PointF(0, 0);
                this.srcPoints[1] = new PointF(1365, 0);
                this.srcPoints[2] = new PointF(0, 767);
                this.srcPoints[3] = new PointF(1365, 767);
                this.distPoints = new PointF[4];
                for (int i = 0; i < 4;i++ )
                {
                    this.distPoints[i] = new PointF(0, 0);
                }
            }
    
            private void panAndZoomPictureBox1_MouseDoubleClick(object sender, MouseEventArgs e)
            {
                this.OnNavigating(sender, e);
            }
    
            private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
            {
                this.OnNavigating(sender, e);
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                if (this.prtTransStartFlag == false)
                {
                    this.prtTransThrd = new System.Threading.Thread(this.TransForm);
                    System.Threading.Thread.Sleep(1);
                    this.prtTransThrd.Start();
                    this.prtTransStartFlag = true;
                    this.button2.Text = "stop?";
                }
                else
                {
                    this.prtTransThrd.Abort();
                    this.prtTransStartFlag = false;
                    this.button2.Text = "Begin?";
                }
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                if (this.navigateStartFlag == false)
                {
                    this.button1.Text = "OnNavigating";
                    this.navigateStartFlag = true;
                }
                else
                {
                    this.button1.Text = "NaviFinish";
                    this.navigateStartFlag = false;
                }
            }
    
        }
    }


    • 已编辑 seepure 2012年7月7日 17:40
    2012年7月7日 17:34

全部回复

  • WES7的系统是32位的还是64位的呢?

    WES JDP Team

    2012年7月18日 9:24
    版主
  • 应该是少组件,建议优先在ICE 里面用静态分析工具,分析一下你的编译好的程序。


    肖正波 / Zhengbo.Xiao
    销售微软软件授权、技术支持及相关培训
    深圳艾斯威特贸易有限公司
    www.iswtt.com
    我的WIndows Embedded中文技术BLOG(海外):
    http://questor87.wordpress.com/
    我的WIndows Embedded中文技术BLOG(国内):
    http://blog.sina.com.cn/windowsembedded
    QQ:1320232327(另外两个已满)
    MSN:questor_87@hotmail.com
    MCTS:
    Windows Embedded Standard 7 Development
    Windows Embedded Standard 2009 Development
    Windows Embedded Standard CE Development
    Microsoft MVP(2010-2012)

    2012年7月19日 13:31
    版主