public EditBlobsForm(BlobsTool blobs, bool showResult = false) : base(showResult) { InitializeComponent(); this.tbrThresholdMin.Maximum = 255; this.tbrThresholdMax.Maximum = 255; this.lvwBlobs.Columns.Add("Area", -1, HorizontalAlignment.Left); if (blobs == null) { this.blobs = new BlobsTool(); } else { this.blobs = blobs; } this.setupBlobs(showResult); }
private bool loadBlobs(string filePath) { Stream fstream = null; try { fstream = new FileStream(filePath, FileMode.Open, FileAccess.Read); BinaryFormatter binFormat = new BinaryFormatter(); this.blobs = (BlobsTool)binFormat.Deserialize(fstream); return(true); } catch { return(false); } finally { fstream.Close(); } }