public FaceSearchController(
            IFrameStream source,
            IOperation<Frame> frameProcessor,
            IConvertor<Frame, Portrait> convertor,
            IOperation<Portrait> portraitProcessor)
        {
            _source = source;
            _frameProcessor = frameProcessor;
            _convertor = convertor;
            _portraitProcessor = portraitProcessor;

            _worker.DoWork = delegate
            {
                var frames = frameProcessor.Execute(null).ToList();
                var portraits = _convertor.Execute(frames).ToList();
                var portraitsAfterProcess = _portraitProcessor.Execute(portraits).ToList();

                foreach (var portrait in portraitsAfterProcess)
                {
                    portrait.Dispose();
                }
            };

            _worker.OnExceptionRetry = () => _source.Connect();
        }
        public FaceSearchController(
            IFrameStream source,
            IOperation <Frame> frameProcessor,
            IConvertor <Frame, Portrait> convertor,
            IOperation <Portrait> portraitProcessor)
        {
            _source            = source;
            _frameProcessor    = frameProcessor;
            _convertor         = convertor;
            _portraitProcessor = portraitProcessor;

            _worker.DoWork = delegate
            {
                var frames                = frameProcessor.Execute(null).ToList();
                var portraits             = _convertor.Execute(frames).ToList();
                var portraitsAfterProcess = _portraitProcessor.Execute(portraits).ToList();

                foreach (var portrait in portraitsAfterProcess)
                {
                    portrait.Dispose();
                }
            };

            _worker.OnExceptionRetry = () => _source.Connect();
        }
Exemple #3
0
        internal frmFileInformation(IFrameStream frameStream)
        {
            InitializeComponent();

            m_FrameStream = frameStream;
            PopulateInfo();
        }
        internal frmFileInformation(IFrameStream frameStream)
        {
            InitializeComponent();

            m_FrameStream = frameStream;
            PopulateInfo();
        }
        public static FaceSearchController CreateNewController(IFrameStream source, 
            IOperation<Frame> frameProcessor,
            IConvertor<Frame, Portrait> convertor,
            IOperation<Portrait> portraitProcessor)
        {
            var controller = new FaceSearchController(source, frameProcessor, convertor, portraitProcessor);

            return controller;
        }
        public static FaceSearchController CreateNewController(IFrameStream source,
                                                               IOperation <Frame> frameProcessor,
                                                               IConvertor <Frame, Portrait> convertor,
                                                               IOperation <Portrait> portraitProcessor)
        {
            var controller = new FaceSearchController(source, frameProcessor, convertor, portraitProcessor);

            return(controller);
        }
Exemple #7
0
        private void EnsureClosed()
        {
            if (m_VideoStream != null)
            {
                IDisposable disp = m_VideoStream as IDisposable;
                if (disp != null)
                {
                    disp.Dispose();
                }

                m_VideoStream = null;
            }
        }
Exemple #8
0
        public void Initialize(IFrameStream videoStream, int currentFrameNo)
        {
            m_VideoStream        = videoStream;
            m_ReInterlacedStream = videoStream as ReInterlacingVideoStream;

            SetFilterMode();

            gbxInterlacedSettings.Enabled = m_ReInterlacedStream != null;
            rbReInterlaceNon.Checked      = true;

            HotPixelCorrector.ConfigurePreProcessing(false);
            tbDepth.Value = 20;
        }
        public void Initialize(IFrameStream videoStream, int currentFrameNo)
        {
            m_VideoStream = videoStream;
            m_ReInterlacedStream = videoStream as ReInterlacingVideoStream;

            SetFilterMode();

            gbxInterlacedSettings.Enabled = m_ReInterlacedStream != null;
            rbReInterlaceNon.Checked = true;

            HotPixelCorrector.ConfigurePreProcessing(false);
            tbDepth.Value = 20;
        }
Exemple #10
0
        public void OpenVideo(IFrameStream frameStream)
        {
            EnsureClosed();

            m_VideoStream = frameStream;

            this.m_IsRunning           = false;
            this.m_StopRequestReceived = false;

            m_MillisecondsPerFrame = (int)m_VideoStream.MillisecondsPerFrame;
            m_CurrentFrameIndex    = m_VideoStream.FirstFrame - 1;
            m_FramesToIntegrate    = 0;
            m_FrameIntegration     = FrameIntegratingMode.NoIntegration;
            m_PlayBackwards        = false;
        }
        public static FaceSearchController CreateNewController(IFrameStream source)
        {
            PortraitFinder finder = new PortraitFinder();

            MotionDetector motionDetector = new MotionDetector();
            motionDetector.MotionFrameCaptured += finder.HandleMotionFrame;

            Damany.Util.PersistentWorker retriever = CreateDriver(source, motionDetector);

            var controller = new FaceSearchController()
            {
                Worker = retriever,
                PortraitFinder = finder,
                MotionDetector = motionDetector
            };

            return controller;
        }
Exemple #12
0
        public void Initialize(IFrameStream videoStream, int currentFrameNo)
        {
            m_VideoStream = videoStream;

            m_DisplaySettings.Load();
            m_DisplaySettings.Initialize();

            if (m_VideoStream != null)
            {
                nudFrameNo.Minimum = m_VideoStream.FirstFrame;
                nudFrameNo.Maximum = m_VideoStream.LastFrame;
                nudFrameNo.SetNUDValue(currentFrameNo);
            }

            picHistogram.Image = new Bitmap(picHistogram.Width, picHistogram.Height);
            picStretched.Image = new Bitmap(picStretched.Width, picStretched.Height);

            m_HistogramData.Clear();
            for (int i = 0; i < 256; i++)
            {
                m_HistogramData.Add(0);
            }

            m_DisplayData.Clear();
            for (int i = 0; i < 256; i++)
            {
                m_DisplayData.Add(0);
            }

            m_DisplayWindowData.Clear();
            for (int i = 0; i < 256; i++)
            {
                m_DisplayWindowData.Add(0);
            }

            m_FromByte = 0;
            m_ToByte   = 128;
            UpdateFromToControls();

            pnlClipStretch.Visible        = true;
            pnlBrightnessContrast.Visible = false;

            EnsureWindowData();
        }
        public static FaceSearchController CreateNewController(IFrameStream source)
        {
            PortraitFinder finder = new PortraitFinder();

            MotionDetector motionDetector = new MotionDetector();

            motionDetector.MotionFrameCaptured += finder.HandleMotionFrame;

            Damany.Util.PersistentWorker retriever = CreateDriver(source, motionDetector);

            var controller = new FaceSearchController()
            {
                Worker         = retriever,
                PortraitFinder = finder,
                MotionDetector = motionDetector
            };

            return(controller);
        }
        private static Damany.Util.PersistentWorker CreateDriver(IFrameStream source, MotionDetector motionDetector)
        {
            var retriever = new Damany.Util.PersistentWorker();
            retriever.OnWorkItemIsDone += item =>
            {
                Console.Write("\r");
                Frame f = item as Frame;
                Console.Write(f.ToString());
            };

            retriever.DoWork = delegate
            {
                var frame = source.RetrieveFrame();
                retriever.ReportWorkItem(frame);
                motionDetector.DetectMotion(frame);
            };

            retriever.OnExceptionRetry = delegate { source.Connect(); };
            return retriever;
        }
        private static Damany.Util.PersistentWorker CreateDriver(IFrameStream source, MotionDetector motionDetector)
        {
            var retriever = new Damany.Util.PersistentWorker();

            retriever.OnWorkItemIsDone += item =>
            {
                Console.Write("\r");
                Frame f = item as Frame;
                Console.Write(f.ToString());
            };

            retriever.DoWork = delegate
            {
                var frame = source.RetrieveFrame();
                retriever.ReportWorkItem(frame);
                motionDetector.DetectMotion(frame);
            };

            retriever.OnExceptionRetry = delegate { source.Connect(); };
            return(retriever);
        }
        public static Damany.Imaging.Common.IFrameStream NewFrameStream(Damany.PC.Domain.CameraInfo cameraInfo)
        {
            IFrameStream source = null;

            switch (cameraInfo.Provider)
            {
#if DEBUG
            case Damany.PC.Domain.CameraProvider.LocalDirectory:
                break;
#endif

            case Damany.PC.Domain.CameraProvider.Sanyo:
                var sanyo = new SanyoNetCamera();
                sanyo.Uri      = cameraInfo.Location;
                sanyo.UserName = cameraInfo.LoginUserName ?? "guest";
                sanyo.PassWord = cameraInfo.LoginPassword ?? "guest";
                source         = sanyo;
                break;

#if DEBUG
            case Damany.PC.Domain.CameraProvider.AipStar:

                var aip = new Damany.Cameras.Wrappers.AipStarCamera(cameraInfo.Location.Host, cameraInfo.Location.Port, "", "");
                aip.UserName = cameraInfo.LoginUserName ?? "system";
                aip.PassWord = cameraInfo.LoginPassword ?? "system";
                source       = aip;
                break;
#endif

            default:
                throw new NotSupportedException("camera type not supported");

                break;
            }


            source.Id = cameraInfo.Id;

            return(source);
        }
Exemple #17
0
        public bool OpenVideo(string fileName)
        {
            string fileExtension = Path.GetExtension(fileName);

            if (fileExtension != null)
            {
                fileExtension = fileExtension.ToLower();
            }

            IFrameStream frameStream = null;

            if (fileExtension == ".adv" || fileExtension == ".aav")
            {
                AdvFileMetadataInfo fileMetadataInfo;
                GeoLocationInfo     geoLocation;
                frameStream = AstroDigitalVideoStream.OpenFile(fileName, out fileMetadataInfo, out geoLocation);
            }
            else if (fileExtension == ".avi")
            {
                frameStream = VideoStream.OpenFileForAutomation(fileName, 0);
                frameStream = ReInterlacingVideoStream.Create(frameStream, ReInterlaceMode.None);
            }
            else
            {
                Console.Error.WriteLine("{0} files are not supported.", fileExtension);
                Console.WriteLine(string.Format("{0} files are not supported.", fileExtension));

                return(false);
            }

            if (frameStream != null && m_FramePlayer != null)
            {
                m_FramePlayer.OpenVideo(frameStream);
                return(true);
            }

            return(false);
        }
Exemple #18
0
        public void Initialize(IFrameStream videoStream, int currentFrameNo)
        {
            m_VideoStream = videoStream;

            m_DisplaySettings.Load();
            m_DisplaySettings.Initialize();

            if (m_VideoStream != null)
            {
                nudFrameNo.Minimum = m_VideoStream.FirstFrame;
                nudFrameNo.Maximum = m_VideoStream.LastFrame;
                nudFrameNo.SetNUDValue(currentFrameNo);
            }

            picHistogram.Image = new Bitmap(picHistogram.Width, picHistogram.Height);
            picStretched.Image = new Bitmap(picStretched.Width, picStretched.Height);

            m_HistogramData.Clear();
            for (int i = 0; i < 256; i++)
                m_HistogramData.Add(0);

            m_DisplayData.Clear();
            for (int i = 0; i < 256; i++)
                m_DisplayData.Add(0);

            m_DisplayWindowData.Clear();
            for (int i = 0; i < 256; i++)
                m_DisplayWindowData.Add(0);

            m_FromByte = 0;
            m_ToByte = 128;
            UpdateFromToControls();

            pnlClipStretch.Visible = true;
            pnlBrightnessContrast.Visible = false;

            EnsureWindowData();
        }
Exemple #19
0
        private void EnsureClosed()
        {
            if (m_VideoStream != null)
            {
                IDisposable disp = m_VideoStream as IDisposable;
                if (disp != null) disp.Dispose();

                m_VideoStream = null;
            }
        }
Exemple #20
0
 public void RotateVideo(float angle)
 {
     // This is an experimental code
     m_VideoStream = new RotatedVideoStream(m_VideoStream, angle);
 }
Exemple #21
0
        public void OpenVideo(IFrameStream frameStream)
        {
            EnsureClosed();

            m_VideoStream = frameStream;

            this.m_IsRunning = false;
            this.m_StopRequestReceived = false;

            m_MillisecondsPerFrame = (int)m_VideoStream.MillisecondsPerFrame;
            m_CurrentFrameIndex = m_VideoStream.FirstFrame - 1;
            m_FramesToIntegrate = 0;
            m_FrameIntegration = FrameIntegratingMode.NoIntegration;
            m_PlayBackwards = false;
        }
 public FrameReader(IFrameStream source)
 {
     _source = source;
 }
Exemple #23
0
 public RotatedVideoStream(IFrameStream originalVideo, double angleDegrees)
 {
     m_Video = originalVideo;
     m_Angle = angleDegrees;
 }
Exemple #24
0
 public static IFrameStream Create(IFrameStream baseStream, ReInterlaceMode mode)
 {
     return(new ReInterlacingVideoStream(baseStream, mode));
 }
Exemple #25
0
 public void RotateVideo(float angle)
 {
     // This is an experimental code
     m_VideoStream = new RotatedVideoStream(m_VideoStream, angle);
 }
Exemple #26
0
 /// <summary>
 /// Initializes an instance of this class.
 /// </summary>
 /// <param name="format">The format of the waveform.</param>
 /// <param name="frameCount">The number of frames within the waveform.</param>
 /// <param name="frameStream">The stream providing the waveform's frames.</param>
 public StreamWaveform(WaveformFormat format, int frameCount, IFrameStream frameStream)
     : base(format)
 {
     _frameCount  = frameCount;
     _frameStream = frameStream;
 }
 private ReInterlacingVideoStream(IFrameStream baseStream, ReInterlaceMode mode)
 {
     m_BaseStream = baseStream;
     ChangeReInterlaceMode(mode);
 }
 public static IFrameStream Create(IFrameStream baseStream, ReInterlaceMode mode)
 {
     return new ReInterlacingVideoStream(baseStream, mode);
 }
Exemple #29
0
 private ReInterlacingVideoStream(IFrameStream baseStream, ReInterlaceMode mode)
 {
     m_BaseStream = baseStream;
     ChangeReInterlaceMode(mode);
 }
Exemple #30
0
 public RotatedVideoStream(IFrameStream originalVideo, double angleDegrees)
 {
     m_Video = originalVideo;
     m_Angle = angleDegrees;
 }