Hi i have a problem executing a loop to change the brightness of an image
i have all the colour pixels and everytime the trackerbar moves it will decrease the pixels by 1 - i need to do this from 0 to 255 and vice a versa
can anyone help?
Printable View
Hi i have a problem executing a loop to change the brightness of an image
i have all the colour pixels and everytime the trackerbar moves it will decrease the pixels by 1 - i need to do this from 0 to 255 and vice a versa
can anyone help?
:confused:
Can you post your code so we might be able to help you.
this is what i have soo far
Code:ProgressBar1->Min = 0;
ProgressBar1->Max = imgImage->Picture->Bitmap->Height;
for (int y=0; y < imgImage->Picture->Bitmap->Height; y++)
{
for (int x=0; x < imgImage->Picture->Bitmap->Width; x++)
{
// Array index in pascal form
Pixel.Colours = imgImage->Canvas->Pixels[x][y];
Pixel.Channel.Red = 255;
Pixel.Channel.Green = 255;
Pixel.Channel.Blue = 255;
imgImage->Canvas->Pixels[x][y] = Pixel.Colours;
}
ProgressBar1->Position = y;
}
imgImage->Repaint();
ProgressBar1->Position = 0;
}
si = gi + brightness
si is the grayscale value of the brightness enhanced image pixel and gi is the original image grayscale pixel value.
Have fun :wave:
well i have tried working on it and have come up with a loop that changes the pixel value when the trackbar is moved
but when i look at it i realise im just setting it not continues if you know what i meanCode:for (int y=0; y < Bitmap->Height; y++)
{
for (int x=0; x < Bitmap->Width; x++)
{
ImagePixels->Red = TrackBar2->Position;
ImagePixels->Green = TrackBar2->Position;
ImagePixels->Blue = TrackBar2->Position;
ImagePixels++ ;
}
}
imgImage->Repaint();
how can i change it so that it will work?
Re-read Deniz's post :D
You need to add/subtract, not just assign.