Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VS2008 C# image ImageProcessing , +
hello,
using VS2008 c# [windows mobile 6.5]
how to normalization image (picture) after I take picture with camera.
if result is too dark then add value in all pixel,
otherwise if result is too bright then reduced value pixel of the picture.
"not too bright or dark"
process run automatic after show result and show to picturebox.
 
please give me sample code Big Grin | :-D
thanks before.
Posted 26-Jun-11 22:23pm
Comments
Vivek Krishnamurthy at 27-Jun-11 3:25am
   
Good luck !
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You should perform gamma-correction of the image. Please see this article of comprehensive explanation: http://en.wikipedia.org/wiki/Gamma_correction[^].
 
Coding this is really trivial and depends on what you're using, System.Drawing of WPF.
 
—SA
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I have C# image processing filters on this very site, try reading my article.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

A way to achieve this is to compute the average intensity of your image and setting the offset constant so that this average becomes 127.
 
You do this in two passes over the image:
- Pass 1: accumulate all Red, Green, Blue values into an integer variable.
- Compute Offset= 127 - Accumulator / (3 * pixel count);
- Pass 2: add the offset to all Red, Green, Blue values, with saturation.
 
Saturation is done by the following formula: Red= (Red < 0) ? 0 : ((Red > 255) ? 255 : Red); and similarly for the other components.
 
[You may also want to normalize the contrast in addition to the intensity. This implies the computation of both the average and the standard deviation, and applying a linear transform with two constants.]
  Permalink  
Comments
bagus bujangga at 27-Jun-11 22:34pm
   
I have image 320 * 240 pixel
 
Pass 1: accumulate (R + G + B)
exp: accumulate = (57+25+154) = 236
 
Offset = 127 - 236 / (3 * 76800); here 76800 from 320*240
so offset is -4.730902777777778e-4
 
what wrong??
SAKryukov at 27-Jun-11 22:45pm
   
Don't even try it; the idea is completely incorrect; this is non-linear conversion, will never work as you expect.
--SA
YDaoust at 28-Jun-11 3:18am
   
@Bagus:
Your computation gives 126.99897569444, not -4.730902777777778e-4 (check operator precedence).
But you didn't accumulate, you just took values from a single pixel. You should have computed Offset = 127 - 236 / (3 * 1) = 48.3333, which gives you the corrected pixel (105, 73, 202).
YDaoust at 28-Jun-11 3:27am
   
@SAKKryukov:
Why do you say that Bagus is wrong? His transform has exactly the effect of brightness adjustment as you find on most display screens.
 
Combined with contrast adjustment, this gives you the very classical way of doing contrast stretching.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 295
1 DamithSL 265
2 CPallini 235
3 Maciej Los 190
4 Sergey Alexandrovich Kryukov 174
0 OriginalGriff 5,415
1 DamithSL 4,422
2 Maciej Los 3,820
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,911


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 27 Jun 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100