void formModel_ReadFormImage(object sender, ReadFormImageEventArgs e)
        {
            FormModel          formMode = (FormModel)sender;
            FormDefinitionFile fd       = (FormDefinitionFile)formMode.UserTag;

            e.FormImage = FormImage.FromHdib(fd.TemplateImages[0].Hdib, true, formFix);
        }
 private void Button1_Click(object sender, EventArgs e)
 {
     using (FormImage form = new FormImage(HslCommunication.Algorithms.Fourier.FFTHelper.GetFFTImage(values.Select(m => (double)m).ToArray( ), 1000, 600, Color.Blue)))
     {
         form.ShowDialog( );
     }
 }
Esempio n. 3
0
        public void Clear()
        {
            errorProvider1.Clear();
            _fish = null;

            txtdomestic_graypart.Text   = string.Empty;
            txtdomestic_lysine.Text     = string.Empty;
            txtdomestic_methionine.Text = string.Empty;
            txtdomestic_protein.Text    = string.Empty;
            txtdomestic_sandsalt.Text   = string.Empty;
            txtdomestic_sour.Text       = string.Empty;
            txtdomestic_tvn.Text        = string.Empty;
            txtdomestic_amine.Text      = string.Empty;
            txtdomestic_aminototal.Text = string.Empty;
            txtdomestic_fat.Text        = string.Empty;
            txtSampleingDate.Text       = string.Empty;

            txtlabe_water.Text       = string.Empty;
            txtlabel_amine.Text      = string.Empty;
            txtlabel_fat.Text        = string.Empty;
            txtlabel_ffa.Text        = string.Empty;
            txtlabel_graypart.Text   = string.Empty;
            txtlabel_lysine.Text     = string.Empty;
            txtlabel_methionine.Text = string.Empty;
            txtlabel_protein.Text    = string.Empty;
            txtlabel_sand.Text       = string.Empty;
            txtlabel_sandsalt.Text   = string.Empty;
            txtlabel_tvn.Text        = string.Empty;
            //txtLinkman.Text = string.Empty;
            //txtLinkManCode.Text = string.Empty;
            //txtLinkManCode.Tag = string.Empty;

            txtquote_amine.Text    = string.Empty;
            txtquote_fat.Text      = string.Empty;
            txtquote_ffa.Text      = string.Empty;
            txtquote_graypart.Text = string.Empty;
            txtquote_protein.Text  = string.Empty;
            txtquote_sand.Text     = string.Empty;
            txtquote_sandsalt.Text = string.Empty;
            txtquote_tvn.Text      = string.Empty;
            txtquote_water.Text    = string.Empty;
            txtsgs_amine.Text      = string.Empty;
            txtsgs_fat.Text        = string.Empty;
            txtsgs_ffa.Text        = string.Empty;
            txtsgs_graypart.Text   = string.Empty;
            txtsgs_protein.Text    = string.Empty;
            txtsgs_sand.Text       = string.Empty;
            txtsgs_sandsalt.Text   = string.Empty;
            txtsgs_tvn.Text        = string.Empty;
            txtsgs_water.Text      = string.Empty;
            //txtSupplier.Text = string.Empty;
            //txtSupplierCode.Text = string.Empty;
            //txtSupplierCode.Tag = string.Empty;

            _formSGS   = null;
            _formLabel = null;
            _formGJ    = null;
            _formQuote = null;
        }
Esempio n. 4
0
        public void SetFish(FishEntity.ProductEntity entity)
        {
            _formLabel = null;
            _formSGS   = null;
            _formGJ    = null;
            _formQuote = null;
            _fish      = entity;
            if (_fish == null)
            {
                return;
            }

            txtsgs_amine.Text    = _fish.sgs_amine.ToString("f2");
            txtsgs_fat.Text      = _fish.sgs_fat.ToString();
            txtsgs_ffa.Text      = _fish.sgs_ffa.ToString();
            txtsgs_graypart.Text = _fish.sgs_graypart.ToString();
            txtsgs_protein.Text  = _fish.sgs_protein.ToString();
            txtsgs_sand.Text     = _fish.sgs_sand.ToString();
            txtsgs_sandsalt.Text = _fish.sgs_sandsalt.ToString();
            txtsgs_tvn.Text      = _fish.sgs_tvn.ToString("f2");
            txtsgs_water.Text    = _fish.sgs_water.ToString();

            txtlabe_water.Text       = _fish.labe_water.ToString();
            txtlabel_amine.Text      = _fish.label_amine.ToString("f2");
            txtlabel_fat.Text        = _fish.label_fat.ToString();
            txtlabel_ffa.Text        = _fish.label_ffa.ToString();
            txtlabel_graypart.Text   = _fish.label_graypart.ToString();
            txtlabel_lysine.Text     = _fish.label_lysine.ToString();
            txtlabel_methionine.Text = _fish.label_methionine.ToString();
            txtlabel_protein.Text    = _fish.label_protein.ToString();
            txtlabel_sand.Text       = _fish.label_sand.ToString();
            txtlabel_sandsalt.Text   = _fish.label_sandsalt.ToString();
            txtlabel_tvn.Text        = _fish.label_tvn.ToString();

            txtquote_amine.Text    = _fish.quote_amine.ToString("f2");
            txtquote_fat.Text      = _fish.quote_fat.ToString();
            txtquote_ffa.Text      = _fish.quote_ffa.ToString();
            txtquote_graypart.Text = _fish.quote_graypart.ToString();
            txtquote_protein.Text  = _fish.quote_protein.ToString();
            txtquote_sand.Text     = _fish.quote_sand.ToString();
            txtquote_sandsalt.Text = _fish.quote_sandsalt.ToString();
            txtquote_tvn.Text      = _fish.quote_tvn.ToString("f2");
            txtquote_water.Text    = _fish.quote_water.ToString();

            txtdomestic_graypart.Text   = _fish.domestic_graypart.ToString();
            txtdomestic_lysine.Text     = _fish.domestic_lysine.ToString();
            txtdomestic_methionine.Text = _fish.domestic_methionine.ToString();
            txtdomestic_protein.Text    = _fish.domestic_protein.ToString();
            txtdomestic_sandsalt.Text   = _fish.domestic_sandsalt.ToString();
            txtdomestic_sour.Text       = _fish.domestic_sour.ToString();
            txtdomestic_tvn.Text        = _fish.domestic_tvn.ToString();
            txtdomestic_fat.Text        = _fish.domestic_fat.ToString();
            txtdomestic_amine.Text      = _fish.domestic_amine.ToString();
            txtdomestic_aminototal.Text = _fish.domestic_aminototal.ToString();
            txtSampleingDate.Text       = _fish.samplingtime;
        }
Esempio n. 5
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     ISM.Template.FormImage img = new FormImage();
     img.Resource = _core.Resource;
     img.ShowDialog();
     if (img.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         txtIcon.Image = img.ImageObject;
     }
 }
Esempio n. 6
0
 private void btnPicEnter_Click(object sender, EventArgs e)
 {
     ISM.Template.FormImage img = new FormImage();
     img.Resource = _core.Resource;
     img.ShowDialog();
     if (img.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         picPicture.Image = img.ImageObject;
     }
 }
Esempio n. 7
0
 public void ShowImage(string filename)
 {
     if (mVideoSource != null)
     {
         Image img = mVideoSource.GetFrame();
         if (img != null)
         {
             FormImage form = new FormImage();
             form.ShowImage(img, filename);
         }
     }
 }
Esempio n. 8
0
        private void userButton1_Click(object sender, EventArgs e)
        {
            double[] data = new double[256];
            for (int i = 0; i < data.Length / 2; i++)
            {
                data[i] = 5;
            }

            using (FormImage form = new FormImage(HslCommunication.Algorithms.Fourier.FFTHelper.GetFFTImage(data, 1000, 600, Color.Blue)))
            {
                form.ShowDialog( );
            }
        }
Esempio n. 9
0
        private void btngj_Click(object sender, EventArgs e)
        {
            if (_formGJ == null)
            {
                _formGJ = new FormImage(0, FishEntity.ImageTypeEnum.GJ);
            }

            _formGJ.SetData(_fish == null ? 0 : _fish.id, FishEntity.ImageTypeEnum.GJ);

            _formGJ.StartPosition = FormStartPosition.CenterParent;
            if (_formGJ.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
            }
        }
Esempio n. 10
0
        private void userButton2_Click(object sender, EventArgs e)
        {
            // 信号二,正弦波叠加,额外增加了一个干扰信号

            double[] data = new double[256];
            for (int i = 0; i < data.Length; i++)
            {
                data[i] = 5 * Math.Sin(i * Math.PI / 128) + 5 + 0.5f * Math.Cos(i * 8 * Math.PI / 128);
            }

            using (FormImage form = new FormImage(HslCommunication.Algorithms.Fourier.FFTHelper.GetFFTImage(data, 1000, 600, Color.Blue)))
            {
                form.ShowDialog( );
            }
        }
Esempio n. 11
0
 private void btnZoom_Click(object sender, EventArgs e)
 {
     if (picPicture.Image != null)
     {
         ISM.Template.FormImage frm = new FormImage();
         frm.Resource    = _core.Resource;
         frm.ImageObject = picPicture.Image;
         frm.ShowDialog();
         if (frm.DialogResult == DialogResult.OK)
         {
             picPicture.Image = frm.ImageObject;
         }
     }
     else
     {
         MessageBox.Show("Зураг сонгогдоогүй байна .");
     }
 }
Esempio n. 12
0
 public Bitmap getFrame(bool isShow)
 {
     if (mFileVS != null)
     {
         Bitmap bmp = mFileVS.GetFrame();
         if (bmp != null)
         {
             if (isShow)
             {
                 FormImage form = new FormImage();
                 form.Width  = 1024;
                 form.Height = 512;
                 form.ShowImage(bmp, "新截图");
             }
             return(bmp);
         }
     }
     return(null);
 }
Esempio n. 13
0
        private Boolean LoadImage(String ImageName)
        {
            if (!File.Exists(ImageName))
            {
                MessageBox.Show("Image Doesn't exist : " + ImageName);
                return(false);
            }

            //Zonal 2
            try
            {
                currentLayer.Elements.Clear();

                InputImg.Image = ImageX.FromFile(imagXpress1, ImageName);
                Processor prc = new PegasusImaging.WinForms.ImagXpress9.Processor(imagXpress1, InputImg.Image);
                if (InputImg.Image.ImageXData.BitsPerPixel != 1)
                {
                    prc.ColorDepth(1, PaletteType.Optimized, DitherType.NoDither);
                    //InputImg.Image = prc.Image;
                }

                //    prc.Rotate(270);
                prc.DocumentDeskew(0, 10, Color.White, true, 99);
                prc.DocumentDespeckle(10, 10);
                InputImg.Image = prc.Image.Copy();

                //InputImg.Image = this.PreprocessImage(this.InputImg.Image);

                frmFilledImage = FormImage.FromHdib(InputImg.Image.ToHdib(false), true, formFix1);

                OutputImg.Image = ImageX.FromHdib(imagXpress1, frmFilledImage.ToHdib(false), true);   //InputImg.Image.Copy();

                OnPictureChanged(ICRType.Image);
                //MessageBox.Show("Load Image");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:  " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }
Esempio n. 14
0
        private Boolean LoadTemplate(String TemplateImageName)
        {
            String TemplateName = TemplateImageName.Substring(TemplateImageName.LastIndexOf("\\") + 1).ToUpper().Replace(".TIF", "");

            if (!File.Exists(TemplateImageName))
            {
                MessageBox.Show("This Template Doecn't Exist!! : " + TemplateImageName);
            }

            // Zonal
            try
            {
                InputImg.Image = ImageX.FromFile(imagXpress1, this.TemplateFile);

                /*
                 * Processor prc = new PegasusImaging.WinForms.ImagXpress9.Processor(imagXpress1, InputImg.Image);
                 * prc.Rotate(270);
                 * InputImg.Image = prc.Image.Copy();
                 */

                InputImg.Image = PreprocessImage(InputImg.Image);


                frmTemplateImage = FormImage.FromHdib(InputImg.Image.ToHdib(false), true, formFix1);

                OutputImg.Image = ImageX.FromHdib(imagXpress1, frmTemplateImage.ToHdib(false), true);   //InputImg.Image.Copy();
                OnPictureChanged(ICRType.Template);

                // MessageBox.Show("Load Template");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:  " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                IsTemplateLoaded = false;
                return(false);
            }

            IsTemplateLoaded = true;
            return(true);
        }
Esempio n. 15
0
        public void Test()
        {
            #region Load Template
            try
            {
                InputImg.Image   = ImageX.FromFile(imagXpress1, @"I:\Templates\ICRTemplate.tif");
                frmTemplateImage = FormImage.FromHdib(InputImg.Image.ToHdib(false), true, formFix1);

                InputImg.Image  = ImageX.FromHdib(imagXpress1, (System.IntPtr) 0, true);
                OutputImg.Image = ImageX.FromHdib(imagXpress1, (System.IntPtr) 0, true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:  " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            #endregion

            #region Load Image
            String ImageName = @"I:\Images\Order-0000000153.TIFF";
            try
            {
                InputImg.Image = ImageX.FromFile(imagXpress1, ImageName);
                frmFilledImage = FormImage.FromHdib(InputImg.Image.ToHdib(false), true, formFix1);

                OutputImg.Image = ImageX.FromHdib(imagXpress1, (System.IntPtr) 0, true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:  " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            //it's all looking good, so we load our image into an ImageX object
            //imageXView1.Image = ImageX.FromFile(imagXpress1, strFileName);
            Processor prc = new Processor(imagXpress1, InputImg.Image);

            if (InputImg.Image.ImageXData.BitsPerPixel != 1)
            {
                prc.ColorDepth(1, PaletteType.Optimized, DitherType.NoDither);
                InputImg.Image = prc.Image;
            }



            #endregion

            #region Register Image
            try
            {
                regProcessor = new RegistrationProcessor(formFix1);

                regResult = regProcessor.RegisterToImage(frmFilledImage, frmTemplateImage);

                frmAlignedImage = regResult.AlignImage(frmFilledImage);

                InputImg.Image = ImageX.FromHdib(imagXpress1, frmAlignedImage.ToHdib(false), true);


                OutputImg.Image = InputImg.Image.Copy();
                OnPictureChanged(ICRType.ImageMatched);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:  " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            #endregion

            #region Preprocessing Image
            Processor proc = new Processor(imagXpress1, InputImg.Image);

            if (InputImg.Image.ImageXData.BitsPerPixel != 0)
            {
                proc.ColorDepth(1, 0, 0);
            }

            scanFix1.FromHdib(InputImg.Image.ToHdib(false));


            //Remove Lines
            LineRemovalOptions LineOpts = new LineRemovalOptions();
            LineOpts.MinimumLength = 20;
            scanFix1.RemoveLines(LineOpts);

            //Despeckle
            DespeckleOptions DespeckOpts = new DespeckleOptions();
            DespeckOpts.SpeckWidth  = 10;
            DespeckOpts.SpeckHeight = 14;
            scanFix1.Despeckle(DespeckOpts);

            //Deskew
            scanFix1.Deskew();

            //Comb options

            /*
             * comb = new PegasusImaging.WinForms.ScanFix5.CombRemovalOptions();
             *
             * comb.Area = new System.Drawing.Rectangle(AreaXBar.Value, AreaYBar.Value, AreaWBar.Value, AreaHBar.Value);
             * comb.CombHeight = CombHBar.Value;
             * comb.CombSpacing = SpaceBar.Value;
             * comb.HorizontalLineThickness = HBar.Value;
             * comb.VerticalLineThickness = VBar.Value;
             * comb.MinimumCombLength = LengthBar.Value;
             * comb.MinimumConfidence = ConfidenceBar.Value;
             *
             * scanFix1.RemoveCombs(comb);
             */

            //Smooth Options
            //scanFix1.SmoothObjects(SmoothBar.Value);


            //Blob Options

            /*
             * blob = new PegasusImaging.WinForms.ScanFix5.BlobRemovalOptions();
             *
             * blob.Area = new System.Drawing.Rectangle(BlobAreaXBar.Value, BlobAreaYBar.Value, AreaWidthBar.Value, AreaHeightBar.Value);
             * blob.MaximumPixelCount = MaxCountBar.Value;
             * blob.MinimumPixelCount = MinCountBar.Value;
             * blob.MinimumDensity = DensityBar.Value;
             *
             * scanFix1.RemoveBlobs(blob);
             */

            //Remove Dot Shading

            /*
             * dot = new PegasusImaging.WinForms.ScanFix5.DotShadingRemovalOptions();
             *
             * dot.DensityAdjustment = DotDensityBar.Value;
             * dot.MaximumDotSize = DotSizeBar.Value;
             * dot.HorizontalSizeAdjustment = HAdjBar.Value;
             * dot.VerticalSizeAdjustment = VAdjBar.Value;
             * dot.MinimumAreaHeight = DotHBar.Value;
             * dot.MinimumAreaWidth = DotWBar.Value;
             *
             * scanFix1.RemoveDotShading(dot);
             */


            //Remove Border Options

            /*
             * border = new PegasusImaging.WinForms.ScanFix5.BorderRemovalOptions();
             *
             * border.BorderSpeckSize = BSpeckBar.Value;
             * border.CropBorder = chkcrop.Checked;
             * border.DeskewBorder = chkdeskew.Checked;
             * border.MaximumPageHeight = MaxHeightBar.Value;
             * border.MaximumPageWidth = MaxWidthBar.Value;
             * border.MinimumConfidence = MinConBar.Value;
             * border.MinimumPageHeight = MinHeightBar.Value;
             * border.MinimumPageWidth = SpeckWidthBar.Value;
             * border.PageSpeckSize = PSpeckBar.Value;
             * border.Quality = SpeckQualityBar.Value;
             * border.ReplaceBorder = chkreplace.Checked;
             *
             * if (true)
             * {
             *  border.PadColor = System.Drawing.Color.FromArgb(0, 0, 0);
             * }
             * else
             * {
             *  border.PadColor = System.Drawing.Color.FromArgb(255, 255, 255);
             * }
             * scanFix1.RemoveBorder(border);
             */
            #endregion

            #region Read Fields

            InputImg.Image = ImageX.FromHdib(imagXpress1, scanFix1.ToHdib(false));


            // Set area and analyze field DIB
            SmartZone2.Reader.CharacterSet = CharacterSet.AllAlphas;
            Rectangle currentArea = new Rectangle(85, 170, 603, 79);
            SmartZone2.Reader.Area = currentArea;
            myTextBlockRes         = SmartZone2.Reader.AnalyzeField(InputImg.Image.ToHdib(false));


            if (myTextBlockRes.NumberTextLines > 0)
            {
                Boolean hasResult = true;

                LineResult = myTextBlockRes.TextLine(0);

                //   showBlockResult();
                //   showLineResult(0);
                //   showCharacterResult(0);
            }
            else
            {
                Boolean hasResult = false;
            }

            MessageBox.Show(myTextBlockRes.TextLine(0).Text);
            #endregion

            return;
        }