Error using histeq Expected input number 1, I, to be two-dimensional. Error in histeq (line 70) validateattributes(a,{'uint8','uint16','double','int16','single'}, ...
Show older comments
my code is
a=imread('cameraman.jpg');
r=size(a,1);
c=size(a,2);
ah=uint8(zeros(r,c));
n=r*c;
f=zeros(256,1);
pdf=zeros(256,1);
cdf=zeros(256,1);
out=zeros(256,1);
for i=1:r
for j=1:c
value=a(i,j);
f(value+1)= f(value+1)+1;
pdf(value+1)= f(value+1)/n;
end
end
sum=0; l=255;
for i=size(pdf)
sum=sum+f(i);
cum(i)=sum;
cdf(i)=cum(i)/n;
out(i)=round(cdf(i)*l);
end
for i=1:r
for j=1:c
ah(i,j)=out(a(i,j)+1);
end
end
figure,imshow(ah);
he=histeq(a);
figure,inshow(he);
I am getting an error as,
Error using histeq
Expected input number 1, I, to be two-dimensional.
Error in histeq (line 70)
validateattributes(a,{'uint8','uint16','double','int16','single'}, ...
Error in Untitled5 (line 40)
he=histeq(a);
can somebody help me in this
Thanks in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Image Preview and Device Configuration 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!