Пример #1
0
        private void measurementToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GC.Collect();
            // get image
            try
            {
                stop();

                // device
#if (!TEST)
                MessageBox.Show("Pls, put rule in area vision and continue\n(device must be switch on)", "Information", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                HidController.Controller.Start(cfg.FrontLight, (int)cfg.BackLigth, 0, 0);
                HidController.Controller.BlowSetTime(cfg.BlowInterval);
#endif
                drv = new IDS();
                drv.Init(0, 0, 0, 24, null, IntPtr.Zero);
                drv.TurnON();
                Task.Delay(1000).Wait();
                var fullBmp = drv.CaptureImage(); //new Bitmap(800, 600, PixelFormat.Format24bppRgb);
                formMeasure         = new MimasMeasure.FormMeasure(true);
                formMeasure.Finish += formMeasure_Finish;
                formMeasure.Show_(fullBmp);
            }
            finally
            {
                stop();
            }
        }
Пример #2
0
        private void aqastmet()
        {
            if (drv != null)
            {
                currBitmapMaster = drv.CaptureImage();
            }

            if (checkBoxIsUseCore.Checked && currBitmapMaster != null)
            {
                var front = (Bitmap)currBitmapMaster.Clone(new Rectangle(0, 0, currBitmapMaster.Width, currBitmapMaster.Height), PixelFormat.Format24bppRgb);
                Image <Gray, byte> bin = common.Binaraze(
                    front,
                    detectorMaster.ThresholdType_METHOD, detectorMaster.ThresholdType_VAL, 255);
                dpsMaster.pbBin.Image = bin.Bitmap;

                Image <Bgr, byte> brg = new Image <Bgr, byte>(front);
                dpsMaster.pbFrame.Image = filters.colorRED.DetectColorExist(brg.Copy(bin).Bitmap, cfg).Bitmap;
            }
        }
Пример #3
0
        private void InternalProcess(CameraRequest request)
        {
            Console.WriteLine("Executing request: " + request);
            byte[] messageData;

            switch (request)
            {
            case CameraRequest.Alive:
                messageData = Encoding.ASCII.GetBytes(Constants.SuccessString + Constants.EndOfMessage);
                break;

            case CameraRequest.SendFullResImage:
                string imageLocation = camera.CaptureImage(imageName);

                messageData = ByteHelpers.FileToBytes(imageLocation);
                SendResponse(client, EndOfMessage(messageData));

                if (File.Exists(imageLocation))
                {
                    File.Delete(imageLocation);
                }
                return;

            case CameraRequest.SendTestImage:
                //For testing, send a static image saved on the device
                messageData = ByteHelpers.FileToBytes(Path.DirectorySeparatorChar + "scanimage" + Path.DirectorySeparatorChar + "test.jpg");
                SendResponse(client, EndOfMessage(messageData));
                return;

            case CameraRequest.SetProporties:
                return;

            default:
                messageData = FailedRequest();
                break;
            }

            SendResponse(client, EndOfMessage(messageData));
        }