public static void UnloadVideoFile()
 {
     VideoImaging = null;
     Parameters   = null;
     MotionData   = null;
     UpdateAllControll();
 }
        public static void LampAnalyze(IEnumerable <string> selectedlist)
        {
            foreach (string videofile in selectedlist)
            {
                VideoImaging vi = VideoImaging.Load(videofile);
                if (vi == null)
                {
                    continue;
                }
                VideoImaging = vi;

                Parameters para = Parameters.LoadOrCreate(videofile, vi, true);
                if (para == null)
                {
                    continue;
                }
                Parameters = para;

                MotionData md = vi.AnalizeAll(para);
                if (md == null)
                {
                    continue;
                }
                MotionData = md;

                md.SaveRawData(videofile);
            }
            UnloadVideoFile();
        }
 public static void InitFormsAndShow(MainForm parent)
 {
     foreach (var f in ChildForm)
     {
         (f.Value as Form).MdiParent = parent;
         (f.Value as Form).Show();
     }
     VideoImaging = null;
     MotionData   = null;
     UpdateAllControll();
 }
 public static void AnalyzeAllFrames()
 {
     Parameters.Save();
     MotionData = VideoImaging.AnalizeAll(Parameters);
     if (MotionData != null)
     {
         MotionData.SaveRawData(Parameters.VideoFile);
         GraphForm.LoadData(MotionData);
     }
     UpdateAllControll();
     ControllerForm.SwitchTab();
 }
        public static bool AskPurgeMotionData()
        {
            bool result = DialogResult.Yes == MessageBox.Show(
                "解析の条件を変更するには解析結果を破棄するする必要があります。"
                + System.Environment.NewLine + "解析結果を破棄しますか?",
                "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result)
            {
                MotionData.Purge();
                MotionData = null;
            }
            return(result);
        }
Ejemplo n.º 6
0
        public MotionData AnalizeAll(Parameters para)
        {
            string     targetDir = Settings.TargetDir(para.VideoFile);
            MotionData md        = new MotionData();

            Action <object, DoWorkEventArgs> ProgressDialogDoWork = (sender, e) => {
                using (VideoWriter writer = new VideoWriter(Settings.DetectVideoname(para.VideoFile),
                                                            FourCC.MPG4, 30, output3.Size())) {
                    var bw  = sender as BackgroundWorker;
                    int num = para.EndFrame - para.StartFrame + 1;
                    for (int t = para.StartFrame; t < para.EndFrame; t++)
                    {
                        PosFrames = t;
                        var contour = GetContour(para);
                        if (contour != null)
                        {
                            TXYW txyw = DrawToOutput(contour, para);
                            md.AddRawData(txyw);
                        }
                        writer.Write(output3);
                        if (bw.CancellationPending)
                        {
                            e.Cancel = true;
                            break;
                        }
                        string message = string.Format("{0}/{1}", t - para.StartFrame, num);
                        bw.ReportProgress((int)((t - para.StartFrame) * 100 / num), message);
                    }
                    if (!e.Cancel)
                    {
                        md.UpdatePlotData();
                    }
                    writer.Release();
                }
            };

            ProgressDialog pd     = new ProgressDialog($"解析中:{para.VideoFile}", new DoWorkEventHandler(ProgressDialogDoWork));
            DialogResult   result = pd.ShowDialog();

            return(result == DialogResult.OK ? md : null);
        }
 public static void LoadVideoFile(string videoFile)
 {
     VideoImaging = VideoImaging.Load(videoFile);
     if (VideoImaging == null)
     {
         Parameters = null;
         MotionData = null;
     }
     else
     {
         Parameters = Parameters.LoadOrCreate(videoFile, VideoImaging);
         MotionData = MotionData.TryLoadRawData(videoFile, Parameters);
         ImageForm.LoadVideo(VideoImaging, Parameters.StartFrame);
         if (MotionData != null)
         {
             GraphForm.LoadData(MotionData);
         }
     }
     UpdateAllControll();
     ControllerForm.SwitchTab();
 }
Ejemplo n.º 8
0
        public static MotionData TryLoadRawData(string videoFile, Parameters parameters)
        {
            string file = Settings.RawDataname(videoFile);

            if (File.Exists(file))
            {
                MotionData md = new MotionData();
                md.parameters = parameters;
                using (var sr = new StreamReader(file)) {
                    sr.ReadLine();
                    while (!sr.EndOfStream)
                    {
                        md.AddRawData(TXYW.FromStr(sr.ReadLine()));
                    }
                }
                return(md);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 9
0
 public void LoadData(MotionData motionData)
 {
     motions.Clear();
     motions.Add(motionData);
     UpdateCtrl();
 }