-
March 21st, 2007, 06:51 AM
#1
Brightness
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?
-
March 21st, 2007, 07:45 AM
#2
Re: Brightness
Can you post your code so we might be able to help you.
-
March 21st, 2007, 08:04 AM
#3
Re: Brightness
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;
}
Last edited by sara666; March 21st, 2007 at 08:08 AM.
-
March 21st, 2007, 07:05 PM
#4
Re: Brightness
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
Microsoft LVP - Least Valuable Professional
Please rate this post... Pleeeeeeaaassee!!!
-
March 25th, 2007, 08:22 AM
#5
Re: Brightness
well i have tried working on it and have come up with a loop that changes the pixel value when the trackbar is moved
Code:
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();
but when i look at it i realise im just setting it not continues if you know what i mean
how can i change it so that it will work?
-
March 25th, 2007, 10:00 AM
#6
Re: Brightness
Re-read Deniz's post
You need to add/subtract, not just assign.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|