MATLAB Answers

Sajid Khan

Please help me implementing code of histogram equalization.

Asked by Sajid Khan
on 31 Oct 2012

Hi there, am trying to implement histogram equalization, I have implemented the following code,

function [ output_image ] = mod_hist( input_image ) close all clc %UNTITLED Summary of this function goes here % Detailed explanation goes here output_image = zeros(size(input_image)); for j = 1:size(input_image,3) hist_image = imhist(input_image(:,:,j)); figure, plot(hist_image) normalized_sum = zeros(size(hist_image)); for i = 0:255 normalized_sum(i+1,1) = round(sum(hist_image(1:i+1,1)).*(255/sum(hist_image))) [row,col] = find(input_image(:,:,j) == i); output_image(row,col,j) = normalized_sum(i+1,1); end end figure, imshow(input_image) figure, plot(input_image); title('histogram of input image') figure, plot(normalized_sum); title('histogram of normalized image') figure, plot(imhist(output_image)); title('histogram of output image') figure,imshow(output_image) end

But its not working, can anyone please tell me whats the problem with it

Regards, Sajid Khan




0 Answers

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!