///////////////////////////////////////////////////////// // Image Acquierd event callback function. // void camStream_ImageAcquired(CameraStream sender, ImageAcquiredEventArgs e) { CameraDevice parent = sender.Parent; int cameraIndex = -1; for (int i = 0; i < this.camCount; i++) { if (parent == this.arrayCamDevice[i]) { cameraIndex = i; break; } } if (cameraIndex == -1) { return; } // Disp Block ID DispTextBox(this.arrayTextBoxBlockId[cameraIndex], e.ImageInfo.BlockID.ToString()); // Increment fps count Interlocked.Increment(ref this.arrayFpsCount[cameraIndex]); if (cameraIndex == 0) { if (id != e.ImageInfo.BlockID) { this.flag = true; id = e.ImageInfo.BlockID; } } }
/// <summary> /// Image is acquired. /// </summary> private void _device_ImageAcquired(object sender, ImageAcquiredEventArgs e) { // image acquistion must be canceled because application's window is closing if (_cancelTransferBecauseWindowIsClosing) { // cancel image acquisition _currentDevice.CancelTransfer(); return; } _images.Add(e.Image); SetCurrentImage(_images.Count - 1); }
/// <summary> /// Image is acquired. /// </summary> private void device_ImageAcquired(object sender, ImageAcquiredEventArgs e) { // dispose an acquired image e.Image.Dispose(); // output an extended image info extendedImageInfoAboutAcquiredImageTextBox.Text += "IMAGE IS ACQUIRED" + Environment.NewLine; extendedImageInfoAboutAcquiredImageTextBox.Text += Environment.NewLine; Device device = (Device)sender; for (int i = 0; i < device.ExtendedImageInfo.Count; i++) { AddExtendedImageInfoToResultTextBox(i, device.ExtendedImageInfo[i]); } extendedImageInfoAboutAcquiredImageTextBox.Text += Environment.NewLine; }
private void device_ImageAcquired(object sender, ImageAcquiredEventArgs e) { Device device = (Device)sender; if (this._cancelTransferBecauseFormIsClosing) { device.CancelTransfer(); return; } this._images.Add(e.Image); this.SetCurrentImage(this._images.Count - 1); Application.DoEvents(); this.ScanComplete(); TwainPdfEncoderSettings twainPdfEncoderSetting = new TwainPdfEncoderSettings(); twainPdfEncoderSetting.PdfDocumentInfo.Author = string.Format("{0} / {1}", Global.GlobalAccount.ToString(), Global.GlobalAccount.BadgeNumber); twainPdfEncoderSetting.PdfDocumentInfo.Title = this.txtTitle.Text; twainPdfEncoderSetting.PdfDocumentInfo.Creator = string.Concat("Documents acquired from ", device.Info.ProductName); this.ScannerName = device.Info.ProductName; twainPdfEncoderSetting.PdfDocumentInfo.Subject = this.txtSubject.Text; twainPdfEncoderSetting.PdfDocumentInfo.Keywords = this.txtKeywords.Text; twainPdfEncoderSetting.PdfDocumentInfo.ModificationDate = DateTime.Now; twainPdfEncoderSetting.PdfMultiPage = true; if (!Directory.Exists(this.FilePath)) { Directory.CreateDirectory(this.FilePath); Network.SetAcl(this.FilePath); } string str = Path.Combine(this.FilePath, this.DocName); try { e.Image.Save(str, twainPdfEncoderSetting); } catch (Exception exception1) { Exception exception = exception1; MessageBox.Show(this, exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } if (!this.IsRecorded) { this.IsRecorded = true; } }
private void SensorImageAcquired(object sender, ImageAcquiredEventArgs e) { var image = new Bitmap(ImageSize.Width, ImageSize.Height, PixelFormat.Format24bppRgb); BitmapData lockData = image.LockBits(new Rectangle(Point.Empty, ImageSize), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb); Marshal.Copy(e.LiveImage.ByteData, 0, lockData.Scan0, e.LiveImage.ByteData.Length); image.UnlockBits(lockData); DrawToolWindow(image); using (Graphics graphics = Graphics.FromImage(image)) { graphics.SmoothingMode = SmoothingMode.AntiAlias; sensor.DrawWindow(graphics, Color.Green, Color.Red, activeToolNo); } if (pictureBox.Image != null) { pictureBox.Image.Dispose(); } pictureBox.Image = image; }
/// <summary> /// Imagem Scanneada /// </summary> private void CarregarImagem(object sender, ImageAcquiredEventArgs e) { #region Digitalização antiga //var stream = new MemoryStream(); //var imagem = lDispositivo.AcquiredImages[0]; //imagem.SaveToStream(stream, ImageFileFormat.PNG); //imagens.Add(stream); //numeroImagens++; //DefineImagemAtual(imagens.Count - 1); ////e.EndOfJob = false; //e.Cancel = false; //Application.DoEvents(); #endregion short value = 15; //imagens.Add(e.Image); DefineImagemAtual(lDispositivo.AcquiredImages.Count -1); Application.DoEvents(); }
void _twainDeviceAutomatic_ImageAcquired(object sender, ImageAcquiredEventArgs e) { _twainDeviceAutomatic.AcquiredImages.PdfACompatible = true; _twainDeviceAutomatic.AcquiredImages.PdfMultiPage = true; _twainDeviceAutomatic. AcquiredImages[_twainDeviceAutomatic.AcquiredImages.Count - 1] .Despeckle(8, 25, 30, 400); _twainDeviceAutomatic .AcquiredImages[_twainDeviceAutomatic.AcquiredImages.Count - 1] .Deskew( BorderColor.AutoDetect, 5, 5); _twainDeviceAutomatic .AcquiredImages[_twainDeviceAutomatic.AcquiredImages.Count - 1] .DetectBorder(5); _twainDeviceAutomatic.AcquiredImages[_twainDeviceAutomatic.AcquiredImages.Count -1].Save(txtPDFPath.Text + "\\" + _pdfNameFromTime + ".pdf"); Application.DoEvents(); }
void _twainDevice_ImageAcquired(object sender, ImageAcquiredEventArgs e) { Application.DoEvents(); }
private void MediateImageAcquiredEvent(object sender, ImageAcquiredEventArgs e) { this.ImageAcquired(sender, e); }
// Handler of the ImageAcquired event of the device. private void _device_ImageAcquired(object sender, ImageAcquiredEventArgs e) { SetCurrentImage(_device.AcquiredImages.Count - 1); // do events of application Application.DoEvents(); }