private void ButtonAnalysisImage_Click(object sender, EventArgs e)
        {
            CImage image = new CImage();

            if (false == SDK.CvtBitmap2CImage(m_Bitmap, ref image))
            {
                MessageBox.Show("CvtBitmap2CImage出错!");
                return;
            }

            BUAnalysisResult result = new BUAnalysisResult();

            error_code = SDK.ExecuteBUAnalysisFromImage(hAnalysisHandle, image, ref result);
            if (error_code != ErrorCode.SYY_NO_ERROR)
            {
                MessageBox.Show("运行分析出错,请查看log文件。");
                return;
            }

            error_code = SDK.DrawResult2Image(ref image, result);
            if (error_code != ErrorCode.SYY_NO_ERROR)
            {
                MessageBox.Show("运行转换出错,请查看log文件。");
                return;
            }


            ShowImage(image);
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (m_sImageFile == "" || false == File.Exists(m_sImageFile))
            {
                MessageBox.Show("文件路径有误: " + m_sImageFile);
                return;
            }

            if (m_Bitmap == null)
            {
                MessageBox.Show("没加载bitmap!");
                return;
            }

            string path = System.Environment.CurrentDirectory;

            CImage image = new CImage();

            if (false == SDK.CvtBitmap2CImage(m_Bitmap, ref image))
            {
                MessageBox.Show("CvtBitmap2CImage出错!");
                return;
            }

            BUAnalysisResult result = new BUAnalysisResult();

            error_code = SDK.ExecuteBUAnalysisFromImage(hHandle, image, ref result);
            if (error_code != ErrorCode.SYY_NO_ERROR)
            {
                MessageBox.Show("运行分析出错,请查看log文件。");
                return;
            }

            error_code = SDK.DrawResult2Image(ref image, result);
            if (error_code != ErrorCode.SYY_NO_ERROR)
            {
                MessageBox.Show("运行转换出错,请查看log文件。");
                return;
            }

            Bitmap cvt_bitmap = new Bitmap(image.nWidth, image.nHeight, image.nChannels * image.nWidth,
                                           System.Drawing.Imaging.PixelFormat.Format24bppRgb, image.pData);

            ShowImage(cvt_bitmap);
        }