Exemplo n.º 1
0
        public static PipelineDemoSession Create(string pathToVideoFile, bool applyOtsuBinarization)
        {
            IntPtr handle;

            try
            {
                int flags = (int)(applyOtsuBinarization ? OeipCApi.Flags.ApplyOtsuBinarization : OeipCApi.Flags.None);
                handle = OeipCApi.OpenVideo(pathToVideoFile, null, flags);
            }
            catch (DllNotFoundException ex)
            {
                throw new DllNotFoundException("Can't find one or two DLLs. Make sure that front.exe's working directory has a copy of both core.dll and opencv_world450.dll!", ex);
            }

            if (handle == IntPtr.Zero)
            {
                if (File.Exists(pathToVideoFile))
                {
                    throw new DllNotFoundException("Can't find one or more DLLs. Make sure that front.exe's working directory has a copy of both opencv_world440.dll and opencv_videoio_ffmpeg450_64.dll.");
                }
                else
                {
                    throw new FileNotFoundException($"File {pathToVideoFile} was not found!");
                }
            }

            return(new PipelineDemoSession(handle));
        }
Exemplo n.º 2
0
        public void Dispose()
        {
            var h = _handle;

            _handle = IntPtr.Zero;
            OeipCApi.CloseVideo(h);
            _cb_output = null;
        }
Exemplo n.º 3
0
        protected PipelineDemoSession(IntPtr handle)
        {
            _handle  = handle;
            _outputs = new Dictionary <Stage, Bitmap>();

            // "Pinneljuk" a delegate-et hogy ne GC-zodjon mikozben a lib meg pointert tarol ra
            _cb_output = StageOutputCallback;
            OeipCApi.RegisterStageOutputCallback(_handle, _cb_output);
        }
Exemplo n.º 4
0
        public bool Step()
        {
            var res = OeipCApi.Step(_handle);

            foreach (var kv in _outputs)
            {
                StageHasOutput?.Invoke(kv.Key, kv.Value);
            }

            return(res);
        }