If your lighting is uneven, it is possible to correct the image. It depends on how uneven it is.
The basic idea is to average the brightness over a large area. The area must be 2 or 3 times larger than any details you are examining. For example, if you are trying to read some text that is 20 pixels high, you would want to use a 60x60 averaging filter to figure out the average intensity in that area. Once you have figured out the average background intensity, calculate a scaling factor for each pixel to get to a fixed brightness. Essentially, divide your desired background brightness by the pixel intensity. The final step is to apply this scaling to your original image.
Bruce
Bruce Ammons
Ammons Engineering