You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to add motion detection, so I had to add the reference "ref Bitmap image" but after adding that I get the error No overload for 'video_NewFrame' matches delegate 'NewFrameEventHandler'
MotionDetector Detector;
float viewmotion;
private void mjpegStreamForm_Load(object sender, EventArgs e)
{
Detector = new MotionDetector(new TwoFramesDifferenceDetector(), new BlobCountingObjectsProcessing());
viewmotion = 0;
}
public void video_NewFrame(object sender, NewFrameEventArgs eventArgs, ref Bitmap image) //<---------This is where I added it
{
viewmotion = Detector.ProcessFrame(image);
time.Start();
Bitmap img = (Bitmap)eventArgs.Frame.Clone();
if (flag_rotate!=0)
{
if (flag_rotate == 1) { img.RotateFlip(RotateFlipType.Rotate90FlipNone); }
else if (flag_rotate == 2) { img.RotateFlip(RotateFlipType.Rotate180FlipNone); }
else { img.RotateFlip(RotateFlipType.Rotate270FlipNone); }
}
if (flag_smooth == 1) { img = grayscale.Apply(img); }
if (trackBar1.Value != 0) { img = br.Apply(img); }
if (flag_flipX == 1) {img.RotateFlip(RotateFlipType.RotateNoneFlipX);}
if (flag_flipY == 1) { img.RotateFlip(RotateFlipType.RotateNoneFlipY); }
if (flag_sharpen == 1) { sharpen.ApplyInPlace(img);}
if (flag_treshold == 1) {marker.ApplyInPlace(img); }
if (flag_edge == 1) { rubovi.ApplyInPlace(img); }
if (flag_dither == 1) {poster_filter.ApplyInPlace(img); }
if (flag_invert == 1) { invert_filter.ApplyInPlace(img); }
pbx_image.Image = img;
time.Stop();
lbl_time.Text = "Frame times: " + time.ElapsedMilliseconds+" ms";
time.Reset();
}
but on a button press I have the argument
private void btn_playPause_Click(object sender, EventArgs e)
{
i++;
if (i % 2 == 0)
{
this.btn_playPause.Image = ((System.Drawing.Image)(IPCams.Properties.Resources.icons8_circled_play_64));
btn_capImage.Enabled = false;
videoSource.SignalToStop();
videoSource.WaitForStop();
videoSource.Stop();
}
else
{
new Thread(() =>{
Thread.CurrentThread.IsBackground = true;
btn_capImage.Enabled = true;
videoSource.Login = camUsername;
videoSource.Password = camPassword;
this.btn_playPause.Image = ((System.Drawing.Image)(IPCams.Properties.Resources.icons8_pause_button_64));
videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); //<---------This is where I have the problem
videoSource.Start();
}).Start();
}
}
Is there any way to get rid of this error? I just want motion detection to work!
The text was updated successfully, but these errors were encountered:
if you write new NewFrameEventHandler(video_NewFrame);
then video_NewFrame(object sender, NewFrameEventArgs eventArgs, ref Bitmap image)
and NewFrameEventHandler(object sender,NewFrameEventArgs eventArgs);
have to have the same arguments, but they are now different with Bitmap image.
if you write new NewFrameEventHandler(video_NewFrame); then video_NewFrame(object sender, NewFrameEventArgs eventArgs, ref Bitmap image) and NewFrameEventHandler(object sender,NewFrameEventArgs eventArgs); have to have the same arguments, but they are now different with Bitmap image.
How would I fix this? I won't be able to use motion detection unless Bitmap image is added
I wanted to add motion detection, so I had to add the reference "ref Bitmap image" but after adding that I get the error No overload for 'video_NewFrame' matches delegate 'NewFrameEventHandler'
but on a button press I have the argument
Is there any way to get rid of this error? I just want motion detection to work!
The text was updated successfully, but these errors were encountered: