Color Adjusting

Q:  My image is too dark or too bright. How can I adjust the colors of the image?

A:  There are a lot of possible causes for an image to be too dark or too bright. The image can be either over or underexposed, and improper lighting conditions can also corrupt the image. Due to the variety of reasons, there are many solutions available for this problem. The improper lighing and exposing conditions can be eliminated by the histogram equalization (HistDIBEqualization) operation implemented in BIFILTER.Dll. This function will stretch out the pixel values, so the information of the image will not be concentrated into a small region of the possible values. It’s important, that when using this function, the new value of a pixel depends only on it’s original value. If a local region dependent function is needed, use the filter functions.


There are many other ways to manipulate the darkness of an image. ColorBrightnessContrast, ColorCMYKLevels, ColorHueSaturation, and GammaCorrectionfunctions also can adjust the colors of an image. These functions are implemented in BIIMAGE.Dll. All the functions above will manipulate all colors of the image. There can be some cases, when adjusting only one color is needed. In this case use ReplaceColor function also implemented in BIIMAGE.Dll. If the preview dialog is used, the input parameters of the filtering can be changed onscreen, so the optimal properties of the filtering can be tuned.

 

Code example:

       #include “BiFilter.h”

       #include “BiImage.h”

       HANDLE hSourceDib = NULL;

       //       Load the input image

       …

       HANDLE hEqDib = HistDIBEqualization(hSourceDIB, DISPLAY_BOTH, AfxGetMainWnd()->m_hWnd);

       HANDLE hGCorrectedDib = GammaCorrection(hEqDib, 100, 100, 100, DISPLAY_BOTH, AfxGetMainWnd()->m_hWnd);

       //       Further processing