private void SetFrame(int frame) { CurrentHotFrame = null; if (frame >= 0) { if (frame != currentFrame) { if (reader == null) { timer.Stop(); return; } // has to seek? if (currentFrame + 1 != frame) { reader.Seek(frame, System.IO.SeekOrigin.Begin); } if (frameBox.Image != null) { frameBox.Image.Dispose(); } reader.ReadTimeout = timer.Interval; Image <Bgr <byte> > img = reader.ReadAs <Bgr <byte> >(); //ResizeNearestNeighbor filter = new ResizeNearestNeighbor(400, 300); //Bitmap newImage = filter.Apply(img.ToBitmap()); if (img != null) { frameBox.Image = img.ToBitmap(); frameBox.ZoomToFit(); } currentFrame = frame; } } else { frameBox.Image = null; if (frame < 0) { currentFrame = 0; trackBar.Value = 0; } toolStripStatus.Text = "Outside of the stream time limits."; } }