Click here to Skip to main content
15,896,606 members
Articles / General Programming / Algorithms

Using the System.Numerics.BigInteger class for computer vision and binary morphology operations in C# 4.0

Rate me:
Please Sign up or sign in to vote.
4.91/5 (18 votes)
2 Oct 2010CPOL16 min read 73.1K   1.8K   30  
A simple framework to perform morphology operations on binary images.
<Window x:Class="ImageProcessingDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="620" Width="961">
    <Grid>
        <Button Content="Load Image" Margin="0,0,18,17" Name="buttonLoadImage" Click="buttonLoadImages_Click" HorizontalAlignment="Right" Width="252" Height="36" VerticalAlignment="Bottom" />
        <Border BorderBrush="Silver" BorderThickness="1" Margin="18,11,281,91" Name="border1" ClipToBounds="True" MouseWheel="image1_MouseWheel" MouseLeftButtonUp="image1_MouseLeftButtonUp" MouseMove="image1_MouseMove" MouseLeftButtonDown="image1_MouseLeftButtonDown">
            <Image Name="image1" Stretch="Fill" Height="228" Width="455" />
        </Border>
        <GroupBox Header="Display" Height="154" HorizontalAlignment="Right" Margin="0,0,12,138" Name="groupBox1" VerticalAlignment="Bottom" Width="258"></GroupBox>
        <TextBox Height="34" Margin="105,0,339,12" Name="textBoxChannel1File" VerticalAlignment="Bottom" />
        <Button Content="..." Height="34" HorizontalAlignment="Right" Margin="0,0,281,17" Name="buttonLoadChannel1" VerticalAlignment="Bottom" Width="41" Click="buttonLoadChannel1_Click" />
        <Label Content="Tiff Image" Height="29" HorizontalAlignment="Left" Margin="16,0,0,12" Name="label4" VerticalAlignment="Bottom" Width="90" />
        <Button Content="Run / Refresh Algo" HorizontalAlignment="Right" Margin="0,0,18,96" Name="buttonRefreshAlgo" Width="252" Height="31" VerticalAlignment="Bottom" Click="buttonRefreshAlgo_Click" />
        <ScrollBar Height="27" HorizontalAlignment="Left" LargeChange="50" Margin="102,0,0,56" Name="scrollBarThreshold" Orientation="Horizontal" SmallChange="20" Value="25" VerticalAlignment="Bottom" Width="113" Maximum="100"  />
        <Label Content="Threshold" Height="29" HorizontalAlignment="Left" Margin="27,0,0,56" Name="label13" VerticalAlignment="Bottom" Width="117" />
        <Grid Margin="0,0,18,145" HorizontalAlignment="Right" Width="246" Height="131" VerticalAlignment="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="125*" />
                <ColumnDefinition Width="121*" />
            </Grid.ColumnDefinitions>
            <RadioButton Content="Erode" GroupName="View" Height="16" HorizontalAlignment="Left" Margin="10,32,0,0" Name="radioButtonErode" VerticalAlignment="Top" Checked="radioButtonErode_Checked" />
            <RadioButton Content="Dilate" GroupName="View" Height="16" HorizontalAlignment="Left" Margin="10,10,0,0" Name="radioButtonDilate" VerticalAlignment="Top" IsChecked="True" Checked="radioButtonDilate_Checked" />
            <RadioButton Content="Perimeter" GroupName="View" Height="16" HorizontalAlignment="Left" Margin="10,54,0,0" Name="radioButtonPerimeter" VerticalAlignment="Top" Checked="radioButtonPerimeter_Checked" />
            <RadioButton Content="Minority" GroupName="View" Height="16" HorizontalAlignment="Left" Margin="10,76,0,0" Name="radioButtonMinority" VerticalAlignment="Top" Checked="radioButtonMinority_Checked" />
            <TextBox Height="22" Margin="101,91,0,0" Name="textBoxMinority" VerticalAlignment="Top" Text="5" HorizontalAlignment="Left" Width="25" Grid.ColumnSpan="2" />
            <RadioButton Content="Majority" GroupName="View" Height="16" HorizontalAlignment="Left" Margin="10,97,0,0" Name="radioButtonMajority" VerticalAlignment="Top" Checked="radioButtonMajority_Checked" />
        </Grid>
    </Grid>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
I am a software engineer at Illumina Inc. I am interested in image and signal processing related problems.
my blog: http://gery.vessere.com

Comments and Discussions