public void Dispose() { ImageSource?.Dispose(); Title?.Dispose(); _tappedSubscription?.Dispose(); Tapped?.Dispose(); }
public new void Dispose() { if (!ReferenceEquals(ImageSource, null)) { ImageSource.Dispose(); } ImageBox.Dispose(); base.Dispose(); }
public void DeleteImage(ImageSource image) { if (image == null) return; if (!File.Exists(image.FileName)) return; try { image.Dispose(); File.Delete(image.FileName); LoadImages(); OnCollectionChanged(); } catch { } }
public void DeleteImage(ImageSource image) { if (image == null) { return; } if (!File.Exists(image.FileName)) { return; } try { image.Dispose(); File.Delete(image.FileName); LoadImages(); OnCollectionChanged(); } catch { } }
public void Dispose() { ImageSource?.Dispose(); Title?.Dispose(); }
/// <summary> /// Load image into ImageBox acording to the applyed filter /// </summary> private void LoadImage() { try { ImageSource?.Dispose(); Stopwatch watch = Stopwatch.StartNew(); switch (Algorithm) { case FilterAlgorithm.Original: ImageSource = ParentTab.ImgOriginal; break; case FilterAlgorithm.Gray_Filtered: ImageSource = ParentTab.ImgGray; break; case FilterAlgorithm.Canny: var image = ParentTab.ImgGray.Canny(Convert.ToDouble(tsActionsTextbox1.Text), Convert.ToDouble(tsActionsTextbox2.Text), Convert.ToInt32(tsActionsCombobox1.SelectedItem.ToString()), tsActionsCombobox2.SelectedItem.ToString().Equals("Yes")); /*LineSegment2D[][] lines = image.HoughLinesBinary( * 10, //Distance resolution in pixel-related units * Math.PI / 45.0, //Angle resolution measured in radians. * 50, //threshold * 10, //min Line width * 5); //gap between lines * Image<Bgr, Byte> lineImage = ParentTab.ImgOriginal.CopyBlank(); * foreach (LineSegment2D line in lines[0]) * lineImage.Draw(line, new Bgr(Color.Green), 2); * * ImageSource = lineImage;*/ // Contours List <VectorOfPoint> contoursArray = OpenCVUtilities.FindContours(image); VectorOfPoint largest = OpenCVUtilities.FindLargestContour(image.Mat); //ParentTab.ImgGray.Draw(largest.ToArray(), new Gray(5), 5); //MessageBox.Show(largest.Size.ToString()); ParentTab.lvData.Items["Contours"].SubItems[1].Text = contoursArray.Count.ToString(); ImageSource = image; break; case FilterAlgorithm.Sobel: ImageSource = ParentTab.ImgGray.Sobel(Convert.ToInt32(tsActionsTextbox1.Text), Convert.ToInt32(tsActionsTextbox2.Text), Convert.ToInt32(tsActionsCombobox1.SelectedItem)); break; case FilterAlgorithm.Laplace: ImageSource = ParentTab.ImgGray.Laplace(Convert.ToInt32(tsActionsCombobox1.SelectedItem)); break; case FilterAlgorithm.Sobel_Heavy: ImageSource = ParentTab.ImgGray.Sobel(0, 1, 3).Add(ParentTab.ImgGray.Sobel(1, 0, 3)).AbsDiff(new Gray(0.0)); break; } ImageBox.Image = ImageSource?.Bitmap; watch.Stop(); tsActionsLabelMS.Text = $"{watch.ElapsedMilliseconds}ms"; } catch (Exception e) { MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }