sorry for my English, I want to get frame capture when moving on loaded video, how can I do it? Example, there is a way, take a frame capture while the car is on the way, but,
don't take a frame capture while the road is empty. my codes are as follows;
VideoCapture capture = null;
List<Mat> image_array = new List<Mat>();
private void ProcessFrame(object sender, EventArgs arg)
{
Mat frame = new Mat();
capture.Retrieve(frame, 0);
ımageBox1.Image = frame;
Thread.Sleep((int)capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps));
try
{
string time = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss_ffff");
frame = capture.QueryFrame();
Bitmap captureBitmap = new Bitmap(frame.Bitmap);
captureBitmap.Save(@"D:\FrameCapture\Capture-" + time + ".jpg", ImageFormat.Jpeg);
if (frame != null)
{
image_array.Add(frame);
}
else
{
Application.Idle -= ProcessFrame;
}
}
catch (Exception)
{
}
}
I want something like this;
if(moved)
{
captureBitmap.Save(......)
}
how can I do it?
What I have tried:
for (int i = 0; i < image_array.Count; i++)
{
CvInvoke.AbsDiff(image_array[i], image_array[i + 1], diffFrame);
if (diffFrame!=null)
{
croppedBitmap.Save(@"D:\FrameCapture\Capture-" + time + ".jpg", ImageFormat.Jpeg);
}
}