Projects

Colour Image Histogram Equalization

          This project describes about "Histogram Equalization Of a Colour Image". Here, We are using HSV(Hue,Saturation and Value)colour model for getting a clear histogram images.The HSV colour space is widely used to generate high quality computer graphics. It gives the color according to human perception.This imaging technique is useful in Bio-medical applications since the output of this process is used to detect the original colour of an image with different intensity levels using MATLAB software.

        Generally,gray scale histograms are obtined in image processing techniques.But, for real-time processing and image enhancement,there is a great need of colour histograms for applications like computer vision, optical sorting, remote sensing, medical image processing, morphological image processing etc..

PROGRAM:

close all;
clear all
clc;
I = imread('C:\Users\Priyanga\Downloads\images.jpg');
subplot(1,2,1);
imshow(I);
title('Colour Image');
I = im2double(I);
[index,map] = rgb2ind(I);
pixels =numel(index);
hsv = rgb2hsv(map);
h = hsv(:,1);
s = hsv(:,2);
v = hsv(:,3);
%Finds location of black and white pixels
darks = find(v < .2)';
lights = find(s < .05 & v > .85)';
h([darks lights]) = -1;
%Gets the number of all pixels for each color bin
black = length(darks)/pixels;
white = length(lights)/pixels;
red = length(find((h > .9167 | h <= .083) & h ~= -1))/pixels;
yellow = length(find(h > .083 & h <= .25))/pixels;
green = length(find(h > .25 & h <= .4167))/pixels;
cyan = length(find(h > .4167 & h <= .5833))/pixels;
blue = length(find(h > .5833 & h <= .75))/pixels;
magenta = length(find(h > .75 & h <= .9167))/pixels;
%Plots histogram
subplot(1,2,2);
hold on
fill([0 0 1 1],[0 red red 0],'r')
fill([1 1 2 2],[0 yellow yellow 0],'y')
fill([2 2 3 3],[0 green green 0],'g')
fill([3 3 4 4],[0 cyan cyan 0],'c')
fill([4 4 5 5],[0 blue blue 0],'b')
fill([5 5 6 6],[0 magenta magenta 0],'m')
fill([6 6 7 7],[0 white white 0],'w')
fill([7 7 8 8],[0 black black 0],'k')
axis([0 8 0 1]);
xlabel('Intensity Level-->');
ylabel('Number of Pixels-->');
title('Histigram of Color Image'); 
     


Tags :
3.125
Your rating: None Average: 3.1 (8 votes)

Posted by



Sat, 30/04/2011 - 19:42

Share

Collaborate