예제 #1
0
        private void btStop_Click(object sender, EventArgs e)
        {
            tmRecording.Stop();

            VideoCapture1.Stop();
            kinect.Stop();
        }
예제 #2
0
        /// <summary>
        /// Stop capture for all cams.
        /// </summary>
        public void CaptureStop()
        {
            AddLog("stop - 1");

            VideoCapture1.Stop();

            AddLog("stop - 2");
        }
예제 #3
0
        private void btStop_Click(object sender, EventArgs e)
        {
            VideoCapture1.Stop();
            MediaPlayer1.Stop();

            FaceDetectionRemove();
            CarCounterRemove();
            PedestrianDetectionRemove();
        }
예제 #4
0
        private void PushImages()
        {
            Bitmap bmp = null;

            for (int k = 0; k < 5; k++)
            {
                for (int i = 0; i < 25; i++)
                {
                    switch (k)
                    {
                    case 0:
                        bmp = new Bitmap(Properties.Resources._1);
                        break;

                    case 1:
                        bmp = new Bitmap(Properties.Resources._2);
                        break;

                    case 2:
                        bmp = new Bitmap(Properties.Resources._3);
                        break;

                    case 3:
                        bmp = new Bitmap(Properties.Resources._4);
                        break;

                    case 4:
                        bmp = new Bitmap(Properties.Resources._5);
                        break;
                    }

                    if (bmp != null)
                    {
                        VideoCapture1.Push_Source_AddVideoFrame(bmp);
                        bmp.Dispose();
                    }

                    Application.DoEvents();
                }
            }

            VideoCapture1.Stop();

            tmRecording.Stop();

            MessageBox.Show("Done!");
        }
예제 #5
0
        private void StopVideoDelegateMethod()
        {
            // done. searching for fingerprints.
            VideoCapture1.Stop();

            long   n;
            IntPtr p = VFPSearch.Build(out n, ref searchLiveData);

            VFPFingerPrint fvp = new VFPFingerPrint()
            {
                Data             = new byte[n],
                OriginalFilename = string.Empty
            };

            Marshal.Copy(p, fvp.Data, 0, (int)n);

            searchLiveData.Free();


            foreach (var ad in adVFPList)
            {
                List <int> positions;
                bool       found = VFPAnalyzer.Search(ad, fvp, ad.Duration, (int)slDifference.Value, out positions, true);

                if (found)
                {
                    foreach (var pos in positions)
                    {
                        results.Add(
                            new ResultsViewModel()
                        {
                            Sample    = ad.OriginalFilename,
                            TimeStamp = DateTime.Now.ToString(CultureInfo.InvariantCulture)
                                        // minutes + ":" + seconds
                        });
                    }
                }
            }

            MessageBox.Show("Analyze completed!");
        }
예제 #6
0
 private void btStop_Click(object sender, EventArgs e)
 {
     VideoCapture1.Stop();
 }
예제 #7
0
 private void btStop_Click(object sender, EventArgs e)
 {
     MediaPlayer1.Stop();
     VideoCapture1.Stop();
 }
예제 #8
0
        private void btStart_Click(object sender, RoutedEventArgs e)
        {
            if ((string)btStart.Content == "Stop")
            {
                VideoCapture1.Stop();

                Thread.Sleep(500);

                ProcessVideoDelegateMethod();

                btStart.Content = "Start";

                lbStatus.Content = string.Empty;

                if (_tempBuffer != IntPtr.Zero)
                {
                    Marshal.FreeCoTaskMem(_tempBuffer);
                    _tempBuffer = IntPtr.Zero;
                }
            }
            else
            {
                btStart.IsEnabled = false;

                lbStatus.Content = "Step 1: Searching video files";

                _fragmentCount        = 0;
                _overlapFragmentCount = 0;

                var engine = VFMediaPlayerSource.File_VLC;

                switch (cbEngine.SelectedIndex)
                {
                case 0:
                    engine = VFMediaPlayerSource.File_DS;
                    break;

                case 1:
                    engine = VFMediaPlayerSource.File_FFMPEG;
                    break;

                case 2:
                    engine = VFMediaPlayerSource.File_VLC;
                    break;

                case 3:
                    engine = VFMediaPlayerSource.LAV;
                    break;
                }

                var adList = new List <string>();

                _adVFPList = new List <VFPFingerPrint>();

                foreach (string item in lbAdFolders.Items)
                {
                    adList.AddRange(FileScanner.SearchVideoInFolder(item));
                }

                lbStatus.Content = "Step 2: Getting fingerprints for ads files";

                if (adList.Count == 0)
                {
                    btStart.Content  = "Start";
                    lbStatus.Content = string.Empty;

                    MessageBox.Show("Ads list is empty!");

                    return;
                }

                int progress = 0;
                foreach (string filename in adList)
                {
                    pbProgress.Value = progress;
                    string         error = "";
                    VFPFingerPrint fp;

                    if (File.Exists(filename + ".vfsigx"))
                    {
                        fp = VFPFingerPrint.Load(filename + ".vfsigx");
                    }
                    else
                    {
                        var source = new VFPFingerprintSource(filename, engine);
                        foreach (var area in _ignoredAreas)
                        {
                            source.IgnoredAreas.Add(area);
                        }

                        fp = VFPAnalyzer.GetSearchFingerprintForVideoFile(source, out error);
                    }

                    if (fp == null)
                    {
                        MessageBox.Show("Unable to get fingerpring for video file: " + filename + ". Error: " + error);
                    }
                    else
                    {
                        fp.Save(filename + ".vfsigx", false);
                        _adVFPList.Add(fp);
                    }

                    progress += 100 / adList.Count;
                }

                int fragmentDurationProperty = Convert.ToInt32(edFragmentDuration.Text);
                if (fragmentDurationProperty != 0)
                {
                    _fragmentDuration = fragmentDurationProperty * 1000;
                }
                else
                {
                    var  maxDuration         = _adVFPList.Max((print => print.Duration));
                    long minfragmentDuration = (((maxDuration + 1000) / 1000) + 1) * 1000;
                    _fragmentDuration = minfragmentDuration * 2;
                }

                pbProgress.Value = 100;

                if (_tempBuffer != IntPtr.Zero)
                {
                    Marshal.FreeCoTaskMem(_tempBuffer);
                    _tempBuffer = IntPtr.Zero;
                }

                lbStatus.Content = "Step 3: Starting video preview";

                if (cbSource.SelectedIndex == 0)
                {
                    VideoCapture1.Video_CaptureDevice         = cbVideoSource.Text;
                    VideoCapture1.Video_CaptureFormat         = cbVideoFormat.Text;
                    VideoCapture1.Video_CaptureFormat_UseBest = false;
                    VideoCapture1.Video_FrameRate             = Convert.ToDouble(cbVideoFrameRate.Text);

                    VideoCapture1.Mode = VFVideoCaptureMode.VideoPreview;
                }
                else
                {
                    var ip = new IPCameraSourceSettings
                    {
                        URL      = edNetworkSourceURL.Text,
                        Login    = edNetworkSourceLogin.Text,
                        Password = edNetworkSourcePassword.Text
                    };

                    switch (cbNetworkSourceEngine.SelectedIndex)
                    {
                    case 0:
                        ip.Type = VFIPSource.Auto_LAV;
                        break;

                    case 1:
                        ip.Type = VFIPSource.Auto_VLC;
                        break;

                    case 2:
                        ip.Type = VFIPSource.Auto_FFMPEG;
                        break;
                    }

                    VideoCapture1.IP_Camera_Source = ip;

                    VideoCapture1.Mode = VFVideoCaptureMode.IPPreview;
                }

                VideoCapture1.Audio_PlayAudio   = false;
                VideoCapture1.Audio_RecordAudio = false;

                VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRendererWPF.WPF;

                VideoCapture1.Start();

                lbStatus.Content = "Step 4: Getting data";

                pbProgress.Value = 0;

                lvResults.Items.Refresh();

                btStart.IsEnabled = true;
                btStart.Content   = "Stop";
            }
        }
예제 #9
0
        private void btStart_Click(object sender, RoutedEventArgs e)
        {
            if ((string)btStart.Content == "Stop")
            {
                VideoCapture1.Stop();

                btStart.Content = "Start";

                lbStatus.Content = string.Empty;
            }
            else
            {
                btStart.IsEnabled = false;

                lbStatus.Content = "Step 1: Searching video files";

                fragmentDuration = Convert.ToInt32(edFragmentDuration.Text) * 60 * 1000;

                VFMediaPlayerSource engine = VFMediaPlayerSource.File_VLC;

                switch (cbEngine.SelectedIndex)
                {
                case 0:
                    engine = VFMediaPlayerSource.File_DS;
                    break;

                case 1:
                    engine = VFMediaPlayerSource.File_FFMPEG;
                    break;

                case 2:
                    engine = VFMediaPlayerSource.File_VLC;
                    break;

                case 3:
                    engine = VFMediaPlayerSource.LAV;
                    break;
                }

                List <string> adList = new List <string>();

                adVFPList = new List <VFPFingerPrint>();

                foreach (string item in lbAdFolders.Items)
                {
                    adList.AddRange(FileScanner.SearchVideoInFolder(item));
                }

                lbStatus.Content = "Step 2: Getting fingerprints for ads files";

                int progress = 0;
                foreach (string filename in adList)
                {
                    pbProgress.Value = progress;
                    string error;

                    var source = new VFPFingerprintSource(filename, engine);
                    var fp     = VFPAnalyzer.GetSearchFingerprintForVideoFile(source, out error);

                    if (fp == null)
                    {
                        MessageBox.Show("Unable to get fingerpring for video file: " + filename + ". Error: " + error);
                    }
                    else
                    {
                        adVFPList.Add(fp);
                    }

                    progress += 100 / adList.Count;
                }

                pbProgress.Value = 100;

                searchLiveData = new VFPSearchData(Convert.ToInt32(edFragmentDuration.Text) * 60);
                if (tempBuffer != IntPtr.Zero)
                {
                    Marshal.FreeCoTaskMem(tempBuffer);
                    tempBuffer = IntPtr.Zero;
                }

                lbStatus.Content = "Step 3: Starting video preview";

                VideoCapture1.Video_CaptureDevice         = cbVideoSource.Text;
                VideoCapture1.Video_CaptureFormat         = cbVideoFormat.Text;
                VideoCapture1.Video_CaptureFormat_UseBest = false;
                VideoCapture1.Video_FrameRate             = Convert.ToDouble(cbVideoFrameRate.Text);
                VideoCapture1.Audio_PlayAudio             = false;
                VideoCapture1.Audio_RecordAudio           = false;
                VideoCapture1.Mode = VFVideoCaptureMode.VideoPreview;
                VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRendererWPF.WPF;

                VideoCapture1.Start();

                lbStatus.Content = "Step 4: Getting data";

                pbProgress.Value = 0;

                lvResults.Items.Refresh();

                btStart.IsEnabled = true;
                btStart.Content   = "Stop";
            }
        }