private async void Median5x5PageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { MedianFilterHelper.MedianFilter(WriteableOutputImage, 5); AddToUndo(WriteableOutputImage.Clone()); await UpdateOutputImage(); }
private async void InvertMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { AddToUndo(WriteableOutputImage.Clone()); WriteableOutputImage = WriteableOutputImage.Invert(); await UpdateOutputImage(); }
private async void Laplace2PageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { WriteableOutputImage = WriteableBitmapCovolute.Convolute(WriteableOutputImage, Laplace2); AddToUndo(WriteableOutputImage.Clone()); await UpdateOutputImage(); }
private async void ConvertToGrayScaleITUR_BT709PageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { AddToUndo(WriteableOutputImage.Clone()); WriteableOutputImage = BinaryzationHelper.ConvertToGrayscaleITUR_BT709(WriteableOutputImage); await UpdateOutputImage(); }
private async void OtsuBinaryzationPageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { AddToUndo(WriteableOutputImage.Clone()); ConvertToGrayScaleITUR_BT709PageMenuFlyoutItem_Click(null, null); int threshold = Otsu.GetOtsuThreshold(WriteableOutputImage); WriteableOutputImage.ForEach((x, y, curColor) => { if (curColor.R > threshold) { return(Color.FromArgb(255, 255, 255, 255)); } return(Color.FromArgb(255, 0, 0, 0)); }); await UpdateOutputImage(); ContentDialog dialog = new ContentDialog { Title = "Binaryzation", Content = "Otsu threshold value = " + threshold, CloseButtonText = "Ok" }; ContentDialogResult result = await dialog.ShowAsync(); }
private async Task RunMorphological(MorphologicalOperation op, bool?[,] matrix3x3 = null) { OtsuBinaryzationPageMenuFlyoutItem_Click(null, null); AddToUndo(WriteableOutputImage.Clone()); WriteableOutputImage = MorphologicalHelper.Make(WriteableOutputImage, op, matrix3x3); await UpdateOutputImage(); }
private async Task ManualBinaryzation(int threshold) { AddToUndo(WriteableOutputImage.Clone()); ConvertToGrayScaleITUR_BT709PageMenuFlyoutItem_Click(null, null); BinaryzationHelper.ManualBinaryzation(threshold, WriteableOutputImage); await UpdateOutputImage(); }
private async void ReOpenImageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { ContentFrame_Reset(); WriteableOutputImage = WriteableOutputImageCopy.Clone(); PrevOutputs.Clear(); PrevOutputs.Push(WriteableOutputImage.Clone()); await UpdateOutputImage(); }
private async Task NiblackBinaryzation(int size = 25, double k = 0.5) { AddToUndo(WriteableOutputImage.Clone()); ConvertToGrayScalePageMenuFlyoutItem_Click(null, null); NiblackThreshold niblack = new NiblackThreshold(size, k); WriteableOutputImage = niblack.Threshold(WriteableOutputImage); await UpdateOutputImage(); }
private async void OpenPixelManagerDialogMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { PixelManagerDialog dialog = new PixelManagerDialog(WriteableOutputImage.Clone()); await dialog.ShowAsync(); if (dialog.ExitResult == PixelManagerDialogExitResult.BitmapChanged) { AddToUndo(dialog.editingBitmap); WriteableOutputImage = dialog.editingBitmap; await UpdateOutputImage(); } }
private async void ScaleMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { AddToUndo(WriteableOutputImage.Clone()); ScaleImageDialog dialog = new ScaleImageDialog(); ContentDialogResult result = await dialog.ShowAsync(); InterpolationTypes interpolationTypes = dialog.Interpolation; double scale = await dialog.GetScaleValue(); WriteableOutputImage = BitmapResizeHelper.Resize(WriteableOutputImage, (int)(WriteableOutputImage.PixelWidth * scale), (int)(WriteableOutputImage.PixelHeight * scale), interpolationTypes); await UpdateOutputImage(); }
private async void CustomPageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { CustomConvolutionFilterDialog dialog = new CustomConvolutionFilterDialog(); ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Secondary) { WriteableOutputImage = WriteableBitmapCovolute.Convolute(WriteableOutputImage, await dialog.GetKernel()); AddToUndo(WriteableOutputImage.Clone()); await UpdateOutputImage(); } else { // The user clicked the CLoseButton, pressed ESC, Gamepad B, or the system back button. // Do nothing. } }
private async void MedianCustomPageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { MedianFilterDialog dialog = new MedianFilterDialog(); ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Secondary) { MedianFilterHelper.MedianFilter(WriteableOutputImage, dialog.MaskSize); AddToUndo(WriteableOutputImage.Clone()); await UpdateOutputImage(); } else { // The user clicked the CLoseButton, pressed ESC, Gamepad B, or the system back button. // Do nothing. } }
private async void DividePageMenuFlyoutItem_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { ThreeIntsDialog dialog = new ThreeIntsDialog("Divide", "Default value for empty or equal to 0 cell is 1", "Red", "Green", "Blue", false, true); ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Secondary) { int[] c = await dialog.GetValues(); AddToUndo(WriteableOutputImage.Clone()); ImageArithmeticHelper.DivideConstToImage(WriteableOutputImage, c[0], c[1], c[2]); await UpdateOutputImage(); } else { // The user clicked the CLoseButton, pressed ESC, Gamepad B, or the system back button. // Do nothing. } }
private async void GaussianBlurPageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { GaussianBlurDialog dialog = new GaussianBlurDialog(); ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Secondary) { var kernel = GaussianBlureHelper.CalculateKernel(dialog.SValue, dialog.SDValue); WriteableOutputImage = WriteableBitmapCovolute.Convolute(WriteableOutputImage, kernel); AddToUndo(WriteableOutputImage.Clone()); await UpdateOutputImage(); } else { // The user clicked the CLoseButton, pressed ESC, Gamepad B, or the system back button. // Do nothing. } }
private async void EntropySelectionPageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { AddToUndo(WriteableOutputImage.Clone()); int?threshold = null; if (ExtraThresholds.EntropySelectionCalculate(WriteableOutputImage, out threshold) == null) { ConvertToGrayScaleITUR_BT709PageMenuFlyoutItem_Click(null, null); ExtraThresholds.EntropySelectionCalculate(WriteableOutputImage, out threshold); } ContentDialog dialog = new ContentDialog { Title = "Binaryzation", Content = "Entropy Selection threshold value = " + threshold ?? "[Error]", CloseButtonText = "Ok" }; ContentDialogResult result = await dialog.ShowAsync(); await UpdateOutputImage(); }
private async void PercentageBlackSelectionPageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { ConvertToGrayScaleITUR_BT709PageMenuFlyoutItem_Click(null, null); PercentageBlackSelectionBinaryzationDialog dialog = new PercentageBlackSelectionBinaryzationDialog(); ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Secondary) { AddToUndo(WriteableOutputImage.Clone()); if (ExtraThresholds.PercentageBlackSelectionCalculate(WriteableOutputImage, dialog.TresholdValue) == null) { ConvertToGrayScaleITUR_BT709PageMenuFlyoutItem_Click(null, null); ExtraThresholds.PercentageBlackSelectionCalculate(WriteableOutputImage, dialog.TresholdValue); } await UpdateOutputImage(); } else { // The user clicked the CLoseButton, pressed ESC, Gamepad B, or the system back button. // Do nothing. } }