简体   繁体   中英

Using trackbar to adjust color filter of an image

I m trying to do wat my title above says however im there is no change on my pic when i scroll the trackbar. i noe there is sth missing in my code ... can anyone help me out with this ? greatly appreciate it.

private void SetTrackBarProp()
    {
        trackBar1.Maximum = 255;
        trackBar1.Minimum = 0;
        trackBar1.TickFrequency = 1;
    }

    private Bitmap ApplyRGBFilter(Bitmap pic2)
    {
        ColorFiltering filter = new ColorFiltering();
        filter.Red = new IntRange(0, red);
        filter.Blue = new IntRange(0, blue);
        filter.Green = new IntRange(0, green);
        Bitmap processedImage = filter.Apply(pic2);
        return processedImage;
    }

    void picturebox2(object sender, PaintEventArgs e)
    {

        pictureBox2.Image = ApplyRGBFilter(pic2);
    }


    private void trackBar1_Scroll(object sender, EventArgs e)
    {
        red = trackBar1.Value;
    }

Above is just a snippet of my code on the filtering part, "pic2" is the image that i can browsed from my computer with the browse button i had in my application. pictureBox2 will be the place where my pic2 will appear. THANKS A LOT IN ADVANCE !

It is not clear that the header files for the ColorFiltering function. The only drawback of this Program is note of Header files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM