of sample c the very dark pixels is more than 75 percent at step 430 then the image is considered as seriously underexposed in this case the exposure gain is incremented by the higher value h at step 432 finally if none of the other steps are true the relative number of samples b that is moderately dark pixels that are not very dark are tested at 440 if this value is more than 75 percent detected at step 416 then the image is considered as moderately dark at 442 a tuning increment t is added to the exposure or gain this can be carried out on a frame by frame basis these thresholds can also be programmable to allow more bright or dark scenes the programmable thresholds can be made by user manual intervention or by an automatic intervention from the computer system fig5 shows a bar chart showing the placement of the pixels within groups a b or c similar to that in fig3 an example circuitry is shown in fig6 it should be understood that this circuitry is exemplary only and that other similar circuits could be easily formed using either a processor or hard wire gates using hardware definition language of course this operation could also be carried out using a programmed processor fig7 shows results of a simulation using a simple test.