Victor Image Processing Library How-to Tips

Control Image Processing with a Slider




How to control image processing with a slider, C# source code
Windows 8 [Windows Store apps only]

This example demonstrates setting the slider limits to correspond to the minimum and maximum amounts the brightness can be changed with the Victor changebright function. When the value of the slider is changed the event handler calls the changebright function to do the image processing.
Requires Victor Image Processing Library for 32-bit Windows, v 6 or higher and the Victor Library .Net namespace viclib_w8.

        // ----------------------------  Slider defined in MainPage.xaml  --------------------------------------------------------
        <TextBlock 
            x:Name="tb1" 
            HorizontalAlignment="Left" 
            Height="15" 
            Margin="22,176,0,0" 
            TextWrapping="Wrap" 
            Text="Brightness" 
            VerticalAlignment="Top" 
            Width="277"/>
            
        <Slider   
            x:Name="s_amount" 
            HorizontalAlignment="Left" 
            Height="44" 
            Margin="22,176,0,0" 
            VerticalAlignment="Top" 
            Width="277" 
            Maximum="255" 
            Minimum="-256" 
            ValueChanged="s_amount_changed" 
            LostFocus="s_lost_focus">
                                                              

        // ----------------------------  Event Handler defined in MainPage.xaml.cs --------------------------------------------------------
        private void s_amount_changed(object sender, RangeBaseValueChangedEventArgs e)
        {
            int rcode;
            int new_amount;
            new_amount = (int)e.NewValue;
            rcode = vicwin_ws.changebright(new_amount, ref simage, ref rimage);
            if (rcode == vicwin_ws.NO_ERROR)
            {
                // Success, redisplay global simage, defined in Victor Brightenator Windows Store example
                show_image_now();
            }
        }
Victor Image Processing Library

Victor Image Processing Library homepage | Victor Product Summary | more source code




Copyright © 2013 Catenary Systems Inc. All rights reserved. Victor Image Processing Library is a trademark of Catenary Systems.