MATLAB Answers


Probelm in implementing Adaptive Histogram Equalization

Asked by Ghulam on 8 Oct 2019
Latest activity Answered by Image Analyst
on 8 Oct 2019
I am trying to implement Contrast Limited Adaptive Historgram Equalization an image using the command adapthisteq(I) but i am getting error like
"Error using adapthisteq
Expected input number 1, I, to be two-dimensional."
I have attached my image here, can anyone pls guide me the problem with it.
Note: since the file format of tif is not supported in the attachment, therefore i am attaching jpg format of my file.


What shows up for
This is the result
ans =
1728 1852 4

Sign in to comment.

2 Answers

Answer by Stephan
on 8 Oct 2019
Edited by Stephan
on 8 Oct 2019

  1 Comment

Thanks Stephan,
I also think that the issue is of dimensions, when i have converted the image into Gray image. there was no error and i was able to apply the CLAHE.

Sign in to comment.

Answer by Image Analyst
on 8 Oct 2019

Before calling adapthisteq(), cast the image to gray level if it's not already:
if ndims(I) == 3
I = rgb2gray(I)


Sign in to comment.