private void SetCurrentImage(int index) { lock (this) { if (this.ScanPic.Image != null) { this.ScanPic.Image.Dispose(); this.ScanPic.Image = null; } if (index < 0) { this.lbl_ScanStatus.Text = LangCtrl.GetString("txt_ScanNoImages", "No images"); this._imageIndex = -1; } else { AcquiredImage item = this._images[index]; this.ScanPic.Image = item.GetAsBitmap(true); ScanImg scanImg = new ScanImg(); scanImg.SetImage((Image)this.ScanPic.Image.Clone()); this.flowPanel.Controls.Add(scanImg); if (this._imageIndex == -1) { Image image = (Image)this.ScanPic.Image.Clone(); this.ThumbnailImage = image.GetThumbnailImage(220, 130, null, IntPtr.Zero); } this._imageIndex = index; } } }
private string GetCurrentImageInfo(int index, AcquiredImage acquiredImage) { ImageInfo imageInfo = acquiredImage.ImageInfo; object[] objArray = new object[] { index, this._images.Count, imageInfo.Width, imageInfo.Height, imageInfo.BitCount, imageInfo.Resolution }; return(string.Format("Image {0} from {1} ({2} x {3}, {4} bpp, {5})", objArray)); }
public UploadWindow(Window owner, AcquiredImage acquiredImageToUpload) { InitializeComponent(); this.Owner = owner; _acquiredImageToUpload = acquiredImageToUpload; }
private AcquiredImage AcquireImageFromFile(long imageQuality) { var acquiredImage = new AcquiredImage { ImageType = ImageFormat.Jpeg.ToString(), ImageName = Guid.NewGuid().ToString(), Image = GetImageFromFile(), ImageDate = DateTime.Today, ImageQuality = imageQuality }; return(acquiredImage); }
public AcquiredImage AcquireImage(ImageRequest imageRequest) { var acquiredImage = new AcquiredImage { ImageType = ImageFormat.Jpeg.ToString(), ImageName = Guid.NewGuid().ToString(), Image = CaptureImage(imageRequest), ImageDate = DateTime.Today, ImageQuality = imageRequest.ImageQuality }; return(acquiredImage); }
/// <summary> /// Processes acquired image. /// </summary> private void processImageButton_Click(object sender, RoutedEventArgs e) { // get reference to current image AcquiredImage currentImage = _images[_imageIndex]; // process current image ImageProcessingWindow window1 = new ImageProcessingWindow(currentImage); window1.ShowDialog(); // update current image SetCurrentImage(_imageIndex); }
/// <summary> /// Sets the current image. /// </summary> private void SetCurrentImage(int index) { lock (this) { // dispose previous image if necessary if (image1.Source != null) { image1.Source = null; } image1.Width = 0; image1.Height = 0; // get the image from the internal buffer of the device if image is present if (index >= 0) { AcquiredImage acquiredImage = _images[index]; image1.Source = acquiredImage.GetAsBitmapSource(); SetImageScrolls(); imageInfoLabel.Content = GetCurrentImageInfo(index, acquiredImage); _imageIndex = index; } // show "No images" text else { imageInfoLabel.Content = "No images"; _imageIndex = -1; } // update UI UpdateUI(); } }
public string Encode(AcquiredImage image) { var encodedImage = ImageToBase64EncodeString(image.Image, image.ImageQuality); return(encodedImage); }
private string InformacoesImagemCorrente(int index, AcquiredImage acquiredImage) { ImageInfo imageInfo = acquiredImage.ImageInfo; return string.Format("Image {0} from {1} ({2} x {3}, {4} bpp, {5})", index, lDispositivo.AcquiredImages.Count, imageInfo.Width, imageInfo.Height, imageInfo.BitCount, imageInfo.Resolution); }
/// <summary> /// Gets the information about current image. /// </summary> private string GetCurrentImageInfo(int index, AcquiredImage acquiredImage) { ImageInfo imageInfo = acquiredImage.ImageInfo; return(string.Format("Image {0} from {1} ({2} x {3}, {4} bpp, {5})", index + 1, _images.Count, imageInfo.Width, imageInfo.Height, imageInfo.BitCount, imageInfo.Resolution)); }
public ImageProcessingWindow(AcquiredImage image) : this() { _image = image; }
private bool Save2DataBase() { this.DataBase = new AccessPoint(); DataBase.Filename = "BoundaryID.sdf"; DataBase.Filepath = Helper.GetExeParentFolder() +"Database\\"; DataBase.Password = Others.ReadDatabasePW(); DataBase.UseLikeStatement = false; // default = false DataBase.WildCardLeft = true; // In conjunction with UseLikeStatement DataBase.WildCardRight = true; string sDate = DateTime.Now.ToString("yyMMddHHmmss"); if (!Directory.Exists(DataBase.Filepath)) Directory.CreateDirectory(DataBase.Filepath); string fullPath = DataBase.Filepath + DataBase.Filename; //if is too big, rename it. if (File.Exists(fullPath)) { System.IO.FileInfo fInfo = new FileInfo(fullPath); const int oneK = 1000; if (fInfo.Length > oneK * oneK * 500) { RenameFile(DataBase.Filepath, DataBase.Filename, sDate); } } //1 create database string errMsg = ""; if (!DataBase.CreateDataBase(true,ref errMsg)) { SetInfo(errMsg, Brushes.Red); return false; } //2 create tables if(!DataBase.CheckTable(new MeasureResult(), ref errMsg)) { if (!DataBase.CreateTable(new MeasureResult(), ref errMsg)) { SetInfo(errMsg, Brushes.Red); return false; } } if (!DataBase.CheckTable(new AcquiredImage(), ref errMsg)) { if (!DataBase.CreateTable(new AcquiredImage(), ref errMsg)) { SetInfo(errMsg, Brushes.Red); return false; } } //3 插入结果 for (int i = 0; i < MeasureWindow.allMeasureInfos.Count; i++) { int index = 0; foreach (BoundaryID.MeasureWindow.MeasureInfo info in MeasureWindow.allMeasureInfos[i]) { index++; string sSeq = string.Format("{0}-{1}", i + 1, index); MeasureResult result = new MeasureResult(sDate,sSeq, info); DataBase.Insert(result); } } AcquiredImage imageInfo = new AcquiredImage(); imageInfo.ImageData = ReadImage(Helper.GetLatestImagePath()); ; imageInfo.ImageID = sDate; imageInfo.hasBuffy = GlobalVals.hasBuffy.ToString(); AcquiredImage imageInfo2 = new AcquiredImage(); imageInfo2.ImageData = ReadImage(Helper.GetExeParentFolder() + "Data\\snapShot.png"); imageInfo2.ImageID = sDate + "M"; imageInfo2.hasBuffy = GlobalVals.hasBuffy.ToString(); DataBase.Insert(imageInfo); DataBase.Insert(imageInfo2); return true; }