Urgent - How to identify given image is too dark or light
-
By taking a look at it I suppose... Please don't mark your topic with the word Urgent.
Waldermort
-
images are made of pixel, then every pixel has got a color, the color is a combination of red-green-blue (RGB). white is RGB(255,255,255), black is RGB(0,0,0). Convert your image in a gray scale: take the color of every pixel (r,g,b) then compute c=(r+g+b)/3, so the gray pixel of a new image can be RGB(c,c,c), but you can simply store c somewhere. Then compute the mean value of c on all the image and compare it with a treshold. do something like this: if c_mean is less then 50 the image is too dark if c_mean is greater then 200 the image is too light hope helps :-D
Russell
-
By taking a look at it I suppose... Please don't mark your topic with the word Urgent.
Waldermort
WalderMort wrote:
Please don't mark your topic with the word Urgent.
'5' for this :-D
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
images are made of pixel, then every pixel has got a color, the color is a combination of red-green-blue (RGB). white is RGB(255,255,255), black is RGB(0,0,0). Convert your image in a gray scale: take the color of every pixel (r,g,b) then compute c=(r+g+b)/3, so the gray pixel of a new image can be RGB(c,c,c), but you can simply store c somewhere. Then compute the mean value of c on all the image and compare it with a treshold. do something like this: if c_mean is less then 50 the image is too dark if c_mean is greater then 200 the image is too light hope helps :-D
Russell
-
Russell` wrote:
compute c=(r+g+b)/3,
But the brightness is not simply the average, right? Red has low intensity compared to others. I dont remember the exact ratio.
- NS -
-
I think you are right. If you find the right formula please post it here, I'll be happy to learn it. :-D In this case I think that him doesn't need an accurate extraction of the gray-scale, the simple formula (r+g+b)/3 can be enough.
Russell
-
Russell` wrote:
If you find the right formula please post it here
The one I know is Y = 0.3*R + 0.59*G + 0.11*B
Russell` wrote:
the simple formula (r+g+b)/3 can be enough
If it is not for human recognition... right?
- NS -
-
Russell` wrote:
If you find the right formula please post it here
The one I know is Y = 0.3*R + 0.59*G + 0.11*B
Russell` wrote:
the simple formula (r+g+b)/3 can be enough
If it is not for human recognition... right?
- NS -
What exactly are those constants 0.3 , 0.59 and 0.11 ?
Sreedhar DV [Real success is having courage to meet failure without being defeated.]
-
What exactly are those constants 0.3 , 0.59 and 0.11 ?
Sreedhar DV [Real success is having courage to meet failure without being defeated.]