How to Perform Contrast Enhancement of Color Image in MATLAB? (original) (raw)

Last Updated : 14 Aug, 2025

Color images in the RGB format consist of three channels: Red, Green and Blue. Any visible color is created by mixing these channels in varying proportions. When enhancing image contrast, especially for colored images, the appropriate method impacts the final appearance and color fidelity.

There are two approaches for enhancing the contrast of colour images:

Naive algorithm: Channel-wise Enhancement

Apply contrast enhancement of Red channel, Green channel and Blue channel separately. As a result, each color component will be enhanced accordingly and the resultant color combination will be very different from the original color combination.

**Steps for Naive algorithm:

**Function Used:

**Example:

To download the used sample, click here.

Matlab `

k=imread("apple.jpeg");

imshow(k,[]);

k(:,:,1)=histeq(k(:,:,1));

k(:,:,2)=histeq(k(:,:,2));

k(:,:,3)=histeq(k(:,:,3));

imshow(k,[]);

`

**Output:

Naive-

Naive Method

Standard Algorithm: (HSV-based Enhancement)

First, convert the RGB image into HSV format. H and S channels contain the color information while the V channel contains the brightness value which is similar to grayscale information. The idea is to apply contrast enhancement only of V channel keeping H and S undisturbed, this way the original color combination will be preserved and as a result, the resultant image will be of high quality.

**Steps:

**Function Used:

**Example:

k1=imread("apple.jpeg");

imshow(k1,[]);

k2=rgb2hsv(k1); k2(:,:,3)=histeq(k2(:,:,3)); k3=hsv2rgb(k2);

imshow(k3,[]);

`

**Output:

Standard-Method

Standard Method: HSV-based Enhancement