void webcam_ImageCaptured(object source, WebcamEventArgs e) { System.Drawing.Bitmap image = e.WebCamImage as System.Drawing.Bitmap; ptr = image.GetHbitmap(); _FrameImage.Source = Imaging.CreateBitmapSourceFromHBitmap(ptr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); DeleteObject(ptr); }
void webcam_ImageCaptured(object source, WebcamEventArgs e) { if (DateTime.Now > lastCapturedTime + timeInterval) { if (lastBitmap != null) { Bitmap currentBitmap = (System.Drawing.Bitmap)e.WebCamImage; //bool result = BitmapComparator.CompareImages(lastBitmap, currentBitmap,compareLevel,similarityThreshold); //if (result) //{ // MessageBox.Show("lol" + compareLevel); // // compareLevel += 0.01; //} int result = BitmapComparator.CompareBitmaps(lastBitmap, currentBitmap, 0, 0); int threshold = 76230; if (result > threshold) { MessageBox.Show(result.ToString()); } } lastCapturedTime = DateTime.Now; lastBitmap = (System.Drawing.Bitmap)e.WebCamImage; } //System.Drawing.Image bmp1 = Helper.LoadBitmap((System.Drawing.Bitmap)e.WebCamImage); _FrameImage.Source = Helper.LoadBitmap((System.Drawing.Bitmap)e.WebCamImage); }
private void OnWebCam_ImageCaptured(object source, WebcamEventArgs e) { try { //PlayerVideo myVideo; //lock (this) //{ // myVideo = MyVideo; //} //get image from camera Image frameImage = e.WebCamImage; m_taskManager.EnqueueMe(frameImage); //send image to server/client lock (m_taskManager.SyncRoot) { m_tcpConnection.BeginSend(new JpgMessage(frameImage)); } //add image to my video images detecion queue //PlayerVideo.Frame frame = myVideo.Enqueue(frameImage, ElapedTime); //async invalidation this.Invalidate(); } catch (Exception ex) { string errorMsg = "Failed in OnWebCam_ImageCaptured(). Error: " + ex.Message; System.Diagnostics.Debug.WriteLine(errorMsg); } }
void webcam_ImageCaptured(object source, WebcamEventArgs e) { var webCamImage = (Bitmap)e.WebCamImage; if (this.storeBackground) { this.backgroundFrame = new Bitmap(webCamImage); this.storeBackground = false; } if (this.backgroundFrame != null) { using (var bitmap = new Bitmap(webCamImage)) { var pixelDiff = DiffCalculator.PixelDiff(this.backgroundFrame, bitmap); var cropped = CropDiff(pixelDiff); var polygon = this.blobsScanner.ScanImage(cropped); // send polygon to server bomBomClient.SendPolygon(polygon); var bitmapWithRects = new Bitmap(webCamImage.Width, webCamImage.Height); this.blobsScanner.Draw(bitmapWithRects); this.diffOutput.Source = PictureHelper.LoadBitmap(cropped); this.rects.Source = PictureHelper.LoadBitmap(bitmapWithRects); } } this.videoOutput.Source = PictureHelper.LoadBitmap(webCamImage); }
void webcam_ImageCaptured(object source, WebcamEventArgs e) { _FrameImage.Image = e.WebCamImage; //webcam.TimeToCapture_milliseconds = FrameNumber; // resume the video capture from the stop //webcam.Start(this.webcam.FrameNumber); }
void webcam_ImageCaptured(object source, WebcamEventArgs e) { //webcam.Stop(); //_FrameImage.Source = Helper.DoGrayImage((System.Drawing.Bitmap)e.WebCamImage); _FrameImage.Source = Helper.LoadBitmap((System.Drawing.Bitmap)e.WebCamImage); //System.Threading.ThreadPool.QueueUserWorkItem((st) => ToCrap(this, e)); ToCrap(this, e); //webcam.Start(this.webcam.FrameNumber); }
void webcam_ImageCaptured(object source, WebcamEventArgs e) { try { _FrameImage.Image = e.WebCamImage; } catch (Exception ere) { } }
unsafe void webcam_ImageCaptured(object source, WebcamEventArgs e) { //_FrameImage.Image = e.WebCamImage; Bitmap bm = (Bitmap)e.WebCamImage; Bitmap bm_copy = (Bitmap)bm.Clone(); BitmapData data = bm.LockBits(new Rectangle(0, 0, bm.Width, bm.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); //.Format32bppArgb); //.Format24bppRgb); //IntPtr ptr = data.Scan0; Byte *bptr = (Byte *)data.Scan0.ToPointer(); if (this.inversion) { WebCam.InvertImage((char *)bptr, (int)(bm.Width * bm.Height * 3)); } if (this.detection) { if (bm_prev != null) { BitmapData data2 = bm_prev.LockBits(new Rectangle(0, 0, bm.Width, bm.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); //.Format32bppArgb); //.Format24bppRgb); Byte * bptr2 = (Byte *)data2.Scan0.ToPointer(); WebCam.SubtractImage((char *)bptr, (char *)bptr2, (int)(bm.Width * bm.Height * 3), 30); } } /*if (this.detection) * { * if (bInitialized == false) * { * int ret = WebCam.foo(null, 0, 0); * if (ret < 0) * { * MessageBox.Show("foo returned " + ret); * detection = false; * } * else * { * bInitialized = true; * } * } * int ret2 = WebCam.detectFace((char*)bptr, (int)bm.Width, (int)bm.Height); * //int ret = WebCam.foo((char*)bptr, (int)bm.Width, (int)bm.Height); * if (ret2 < 0) * { * MessageBox.Show("detectFace returned " + ret2); * detection = false; * } * }*/ bm.UnlockBits(data); _FrameImage.Image = bm; bm_prev = bm_copy; }
void webcam1_ImageCaptured(object source, WebcamEventArgs e) { _FrameImage.Image = e.WebCamImage; if (bCapture == true) { imgCapture.Image = imgVideo.Image; bCapture = false; SaveImageCapture(imgCapture.Image); webcam1.Stop(); //Azure Form1.UploadFileToAzure(); } }
void webCam_ImageCaptured(object source, WebcamEventArgs e) { try { ip = ((System.Drawing.Bitmap)e.WebCamImage).GetHbitmap(); bs = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ip, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); DeleteObject(ip); _FrameImage.Source = bs; } catch (Exception ErrorException) { LogFileWriter.ErrorToLog("webCam_ImageCaptured", ErrorException); DXMessageBox.Show(ErrorException.Message, CvVariables.SOFTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void MWwebcam_ToCrap(object sender, WebcamEventArgs e) { System.Windows.Shapes.Rectangle aa = MSSelectedArea.SARec; System.Windows.Shapes.Rectangle bb = MSSelectedArea.SACer; int x = (int)Canvas.GetLeft(aa); int y = (int)Canvas.GetTop(aa); Int32Rect RecTop = new Int32Rect(x, y, (int)aa.Width, (int)aa.Height); x = (int)Canvas.GetLeft(bb); y = (int)Canvas.GetTop(bb); Int32Rect RecBottom = new Int32Rect(x, y, (int)aa.Width, (int)aa.Height); _FrameImageCropTop.Source = Helper.DoGrayImage((System.Drawing.Bitmap)e.WebCamImage); _FrameImageCropBottom.Source = Helper.DoGrayImage((System.Drawing.Bitmap)e.WebCamImage); // Set Image.Source to cropped image _FrameImageCropTop.Source = _DoCropCP((BitmapSource)_FrameImageCropTop.Source, RecTop); _FrameImageCropBottom.Source = _DoCropCP((BitmapSource)_FrameImageCropBottom.Source, RecBottom); if ((bool)MSScreenResults.Calculate.IsChecked) { _UpdateDiffImage(); MSScreenControls.mTimer.Start(); if (DiffoSheet == null) { DiffDate = DateTime.Now; row = 1; DiffoXL = new Microsoft.Office.Interop.Excel.Application(); DiffoXL.Workbooks.Add(); DiffoSheet = DiffoXL.ActiveSheet; } } else { MSScreenControls.mTimer.Stop(); if (DiffoSheet != null) { DiffoSheet.SaveAs(string.Format(@"{0}\diff_{1:s}.xlsx", Environment.CurrentDirectory, DiffDate.ToString("MM-dd-HH-mm-ss"))); DiffoXL.Quit(); DiffoSheet = null; } } }
private void webCamCapture1_ImageCaptured_1(object source, WebcamEventArgs e) { pictureBox1.Image = e.WebCamImage; tmp = new Bitmap(pictureBox1.Image); }
private void ImageCaptured(object source, WebcamEventArgs e) { Feed.Image = e.WebCamImage; }
/// <summary> /// Захват изображения /// </summary> /// <param name="source"></param> /// <param name="e"></param> void webcam_ImageCaptured(object source, WebcamEventArgs e) { Frame_Img.Source = Camera_HelperClass.LoadBitmap((System.Drawing.Bitmap)e.WebCamImage); }
void webcam_ResimCek(object source, WebcamEventArgs e) { _FrameResim.Image = e.WebCamImage; }
void webcam_ImageCaptured(object source, WebcamEventArgs e) { e.WebCamImage.RotateFlip(RotateFlipType.RotateNoneFlipX); _FrameImage.Image = e.WebCamImage; }
/// <summary> /// An image was capture /// </summary> /// <param name="source">control raising the event</param> /// <param name="e">WebCamEventArgs</param> private void WebCamCapture_ImageCaptured(object source, WebcamEventArgs e) { // Set the picturebox picture. this.pbVideoView.Image = e.Image; }
void webcam_ImageCaptured(object source, WebcamEventArgs e) { _FrameImage.Image = e.WebCamImage; }
void cam_ImageCaptured(object source, WebcamEventArgs e) { //pictureEdit1.EditValue = e.WebCamImage; }
void webcam_ImageCaptured(object source, WebcamEventArgs e) { _FrameImage.Source = Helper.LoadBitmap((System.Drawing.Bitmap)e.WebCamImage); }