Beispiel #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     i++;
     bmp = aviStream.GetBitmap(i);
     pictureBox1.Image = bmp;
     label8.Text       = i.ToString();//当前帧数
     if (i == framecount - 1)
     {
         i = 0;
     }
 }
        private void FillBuffer()
        {
            while (true)
            {
                Monitor.Enter(this);
                if (_frameBuffer.Count <= BuferMaxSize)
                {
                    if (_currentFrame >= 0 && _currentFrame < FrameCount)
                    {
                        var bitmap = _videoStream.GetBitmap(_currentFrame);
                        if (Step == 1)
                        {
                            Traitement.Instance.Traiter(bitmap);
                        }
                        _frameBuffer.Enqueue(bitmap);
                        _currentFrame += Step;
                    }

                    Monitor.Exit(this);
                }
                else
                {
                    Monitor.Exit(this);
                    Thread.Sleep(10);
                }
            }
        }
Beispiel #3
0
        public System.Drawing.Bitmap GetBitmap(int index)
        {
            if (index < 0 || index >= GetFrameCount())
            {
                return(null);
            }

            switch (_mode)
            {
            case Mode.Video:
                //_aviStream.GetFrameOpen();
                System.Drawing.Bitmap bitmap;
                bitmap = _aviStream.GetBitmap(index);

                //_aviStream.GetFrameClose();
                return(bitmap);


            case Mode.SingleFrame:
                return(_singleFrame.Clone() as System.Drawing.Bitmap);


            case Mode.Annotations:
                Bitmap bmp = GetImageFromAnnotation(index);
                return(Bitmap.ToSystemDrawingBitmap(bmp));


            case Mode.MultipleFrames:
                return(new System.Drawing.Bitmap(_multipleScreenshots[index]));

            default:

                return(null);
            }
        }
        private void ShowFrame()
        {
            if (System.IO.File.Exists(txtAviFileName.Text))
            {
                try {
                    AviManager  aviManager = new AviManager(txtAviFileName.Text, true);
                    VideoStream aviStream  = aviManager.GetVideoStream();
                    aviStream.GetFrameOpen();

                    Bitmap bmp = aviStream.GetBitmap(Convert.ToInt32(numPosition.Value));
                    picFrame.Image = bmp;
                    aviStream.GetFrameClose();
                    aviManager.Close();
                } catch (Exception ex) {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Beispiel #5
0
        private void open()
        {
            aviManager = new AviManager(file, true);
            aviStream  = aviManager.GetVideoStream();
            aviStream.GetFrameOpen();
            framecount         = aviStream.CountFrames;
            label2.Text        = framecount.ToString();
            bmp                = aviStream.GetBitmap(i);
            label6.Text        = bmp.Width.ToString();  //宽度
            label4.Text        = bmp.Height.ToString(); //高度
            pictureBox1.Width  = (bmp.Width);
            pictureBox1.Height = (bmp.Height);
            pictureBox1.Image  = bmp;
            label8.Text        = i.ToString();//当前帧数
            Form2 f = new Form2();

            f.Width  = (bmp.Width) + 200;
            f.Height = (bmp.Height) + 300;
        }
Beispiel #6
0
 private void ShowFrameTrackTwo()
 {
     if (System.IO.File.Exists(fileNameText.Text))
     {
         try
         {
             AviManager  aviManager = new AviManager(fileNameText.Text, true);
             VideoStream aviStream  = aviManager.GetVideoStream();
             aviStream.GetFrameOpen();
             Bitmap bmp = aviStream.GetBitmap(Convert.ToInt32(endPointTracker.Value));
             bmp.SetResolution(rlPicBox.Width, rlPicBox.Height);
             smplPicBox.Image = bmp;
             aviStream.GetFrameClose();
             aviManager.Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }