private void getKeyFramesInGivenVideoClipOlympic(string videoPathName, int startPosition, int endPosition)
        {
            string path = GlobalValues.FilesPath + @"\task\WPFInk材料\程序截图\加菲猫草图视频摘要\VideoTime.txt";
            int minIndex = 1;
            int maxIndex = 8;
            List<int> videoTimeList = new List<int>();
            if (File.Exists(path))
            {
                using (StreamReader sr = new StreamReader(path, System.Text.Encoding.Default))
                {
                    string s = "";
                    //int index = 1;
                    while ((s = sr.ReadLine()) != null)
                    {
                        string[] line = s.Split(' ');
                        videoTimeList.Add(Int32.Parse(line[1]));
                    }
                }
            }

            for (int i = minIndex; i < maxIndex; i++)
            {
                //_videoAnnotation.addKeyFrameButton(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\task\WPFInk材料\程序截图\加菲猫草图视频摘要\" + i + ".png"),
                //    videoTimeList[i - 1]);
                _videoAnnotation.addKeyFrameButton(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\task\WPFInk材料\程序截图\加菲猫草图视频摘要\" + i + ".png"),
                    videoTimeList[i - 1]);
            }
        }
Esempio n. 2
0
        public KeyFrame convertToNewKeyFrame()
        {
            KeyFrame keyFrame = new KeyFrame(this.videoName, this.imageName, this.time);

            keyFrame.Image = InkConstants.getImageFromName(this.imageName);
            return(keyFrame);
        }
Esempio n. 3
0
        //插入图片
        private void insertImage_Click(object sender, RoutedEventArgs e)
        {
            _inkFrame.InkCollector.InkCanvas.EditingMode = InkCanvasEditingMode.None;
            //打开图片选择框
            OpenFileDialog openfile = new OpenFileDialog()
            {
                Filter      = "Jpeg Files (*.jpg)|*.jpg|Bitmap files (*.bmp)|*.bmp|All Files(*.*)|*.*",
                Multiselect = true
            };

            if (openfile.ShowDialog() == DialogResult.OK)
            {
                string  FileName     = openfile.FileName;
                string  SafeFileName = openfile.SafeFileName;
                MyImage newimage     = new MyImage(FileName);
                newimage.SafeFileName = SafeFileName;
                InkConstants.AddBound(newimage);
                AddImageCommand cmd = new AddImageCommand(_inkFrame.InkCollector, newimage);
                cmd.execute();
                _inkFrame.InkCollector.CommandStack.Push(cmd);
                _inkFrame.pointView.pointView.AddNode(_inkFrame.pointView.pointView.nodeList, _inkFrame.pointView.pointView.links);
            }
            this.Height       = GlobalValues.ControlPanel_OtherModeHeight;
            InkCollector.Mode = InkMode.AutoMove;
        }
Esempio n. 4
0
 public void undo()
 {
     myButton.Width  *= 1 / scaling;
     myButton.Height *= 1 / scaling;
     InkConstants.InkCanvasTransform(myButton.InkFrame._inkCanvas, 1, 1, _prescaling, _prescaling);
     myButton.updateArrow(_inkCanvas, _inkCollector);
     myButton.updateRectangles(_inkCanvas, _inkCollector);
 }
        /// <summary>
        /// 关键帧原帧toImage
        /// </summary>
        /// <param name="images"></param>
        /// <param name="i"></param>
        /// <returns></returns>
        public static Image KeyFrameToImage(KeyFrame keyFrame)
        {
            Image image = InkConstants.getImageFromName(keyFrame.ImageName);

            image.Width  = 120;
            image.Height = 80;
            return(image);
        }
Esempio n. 6
0
 public void execute()
 {
     myButton.Width  *= scaling;
     myButton.Height *= scaling;
     InkConstants.InkCanvasTransform(myButton.InkFrame._inkCanvas, 1, 1, myButton.Width / myButton.InkFrame.Width, myButton.Height / myButton.InkFrame.Height);
     myButton.updateArrow(_inkCanvas, _inkCollector);
     myButton.updateRectangles(_inkCanvas, _inkCollector);
 }
Esempio n. 7
0
        //导入草图方法
        public void LoadSketch(List <System.Drawing.Bitmap> BitmapList, List <Point> points, int width, int height)
        {
            List <BitmapImage> bmpList = new List <BitmapImage>();
            int i = 0;

            foreach (System.Drawing.Bitmap bit in BitmapList)
            {
                bmpList.Add(WPFInk.tool.ConvertClass.getInstance().BitmapToBitmapImage(bit));
            }



            int    j;
            string pathName = GlobalValues.FilesPath + "//WPFink/0.bmp";

            BitmapList[0].Save(pathName);
            MyImage preMyImage = new MyImage(pathName);
            MyImage MyImage0   = preMyImage;

            preMyImage.Width    = width;
            preMyImage.Height   = height;
            preMyImage.Left     = points[0].X;
            preMyImage.Top      = points[0].Y;
            preMyImage.PathName = pathName;
            preMyImage.setLocation((int)points[0].X, (int)points[0].Y);
            InkConstants.AddBound(preMyImage);

            AddImageCommand cmd = new AddImageCommand(InkCollector, preMyImage);

            cmd.execute();
            ImageConnector connector = null;

            for (i = 0; i < bmpList.Count - 1; i++)
            {
                j        = i + 1;
                pathName = GlobalValues.FilesPath + "//WPFink/" + j + ".bmp";

                BitmapList[j].Save(pathName);
                MyImage newimage = new MyImage(pathName);
                newimage.Width  = width;
                newimage.Height = height;
                newimage.setLocation((int)points[j].X, (int)points[j].Y);
                newimage.Left     = points[j].X;
                newimage.Top      = points[j].Y;
                newimage.PathName = pathName;
                InkConstants.AddBound(newimage);
                AddImageCommand cmd2 = new AddImageCommand(InkCollector, newimage);
                cmd2.execute();
                connector  = new ImageConnector(preMyImage, newimage);
                preMyImage = newimage;
                MyStroke myStroke = connector.MYSTROKE;
                myStroke.Stroke.DrawingAttributes.Width  = 4;
                myStroke.Stroke.DrawingAttributes.Height = 4;
                myStroke.IsSketchConnector = true;
                Command sc = new AddStrokeCommand(InkCollector, myStroke);
                sc.execute();
            }
        }
Esempio n. 8
0
        private void radioButton_3_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            _thumbInk.Thumb_InkFrame._inkCanvas.Children.Clear();
            _thumbInk.Thumb_InkFrame._inkCanvas.Strokes.Clear();

            Image image = InkConstants.getImageFromName(@"E:\task\WPFInk材料\程序截图\加菲猫草图视频摘要\summarization.png");

            image.Width  = _thumbInk.ActualWidth - 100;
            image.Height = _thumbInk.ActualHeight - 10;
            image.Margin = new Thickness((_thumbInk.ActualWidth - image.Width) / 2, 2, 0, 0);
            _thumbInk.Thumb_InkFrame._inkCanvas.Children.Add(image);
        }
Esempio n. 9
0
 private void radioButton_2_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     _thumbInk.Thumb_InkFrame._inkCanvas.Children.Clear();
     _thumbInk.Thumb_InkFrame._inkCanvas.Strokes.Clear();
     for (int i = 1; i < 8; i++)
     {
         Image image = InkConstants.getImageFromName(@"E:\task\WPFInk材料\程序截图\加菲猫草图视频摘要\" + i + ".png");
         image.Width  = 125;
         image.Height = 80;
         image.Margin = new Thickness((i - 1) * 135 + 30, 20, 0, 0);
         _thumbInk.Thumb_InkFrame._inkCanvas.Children.Add(image);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="_inkCanvas">摘要所在画布</param>
        /// <param name="keyframes">摘要包含的关键帧</param>
        /// <param name="center">摘要的左上角点的坐标</param>

        public TileSummarization(InkCanvas _inkCanvas, List <KeyFrame> keyframes, StylusPoint center, bool isShowHalf)
            : base(null, 0, keyframes, _inkCanvas)
        {
            try
            {
                this.initionTimer();

                ShowWidth                 = 150;
                keyFrames[0].Image        = InkConstants.getImageFromName(keyframes[0].ImageName);
                showHeight                = ShowWidth * keyFrames[0].Image.Height / keyFrames[0].Image.Width;
                keyFrames[0].Image.Width  = ShowWidth;
                keyFrames[0].Image.Height = ShowHeight;
                for (int i = 1; i < keyFrames.Count; i++)
                {
                    keyFrames[i].Image = InkConstants.getImageFromName(keyframes[i].ImageName);

                    //MathTool.resizeImage(keyFrames[i], 150, 100);
                    keyFrames[i].Image.Width  = ShowWidth;
                    keyFrames[i].Image.Height = ShowHeight;
                }
                this.top        = (int)center.Y;
                this.left       = (int)center.X;
                this.Center     = center;
                this.fusePixel  = (int)(showWidth * 0.1);
                this.isShowHalf = isShowHalf;
                //scrollViewer.Width = InkCanvas.Width;
                //scrollViewer.Height = InkCanvas.Height;
                //InkCanvas.Children.Add(scrollViewer);
                //scrollViewer.Content = localInkCanvas;
                System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                sw.Reset();
                sw.Start();
                addImages2Track();
                sw.Stop();
                Console.WriteLine("tile总需要时间:" + sw.ElapsedMilliseconds + "ms");
                GC.Collect();
                rowWidth = Convert.ToInt32(left + (showWidth - fusePixel) * countInrow);
                drawLine();
            }
            catch
            {
                MessageBox.Show("TileSummarization构造失败!");
            }
        }
Esempio n. 11
0
 public TapestrySummarization(InkCanvas _inkCanvas, List <KeyFrame> keyframes)
     : base(null, 0, keyframes, _inkCanvas)
 {
     for (int i = 0; i < keyFrames.Count; i++)
     {
         keyFrames[i].Image = InkConstants.getImageFromName(keyframes[i].ImageName);
         showWidth          = 150;
         showHeight         = 100;
         MathTool.getInstance().resizeImage(keyFrames[i], showWidth, showHeight);
     }
     firstLineTop  = 0;
     secondLineTop = firstLineTop + showHeight - fuseTopBottom / 2;
     System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
     sw.Reset();
     sw.Start();
     addImages2Track();
     sw.Stop();
     Console.WriteLine("Tapestry总需要时间:" + sw.ElapsedMilliseconds + "ms");
     GC.Collect();
     this.width = 13 * (showWidth - fuseLeftRight) + fuseLeftRight;
 }
Esempio n. 12
0
        private void addImage(string name, Thickness margin, InkCanvas inkCanvas)
        {
            BitmapImage bitmapImage = new BitmapImage(new Uri("pack://siteoforigin:,,,/images/" + name + ".jpg", UriKind.RelativeOrAbsolute));
            Image       image       = new Image();

            image.Source = bitmapImage;
            image.Width  = bitmapImage.Width;
            image.Height = bitmapImage.Height;
            image.Margin = margin;
            MyImage myImage = new MyImage(image);

            myImage.Left   = image.Margin.Left;
            myImage.Top    = image.Margin.Top;
            myImage.Height = image.Height;
            myImage.Width  = image.Width;
            InkConstants.AddBound(myImage);
            Command aic = new AddImageCommand(_inkFrame.InkCollector, myImage);

            aic.execute();
            _inkFrame.InkCollector.CommandStack.Push(aic);
        }
Esempio n. 13
0
        void TitleInk_MouseUp(object sender, MouseButtonEventArgs e)
        {
            Title_InkFrame.InkCollector.Sketch.Images[3].Bound.Visibility = Visibility.Collapsed;
            Image image = InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\pentagram.png");

            image.Width      = 60;
            image.Height     = 60;
            image.Visibility = Visibility.Collapsed;
            image.Margin     = new Thickness(_videoOperation._videoAnnotation.Annotation_InkFrame.ActualWidth / 2 - 30,
                                             _videoOperation._videoAnnotation.Annotation_InkFrame.ActualHeight / 2 - 30, 0, 0);
            MyImage newimage = new MyImage(image);

            newimage.Left = 240;
            newimage.Top  = 240;
            InkConstants.AddBound(newimage);
            AddImageCommand cmd = new AddImageCommand(_videoOperation._videoAnnotation.Annotation_InkFrame.InkCollector, newimage);

            cmd.execute();
            _videoOperation._videoAnnotation.Annotation_InkFrame.InkCollector.CommandStack.Push(cmd);

            Image image2 = InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\pentagramRed.png");

            image2.Width  = 60;
            image2.Height = 60;
            image2.Margin = new Thickness(_videoOperation._videoAnnotation.Annotation_InkFrame.ActualWidth / 2 - 30,
                                          _videoOperation._videoAnnotation.Annotation_InkFrame.ActualHeight / 2 - 30, 0, 0);
            MyImage newimage2 = new MyImage(image2);

            newimage2.Left = 240;
            newimage2.Top  = 240;
            InkConstants.AddBound(newimage2);
            AddImageCommand cmd2 = new AddImageCommand(_videoOperation._videoAnnotation.Annotation_InkFrame.InkCollector, newimage2);

            cmd2.execute();
            _videoOperation._videoAnnotation.Annotation_InkFrame.InkCollector.CommandStack.Push(cmd2);
        }
 public override void _presenter_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
 {
     if (this.VideoSummarizationControl == null)
     {
         this.VideoSummarizationControl = _inkCollector._mainPage.VideoSummarizationControl;
     }
     if (_startPoint.X == 0 && _startPoint.Y == 0)
     {
         _currPoint    = e.GetPosition(_inkCanvas);
         _currPoint.X -= inkCanvasSpiralSummarizationMargin.Left;
         _currPoint.Y -= inkCanvasSpiralSummarizationMargin.Top;
         currIndex     = videoSummarization.getSelectedKeyFrameIndex(_currPoint);
         //记录操作类型与持续时间
         recordOperateTrace("MOVE");
         if (currIndex != int.MinValue && currIndex != preIndex && _inkCollector.IsShowUnbrokenKeyFrame)
         {
             moveTimerSecond = 0;
             MoveTimer.Start();
             clearPreMessage();
             currIndex = currIndex >= videoSummarization.ShowKeyFrames.Count ? videoSummarization.ShowKeyFrames.Count - 1 : currIndex;
             currIndex = (currIndex == -1 ? 0 : currIndex);
             Image currImage = InkConstants.getImageFromName(videoSummarization.ShowKeyFrames[currIndex].ImageName);
             currImage.Width  = 300;
             currImage.Height = 200;
             currImage.Margin = new Thickness((VideoSummarizationControl.summarization._inkCanvas.ActualWidth - currImage.Width) / 2,
                                              200, 0, 0);
             tapestrySummarization.ParentInkcanvas.Children.Add(currImage);
             preImage = currImage;
             preIndex = currIndex;
         }
         else if (currIndex == int.MinValue)
         {
             if (preImage != null)
             {
                 _inkCanvas.Children.Remove(preImage);
             }
             moveTimerSecond = 0;
         }
         //显示移动轨迹
         if (moveStroke != null)
         {
             moveStroke.StylusPoints.Add(new StylusPoint(_currPoint.X, _currPoint.Y));
             if (moveStroke.StylusPoints.Count > 300)
             {
                 moveStroke.StylusPoints.RemoveAt(0);
             }
         }
         else
         {
             StylusPointCollection spc = new StylusPointCollection();
             spc.Add(new StylusPoint(_currPoint.X, _currPoint.Y));
             moveStroke = new Stroke(spc);
             moveStroke.DrawingAttributes.Color  = Colors.Transparent;
             moveStroke.DrawingAttributes.Width  = 3;
             moveStroke.DrawingAttributes.Height = 3;
             _inkCanvas.Strokes.Add(moveStroke);
         }
     }
     else
     {
         _currPoint = e.GetPosition(_inkCanvas);
         if (startIndex != int.MinValue && _currPoint.X > 0)
         {
             left = videoSummarization.InkCanvas.Margin.Left + _currPoint.X - _prePoint.X;
             //if (left <= 0 && left >VideoSummarizationControl.summarization._inkCanvas.ActualWidth -tapestrySummarization.Width  )
             //{
             videoSummarization.InkCanvas.Margin = new Thickness(left,
                                                                 videoSummarization.InkCanvas.Margin.Top, 0, 0);
             //}
             if (left > 0)
             {
                 left = 0;
                 timebar.Show_EndTime = VideoSummarizationControl.summarization._inkCanvas.ActualWidth - videoSummarization.InkCanvas.Margin.Left;
             }
             else if (left < -tapestrySummarization.Width + VideoSummarizationControl.summarization._inkCanvas.ActualWidth)
             {
                 left = videoSummarization.InkCanvas.Margin.Left;
                 timebar.Show_EndTime = -left + tapestrySummarization.Width + videoSummarization.InkCanvas.Margin.Left;
             }
             else
             {
                 timebar.Show_EndTime = -left + VideoSummarizationControl.summarization._inkCanvas.ActualWidth;
             }
             timebar.Show_StartTime = -left;
             // timebar.Show_EndTime = -left + VideoSummarizationControl.summarization._inkCanvas.ActualWidth;
             timebar.computeLocation();
             _prePoint = _currPoint;
         }
         if (startIndex == int.MinValue && mouseGesture != null)
         {
             mouseGesture.Capturing((int)_currPoint.X, (int)_currPoint.Y);
         }
         //记录操作类型与持续时间
         recordOperateTrace("MOVE");
     }
 }
Esempio n. 15
0
        public override void addImages2Track()
        {
            double j = 1;
            double k = 0;

            if (isShowHalf)
            {
                for (int i = 0; i <= keyFrames.Count - 1; i++)
                {
                    Image image = keyFrames[i].Image;
                    if (j == countInrow)
                    {
                        j = 0;
                        k++;
                    }
                    if (0 == i)  //处理第一个关键帧
                    {
                        point = new Point(left, top + k * ShowHeight + 2);
                        showKeyFrames.Add(keyFrames[i]);
                        keyFrames[i].Level           = true;
                        keyFrames[i].IsVisibleInTile = true;
                        showKeyFrames[showKeyFrames.Count - 1].ID = i;
                    }
                    else  //处理后续的关键帧
                    {
                        if (0 == j)
                        {
                            point = new Point(left, top + k * ShowHeight + 2);
                            if (0 == i % 2)
                            {
                                j++;
                                showKeyFrames.Add(keyFrames[i]);
                                showKeyFrames[showKeyFrames.Count - 1].ID = i;
                                keyFrames[i].Level           = true;
                                keyFrames[i].IsVisibleInTile = true;
                            }
                            else
                            {
                                keyFrames[i].Image.Visibility = Visibility.Hidden;
                            }
                        }
                        else
                        {
                            if (1 == i % 2)
                            {
                                point = new Point(keyFrames[i - 1].Image.Margin.Left + ShowWidth - fusePixel, keyFrames[i - 1].Image.Margin.Top);
                                keyFrames[i].Image.Visibility = Visibility.Hidden;
                            }
                            else
                            {
                                point = new Point(keyFrames[i - 1].Image.Margin.Left, keyFrames[i - 1].Image.Margin.Top);
                                j++;
                                showKeyFrames.Add(keyFrames[i]);
                                showKeyFrames[showKeyFrames.Count - 1].ID = i;
                                keyFrames[i].Level           = true;
                                keyFrames[i].IsVisibleInTile = true;
                            }
                        }
                    }


                    ///<start> 为每一帧创建一个备份,以用于动画效果
                    Image imageCounterPart = InkConstants.getImageFromName(keyFrames[i].ImageName);
                    keyFrames[i].CounterPartImage        = imageCounterPart;
                    keyFrames[i].CounterPartImage.Width  = showWidth;
                    keyFrames[i].CounterPartImage.Height = showHeight;
                    //keyFrames[i].CounterPartImage.Visibility = Visibility.Hidden;


                    InkCanvas.Children.Add(keyFrames[i].CounterPartImage);
                    InkCanvas.Children.Add(keyFrames[i].Image);

                    ///<end>
                    image.Margin = new Thickness(point.X, point.Y, 0, 0);
                    //if (j != 0)
                    fuseImages(i);
                    keyFrames[i].CounterPartImage.Visibility = Visibility.Hidden;

                    //lines.Add(InkTool.getInstance().DrawLine(point.X, keyFrames[i].Image.Height + point.Y - 2, keyFrames[i].Image.Width + point.X, keyFrames[i].Image.Height + point.Y - 2, localInkCanvas, Colors.Yellow));
                    //keyFrames[i].Line.Add(InkTool.getInstance().DrawLine(keyFrames[i].Image.Margin.Left, keyFrames[i].Image.Height + keyFrames[i].Image.Margin.Top - 2,
                    //    keyFrames[i].Image.Width + keyFrames[i].Image.Margin.Left, keyFrames[i].Image.Height + keyFrames[i].Image.Margin.Top - 2, localInkCanvas, Colors.Yellow));
                    StylusPoint stylusPoint = new StylusPoint(point.X + 50, point.Y + 29);
                    keyPoints.Add(stylusPoint);
                }
                if (0 == keyFrames.Count % 2)
                {
                    keyFrames[keyFrames.Count - 1].IsVisibleInTile  = true;
                    keyFrames[keyFrames.Count - 1].Image.Visibility = Visibility.Visible;
                    showKeyFrames.Add(keyFrames[keyFrames.Count - 1]);
                }
            }
            else
            {
                j = 0;
                for (int i = 0; i <= keyFrames.Count - 1; i++)
                {
                    Image image = keyFrames[i].Image;
                    if (j >= countInrow)
                    {
                        j = 0; ++k;
                    }
                    if (j == 0)
                    {
                        point = new Point(left, top + k * ShowHeight + 2);
                    }
                    else
                    {
                        point = new Point(keyFrames[i - 1].Image.Margin.Left + ShowWidth - fusePixel, keyFrames[i - 1].Image.Margin.Top);
                    }

                    image.Margin = new Thickness(point.X, point.Y, 0, 0);
                    //if (j != 0)
                    fuseImages(i);
                    InkCanvas.Children.Add(keyFrames[i].Image);
                    //lines.Add(InkTool.getInstance().DrawLine(point.X, keyFrames[i].Image.Height + point.Y - 2, keyFrames[i].Image.Width + point.X, keyFrames[i].Image.Height + point.Y - 2, localInkCanvas, Colors.Black));
                    j++;
                    StylusPoint stylusPoint = new StylusPoint(point.X + 50, point.Y + 29);
                    keyPoints.Add(stylusPoint);
                    showKeyFrames.Add(keyFrames[i]);
                }
            }
        }
Esempio n. 16
0
        private void loadSketchBook()
        {
            TextBox tb = new TextBox();

            tb.Text            = "Symbol";
            tb.Margin          = new Thickness(10, 10, 0, 0);
            tb.BorderThickness = new Thickness(0);
            Title_InkFrame._inkCanvas.Children.Add(tb);
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\bad.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\good.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\music.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\pentagram.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\triangle.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\Malesymbol.png"));

            TextBox tb2 = new TextBox();

            tb2.Text            = "Motion";
            tb2.Margin          = new Thickness(10, 120, 0, 0);
            tb2.BorderThickness = new Thickness(0);
            Title_InkFrame._inkCanvas.Children.Add(tb2);
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\crash.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\localMove.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\move2.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\move1.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\ray.png"));


            TextBox tb3 = new TextBox();

            tb3.Text            = "Human";
            tb3.Margin          = new Thickness(10, 220, 0, 0);
            tb3.BorderThickness = new Thickness(0);
            Title_InkFrame._inkCanvas.Children.Add(tb3);
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\skiing2.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\skiing1.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\people3.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\people2.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\people1.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\man1.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\Horse_boy_girl.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\girl7.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\girl6.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\girl5.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\girl4.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\girl3.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\girl2.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\girl1.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\Girl_on_horse.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\boygirl.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\boy7.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\boy6.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\boy5.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\boy4.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\boy3.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\boy2.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\boy1.png"));


            //TextBox tb4 = new TextBox();
            //tb4.Text = "Motion";
            //tb4.Margin = new Thickness(10, 10, 0, 0);
            //tb4.BorderThickness = new Thickness(0);
            //Title_InkFrame._inkCanvas.Children.Add(tb4);



            TextBox tb5 = new TextBox();

            tb5.Text            = "Animal";
            tb5.Margin          = new Thickness(10, 580, 0, 0);
            tb5.BorderThickness = new Thickness(0);
            Title_InkFrame._inkCanvas.Children.Add(tb5);
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\horse9.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\horse8.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\horse7.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\horse6.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\horse5.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\horse4.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\horse3.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\horse2.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\horse1.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\hen.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\dog6.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\dog5.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\dog4.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\dog3.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\dog2.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\dog1.png"));
            images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\cloud2.png"));



            //TextBox tb6 = new TextBox();
            //tb6.Text = "Bird";
            //tb6.Margin = new Thickness(10, 10, 0, 0);
            //tb6.BorderThickness = new Thickness(0);
            //Title_InkFrame._inkCanvas.Children.Add(tb6);
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\bird4.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\bird3.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\bird2.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\bird1.png"));

            //TextBox tb7 = new TextBox();
            //tb7.Text = "Boat";
            //tb7.Margin = new Thickness(10, 10, 0, 0);
            //tb7.BorderThickness = new Thickness(0);
            //Title_InkFrame._inkCanvas.Children.Add(tb7);
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\boat2.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\boat1.png"));

            //TextBox tb8 = new TextBox();
            //tb8.Text = "Building";
            //tb8.Margin = new Thickness(10, 10, 0, 0);
            //tb8.BorderThickness = new Thickness(0);
            //Title_InkFrame._inkCanvas.Children.Add(tb8);
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\building3.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\building2.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\building1.png"));

            //TextBox tb9 = new TextBox();
            //tb9.Text = "Emotion";
            //tb9.Margin = new Thickness(10, 10, 0, 0);
            //tb9.BorderThickness = new Thickness(0);
            //Title_InkFrame._inkCanvas.Children.Add(tb9);
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\smilingface.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\question mark.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\Exclamation Mark.png"));

            //TextBox tb10 = new TextBox();
            //tb10.Text = "Scene";
            //tb10.Margin = new Thickness(10, 10, 0, 0);
            //tb10.BorderThickness = new Thickness(0);
            //Title_InkFrame._inkCanvas.Children.Add(tb10);
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\sun.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\moon.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\cloud1.png"));

            //TextBox tb11 = new TextBox();
            //tb11.Text = "Olympic";
            //tb11.Margin = new Thickness(10, 10, 0, 0);
            //tb11.BorderThickness = new Thickness(0);
            //Title_InkFrame._inkCanvas.Children.Add(tb11);
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\tower.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\pavilion.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\oly.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\lake.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\hill.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\birdnest.png"));

            //TextBox tb12 = new TextBox();
            //tb12.Text = "Flower";
            //tb12.Margin = new Thickness(10, 10, 0, 0);
            //tb12.BorderThickness = new Thickness(0);
            //Title_InkFrame._inkCanvas.Children.Add(tb12);
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\flower8.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\flower7.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\flower6.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\flower5.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\flower4.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\flower3.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\flower2.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\flower1.png"));

            //TextBox tb13 = new TextBox();
            //tb13.Text = "Other";
            //tb13.Margin = new Thickness(10, 10, 0, 0);
            //tb13.BorderThickness = new Thickness(0);
            //Title_InkFrame._inkCanvas.Children.Add(tb13);
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\whale.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\water.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\tree1.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\table1.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\strawberry.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\road1.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\plane1.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\mountain1.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\car1.png"));
            //images.Add(InkConstants.getImageFromName(GlobalValues.FilesPath + @"\WPFInkResource\sketchBook\bag.png"));


            images[3].MouseDown += new MouseButtonEventHandler(TitleInk_MouseDown);
            images[3].MouseUp   += new MouseButtonEventHandler(TitleInk_MouseUp);
            int count = images.Count;
            int i     = 0;

            for (i = 0; i < 6; i++)
            {
                images[i].Width  = sketchWidth;
                images[i].Height = sketchHeight;

                images[i].VerticalAlignment   = VerticalAlignment.Top;
                images[i].HorizontalAlignment = HorizontalAlignment.Left;
                images[i].Margin = new Thickness(i % sketchCountPerRow * sketchWidth + HorizontalInterval,
                                                 20 + VerticalInterval, 0, 0);
                MyImage newimage = new MyImage(images[i]);
                newimage.Left = images[i].Margin.Left;
                newimage.Top  = images[i].Margin.Top;
                InkConstants.AddBound(newimage);
                AddImageCommand cmd = new AddImageCommand(Title_InkFrame.InkCollector, newimage);
                cmd.execute();
                Title_InkFrame.InkCollector.CommandStack.Push(cmd);
            }
            for (i = 6; i < 11; i++)
            {
                images[i].Width  = sketchWidth;
                images[i].Height = sketchHeight;

                images[i].VerticalAlignment   = VerticalAlignment.Top;
                images[i].HorizontalAlignment = HorizontalAlignment.Left;
                images[i].Margin = new Thickness((i - 6) % sketchCountPerRow * sketchWidth + HorizontalInterval,
                                                 130 + VerticalInterval, 0, 0);
                MyImage newimage = new MyImage(images[i]);
                newimage.Left = images[i].Margin.Left;
                newimage.Top  = images[i].Margin.Top;
                InkConstants.AddBound(newimage);
                AddImageCommand cmd = new AddImageCommand(Title_InkFrame.InkCollector, newimage);
                cmd.execute();
                Title_InkFrame.InkCollector.CommandStack.Push(cmd);
            }
            for (i = 11; i < 34; i++)
            {
                images[i].Width  = sketchWidth;
                images[i].Height = sketchHeight;

                images[i].VerticalAlignment   = VerticalAlignment.Top;
                images[i].HorizontalAlignment = HorizontalAlignment.Left;
                images[i].Margin = new Thickness((i - 11) % sketchCountPerRow * sketchWidth + HorizontalInterval,
                                                 (i - 11) / sketchCountPerRow * sketchHeight + VerticalInterval + 240, 0, 0);
                MyImage newimage = new MyImage(images[i]);
                newimage.Left = images[i].Margin.Left;
                newimage.Top  = images[i].Margin.Top;
                InkConstants.AddBound(newimage);
                AddImageCommand cmd = new AddImageCommand(Title_InkFrame.InkCollector, newimage);
                cmd.execute();
                Title_InkFrame.InkCollector.CommandStack.Push(cmd);
            }
            for (i = 34; i < 51; i++)
            {
                images[i].Width  = sketchWidth;
                images[i].Height = sketchHeight;

                images[i].VerticalAlignment   = VerticalAlignment.Top;
                images[i].HorizontalAlignment = HorizontalAlignment.Left;
                images[i].Margin = new Thickness((i - 34) % sketchCountPerRow * sketchWidth + HorizontalInterval,
                                                 (i - 34) / sketchCountPerRow * sketchHeight + VerticalInterval + 580, 0, 0);
                MyImage newimage = new MyImage(images[i]);
                newimage.Left = images[i].Margin.Left;
                newimage.Top  = images[i].Margin.Top;
                InkConstants.AddBound(newimage);
                AddImageCommand cmd = new AddImageCommand(Title_InkFrame.InkCollector, newimage);
                cmd.execute();
                Title_InkFrame.InkCollector.CommandStack.Push(cmd);
            }
            //for (i = 0; i < 6; i++)
            //{
            //    images[i].Width = sketchWidth;
            //    images[i].Height = sketchHeight;

            //    images[i].VerticalAlignment = VerticalAlignment.Top;
            //    images[i].HorizontalAlignment = HorizontalAlignment.Left;
            //    images[i].Margin = new Thickness(i % sketchCountPerRow * sketchWidth + HorizontalInterval,
            //        i / sketchCountPerRow * sketchHeight + VerticalInterval, 0, 0);
            //    MyImage newimage = new MyImage(images[i]);
            //    newimage.Left = images[i].Margin.Left;
            //    newimage.Top = images[i].Margin.Top;
            //    InkConstants.AddBound(newimage);
            //    AddImageCommand cmd = new AddImageCommand(Title_InkFrame.InkCollector, newimage);
            //    cmd.execute();
            //    Title_InkFrame.InkCollector.CommandStack.Push(cmd);
            //}
            //for (i = 0; i < 6; i++)
            //{
            //    images[i].Width = sketchWidth;
            //    images[i].Height = sketchHeight;

            //    images[i].VerticalAlignment = VerticalAlignment.Top;
            //    images[i].HorizontalAlignment = HorizontalAlignment.Left;
            //    images[i].Margin = new Thickness(i % sketchCountPerRow * sketchWidth + HorizontalInterval,
            //        i / sketchCountPerRow * sketchHeight + VerticalInterval, 0, 0);
            //    MyImage newimage = new MyImage(images[i]);
            //    newimage.Left = images[i].Margin.Left;
            //    newimage.Top = images[i].Margin.Top;
            //    InkConstants.AddBound(newimage);
            //    AddImageCommand cmd = new AddImageCommand(Title_InkFrame.InkCollector, newimage);
            //    cmd.execute();
            //    Title_InkFrame.InkCollector.CommandStack.Push(cmd);
            //}
            //for (i = 0; i < 6; i++)
            //{
            //    images[i].Width = sketchWidth;
            //    images[i].Height = sketchHeight;

            //    images[i].VerticalAlignment = VerticalAlignment.Top;
            //    images[i].HorizontalAlignment = HorizontalAlignment.Left;
            //    images[i].Margin = new Thickness(i % sketchCountPerRow * sketchWidth + HorizontalInterval,
            //        i / sketchCountPerRow * sketchHeight + VerticalInterval, 0, 0);
            //    MyImage newimage = new MyImage(images[i]);
            //    newimage.Left = images[i].Margin.Left;
            //    newimage.Top = images[i].Margin.Top;
            //    InkConstants.AddBound(newimage);
            //    AddImageCommand cmd = new AddImageCommand(Title_InkFrame.InkCollector, newimage);
            //    cmd.execute();
            //    Title_InkFrame.InkCollector.CommandStack.Push(cmd);
            //}
            //for (i = 0; i < 6; i++)
            //{
            //    images[i].Width = sketchWidth;
            //    images[i].Height = sketchHeight;

            //    images[i].VerticalAlignment = VerticalAlignment.Top;
            //    images[i].HorizontalAlignment = HorizontalAlignment.Left;
            //    images[i].Margin = new Thickness(i % sketchCountPerRow * sketchWidth + HorizontalInterval,
            //        i / sketchCountPerRow * sketchHeight + VerticalInterval, 0, 0);
            //    MyImage newimage = new MyImage(images[i]);
            //    newimage.Left = images[i].Margin.Left;
            //    newimage.Top = images[i].Margin.Top;
            //    InkConstants.AddBound(newimage);
            //    AddImageCommand cmd = new AddImageCommand(Title_InkFrame.InkCollector, newimage);
            //    cmd.execute();
            //    Title_InkFrame.InkCollector.CommandStack.Push(cmd);
            //}
        }
        private void getKeyFramesInGivenVideoClip(string videoPathName,int startPosition,int endPosition)
        {
            /*
            ////实时提取关键帧,此段要永久保留
            //AVIReader reader = new AVIReader();
            //reader.Open(videoPathName);
            //int videoFramePerSecond = 24;
            //int position = (int)(((double)startPosition /1000)* videoFramePerSecond);
            //reader.Position = position;
            //System.Drawing.Bitmap curFrame = null;
            //System.Drawing.Bitmap nextFrame = null;
            //int frameCount = 0;
            //int[] curHist = null;
            //int[] lastHist = null;
            //List<Frame> keyFrameList = new List<Frame>();
            //List<int> keyFrameNoList = new List<int>();
            //int curpos = 0;
            //endPosition = (int)(((double)endPosition / 1000) * videoFramePerSecond);
            //System.Drawing.Bitmap resizedCurFrame;
            //double diff;
            //while (position < endPosition)
            //{
            //    curFrame = reader.GetNextFrame();
            //    nextFrame = reader.GetNextFrame();
            //    frameCount++;
            //    curpos = reader.CurrentPosition;
            //    if (null != curFrame)
            //    {
            //        // 取thumbnail去生成hist,但keyFrame里存的还是原来的bmp
            //        resizedCurFrame = new System.Drawing.Bitmap(curFrame.GetThumbnailImage(200, 200, null, IntPtr.Zero));
            //        curHist = WPFInk.ShotCut.Histogram.CalHSVHis(resizedCurFrame);
            //        if (null != lastHist)
            //        {
            //            diff = WPFInk.ShotCut.Histogram.CalHisDiff(curHist, lastHist);

            //            // 这里暂时取像素值的四分之一作为阈值
            //            if (diff > resizedCurFrame.Width * resizedCurFrame.Height * 0.25)
            //            {
            //                keyFrameList.Add(new Frame(curFrame, nextFrame, (int)((double)curpos - 1) * 1000 / videoFramePerSecond));
            //                keyFrameNoList.Add((int)(reader.CurrentPosition));
            //            }
            //            else if (curpos == 128 || curpos == 432 || curpos == 604 || curpos == 680 || curpos == 1216 || curpos == reader.Length - 1)
            //            {
            //                keyFrameList.Add(new Frame(curFrame, nextFrame, (int)((double)curpos - 1) * 1000 / videoFramePerSecond));
                            
            //                keyFrameNoList.Add((int)(reader.CurrentPosition));                            
            //            }                           
            //        }
            //    }
            //    lastHist = curHist;
            //    position++;
            //    resizedCurFrame = null;
            //    curFrame = null;
            //    nextFrame = null;

            //}
            ////过滤关键帧
            //int filterNo = 5;
            //while (keyFrameNoList.Count > filterNo)
            //{
            //    int min = int.MaxValue;
            //    int minindex = -1;
            //    for (int i = 1; i < keyFrameNoList.Count; i++)
            //    {
            //        if (keyFrameNoList[i] - keyFrameNoList[i - 1] < min &&
            //            !(i == 128 || i == 432 || i == 604 || i == 680 || i == 1216 || i == reader.Length - 1))
            //        {
            //            min = keyFrameNoList[i] - keyFrameNoList[i - 1];
            //            minindex = i - 1;
            //        }
            //    }
            //    if (minindex == -1)
            //        return;
            //    keyFrameNoList.RemoveAt(minindex);
            //    keyFrameList.RemoveAt(minindex);
            //    //keyFrameRecList.RemoveAt(minindex);
            //}
            ////保存关键帧
            //int count = 0;
            //foreach (Frame frame in keyFrameList)
            //{
            //    frame.frameBmp.Save(GlobalValues.FilesPath + @"\WPFInk\WPFInk\resource\CachekeyFrames\" + (++count) + ".png");
            //}
             * */
            string path = @"resource\"+GlobalValues.videoName+@"\time.txt";
            int minIndex = 0;
            int maxIndex=0;
            bool isFindMin=false;
            List<int> videoTimeList = new List<int>();
            if (File.Exists(path))
            {
                using (StreamReader sr = new StreamReader(path, System.Text.Encoding.Default))
                {
                    string s = "";
                    int index = 1;
                    while ((s = sr.ReadLine()) != null)
                    {
                        string[] line = s.Split(' ');
                        if(!isFindMin)
                        {
                            if (Int32.Parse(line[1]) > startPosition && Int32.Parse(line[1]) < endPosition)
                            {
                                minIndex=index;
                                videoTimeList.Add(Int32.Parse(line[1]));
                                isFindMin=true;
                            }
                        }
                        else
                        {
                            if (Int32.Parse(line[1]) > startPosition && Int32.Parse(line[1]) < endPosition)
                            {
                                videoTimeList.Add(Int32.Parse(line[1]));
                            }
                        }
                        if (Int32.Parse(line[1]) >= endPosition)
                        {
                            maxIndex=index;
                            break;
                        }
                        index++;
                    }
                }
            }
            if (minIndex > 0 && maxIndex > minIndex)
            {
                for (int i = minIndex; i < maxIndex; i++)
                {
                    _videoAnnotation.addKeyFrameButton(InkConstants.getImageFromName(@"resource\" + GlobalValues.videoName + @"_source\" + i + ".png"),
                        videoTimeList[i - minIndex]);
                }
            }
            ascSort(new ComparerTimeStart());
        }
Esempio n. 18
0
 public void reLoadImage()
 {
     this.image = InkConstants.getImageFromName(imageName);
 }
Esempio n. 19
0
        public override void _presenter_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            //if (videoSummarization == null || videoSummarization != _inkCollector.VideoSummarization)
            //{
            //    this.videoSummarization = _inkCollector.VideoSummarization;
            //}
            //startIndex = VideoSummarization.getSelectedKeyFrameIndex(_startPoint);//, customSummarization);

            if (this.VideoSummarizationControl == null)
            {
                VideoPlayTimer                 = new System.Windows.Forms.Timer();
                VideoPlayTimer.Interval        = 1000;
                VideoPlayTimer.Tick           += new System.EventHandler(VideoPlayTimer_Tick);
                this.VideoSummarizationControl = _inkCollector._mainPage.VideoSummarizationControl;
                VideoPlayTimer.Start();
            }
            if (_startPoint.X == 0 && _startPoint.Y == 0)
            {
                _currPoint    = e.GetPosition(_inkCanvas);
                _currPoint.X -= inkCanvasSpiralSummarizationMargin.Left;
                _currPoint.Y -= inkCanvasSpiralSummarizationMargin.Top;
                currIndex     = videoSummarization.getSelectedKeyFrameIndex(_currPoint);
                //记录操作类型与持续时间
                recordOperateTrace("MOVE");
                if (currIndex != int.MinValue && currIndex < videoSummarization.ShowKeyFrames.Count &&
                    currIndex != preIndex && _inkCollector.IsShowUnbrokenKeyFrame)
                {
                    moveTimerSecond = 0;
                    MoveTimer.Start();

                    clearPreMessage();
                    Image currImage = InkConstants.getImageFromName(videoSummarization.ShowKeyFrames[currIndex].ImageName);// videoSummarization.ShowKeyFrames[currIndex].convertToNewKeyFrame().Image;
                    left = videoSummarization.ShowKeyFrames[currIndex].Image.Margin.Left;
                    top  = videoSummarization.ShowKeyFrames[currIndex].Image.Margin.Top;
                    //left += inkCanvasSpiralSummarizationMargin.Left;
                    //top += inkCanvasSpiralSummarizationMargin.Top;
                    if (_inkCollector.DefaultSummarizationNum == 1)
                    {
                        top += videoSummarization.InkCanvas.Margin.Top;
                        top -= 10;
                    }
                    currImage.Margin = new Thickness(left, top, 0, 0);
                    currImage.Width  = 150; // videoSummarization.ShowKeyFrames[currIndex].Image.Width;
                    currImage.Height = 100; // videoSummarization.ShowKeyFrames[currIndex].Image.Height;
                    if (_inkCollector.DefaultSummarizationNum == 1 && !((TileSummarization)videoSummarization).Protect)
                    {
                        ;
                    }
                    else
                    {
                        _inkCanvas.Children.Add(currImage);
                    }
                    preImage = currImage;
                    preIndex = currIndex;
                }
                else if (currIndex == int.MinValue)
                {
                    if (preImage != null)
                    {
                        _inkCanvas.Children.Remove(preImage);
                    }
                    moveTimerSecond = 0;
                }
                //显示移动轨迹
                if (moveStroke != null)
                {
                    moveStroke.StylusPoints.Add(new StylusPoint(_currPoint.X, _currPoint.Y));
                    if (moveStroke.StylusPoints.Count > 300)
                    {
                        moveStroke.StylusPoints.RemoveAt(0);
                    }
                }
                else
                {
                    StylusPointCollection spc = new StylusPointCollection();
                    spc.Add(new StylusPoint(_currPoint.X, _currPoint.Y));
                    moveStroke = new Stroke(spc);
                    moveStroke.DrawingAttributes.Color  = Colors.Transparent;
                    moveStroke.DrawingAttributes.Width  = 3;
                    moveStroke.DrawingAttributes.Height = 3;
                    _inkCanvas.Strokes.Add(moveStroke);
                }
            }
            else
            {
                _currPoint = e.GetPosition(_inkCanvas);

                if (_inkCollector.DefaultSummarizationNum == 0)
                {
                    mouseGesture.Capturing((int)_currPoint.X, (int)_currPoint.Y);
                }
                else if (_inkCollector.DefaultSummarizationNum == 1)
                {
                    clearPreMessage();
                    moveTimerSecond = 0;
                    double top = videoSummarization.InkCanvas.Margin.Top + _currPoint.Y - _prePoint.Y;
                    //if (left <= 0 && left >VideoSummarizationControl.summarization._inkCanvas.ActualWidth -tapestrySummarization.Width  )
                    //{
                    videoSummarization.InkCanvas.Margin = new Thickness(videoSummarization.InkCanvas.Margin.Left,
                                                                        top, 0, 0);
                }
                _prePoint = _currPoint;
                //记录操作类型与持续时间
                recordOperateTrace("MOVE");
            }
        }