Exemplo n.º 1
0
        public void DisplayOpenCvMatImage(object sender, EventArgsLibrary.OpenCvMatImageArgs e)
        {
            var    image      = e.Mat.Bitmap;
            string descriptor = e.Descriptor;

            switch (descriptor)
            {
            case "ImageFromCamera":
                Image1 = BitmapToImageSource(image);
                break;

            case "ImageFromCameraViaProcessing":
                Image2 = BitmapToImageSource(image);
                break;

            case "ImageDebug2":
                Image2 = BitmapToImageSource(image);
                break;

            case "ImageDebug3":
                Image3 = BitmapToImageSource(image);
                break;

            default:
                Image4 = BitmapToImageSource(image);
                break;
            }
        }
Exemplo n.º 2
0
        //Event de réception d'imae depuis un flux
        //Bitmap lastImage;
        //public void CameraImageEventCB(object sender, EventArgsLibrary.CameraImageArgs e)
        //{
        //    lastImage = e.ImageBmp;
        //}

        public void ProcessOpenCvMatImage(object sender, EventArgsLibrary.OpenCvMatImageArgs e)
        {
            Mat initialMat = e.Mat;

            OnOpenCvMatImageProcessedReady(initialMat, "ImageFromCameraViaProcessing");

            //Découpage de l'image
            int   RawMatCroppedSize = 300;
            int   cropOffsetX       = 0;
            int   cropOffsetY       = 0;
            Range rgX           = new Range(initialMat.Width / 2 - RawMatCroppedSize / 2 + cropOffsetX, initialMat.Width / 2 + RawMatCroppedSize / 2 + cropOffsetX);
            Range rgY           = new Range(initialMat.Height / 2 - RawMatCroppedSize / 2 + cropOffsetY, initialMat.Height / 2 + RawMatCroppedSize / 2 + cropOffsetY);
            Mat   RawMatCropped = new Mat(initialMat, rgY, rgX);

            //Conversion en HSV
            Mat HsvMatCropped = new Mat();

            CvInvoke.CvtColor(RawMatCropped, HsvMatCropped, ColorConversion.Bgr2Hsv);
            OnOpenCvMatImageProcessedReady(HsvMatCropped, "ImageDebug3");
            OnOpenCvMatImageProcessedReady(TerrainTheoriqueVertical, "ImageDebug4");
        }