I am not sure how i can get histogram both the fig which i looked in are the same.. Anybody help me in completing the code.
Show older comments
clc;
close all;
clear all;
img=imread('C:\UsersDesktop\dipproj2\lena.bmp');
[p,q]=size(img)
k=1:0:256;
x= ones(1,256);
for k=1:0:256
for i=1:size(p,1)
for j=1:size(q,1)
k=value(256,i)
% if (img(i,j)==k)
% x(k+1)=x(k+1)+1;
x(k+1)=x(k+1)+1;
end
end
end
d=zeros(1,256);
d=x*(1/(p*q));
s=sum(k+1)
s(1)=d(1,1);
for i=2:256
s(i)=s(i-1)+d(1,i);
end
y=ones(1,256);
u=y*256
%sk=255*s;
z=floor(u);
final=img;
for k=0:256
for i=1:size(256,1)
for j=1:size(256,1)
if(img(i,j)==k)
final(i,j)=z(1,k+1)+1;
end
end
end
end
figure(1),
subplot(2,1,1),
title('histogram'),
imagesc(final),
colormap(gray);
subplot(2,1,2),
imhist(final);
figure(2),
subplot(2,1,1),
title('histogram1'),
imagesc(img),
colormap(gray);
subplot(2,1,2),
imhist(img);
1 Comment
Image Analyst
on 28 Oct 2012
What do you think this line will do:
for k=1:0:256
You have a step size of 0!!!!
Accepted Answer
More Answers (0)
Categories
Find more on Display Image in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!