//Operation Format Settings private void ComboBox_maskFormat_SelectedIndexChanged(object sender, EventArgs e) { if (!inputImageReady) { return; } switch (comboBox_maskFormat.SelectedIndex) { default: case (int)MaskingFormat.Grayscale: maskingFormat = MaskingFormat.Grayscale; break; case (int)MaskingFormat.Sobel: maskingFormat = MaskingFormat.Sobel; break; //case 2: // maskingFormat = MaskingFormat.Hybrid; // break; } FromApplyingMask(); }
private void Initialize() { //Internal variable reset maskingFormat = MaskingFormat.Grayscale; spacingCharacter = SpacingCharacter.ForSteam; originalResolution = new Point(40, 40); desiredResolution = new Point(40, 40); keepAspectRatio = true; fixedForSteamSize = true; useOriginalSize = false; aspectRatio = 1.0; threshold = 128; inverseBlackAndWhite = false; applyLaplacian = false; //Winform reset comboBox_maskFormat.SelectedIndex = 0; comboBox_spacingChar.SelectedIndex = 0; comboBox_previewScaling.SelectedIndex = 0; checkBox_keepAspectRatio.Checked = keepAspectRatio; checkBox_steamFixed.Checked = fixedForSteamSize; checkBox_useOriginalSize.Checked = useOriginalSize; numeric_threshold.Value = threshold; trackBar_threshold.Value = threshold; checkBox_inverseBW.Checked = inverseBlackAndWhite; checkBox_applyLaplacian.Checked = applyLaplacian; groupBox_setting.Enabled = false; //Image holder reset pictureBox_original.Image = null; pictureBox_masked.Image = null; pictureBox_quantized.Image = null; //Bitmap holder reset if (bitmapOriginal != null) { bitmapOriginal.Dispose(); } if (bitmapResized != null) { bitmapResized.Dispose(); } if (bitmapMasked != null) { bitmapMasked.Dispose(); } if (bitmapQuantized != null) { bitmapQuantized.Dispose(); } bitmapOriginal = null; bitmapResized = null; bitmapMasked = null; bitmapQuantized = null; //Ready flag reset inputImageReady = false; }