Error in computing median filter and histogram equalization on an image. How can i solve it?

5 views (last 30 days)
I am trying to perform median filter on an image using simple median filter code like this
a = imread('1a.jpg');
figure; imshow (a)
b = imnoise(a,'salt & pepper',0.02);
figure; imshow (b)
c = medfilt2(b);
figure; imshow (c)
but i am getting this error:
Error using medfilt2
Expected input number 1, A, to be two-dimensional.
Error in medfilt2>parse_inputs (line 107)
validateattributes(a, ...
Error in medfilt2 (line 48)
[a, mn, padopt] = parse_inputs(varargin{:});
Error in medianFilter (line 11)
c = medfilt2(b);
Also when i tried to perform histogram equalization also using this code
a = imread('1a.jpg');
img_eq = histeq(a);
figure; imshow(img_eq);
I also get this error:
Error using histeq
Expected input number 1, I, to be two-dimensional.
Error in histeq (line 69)
validateattributes(a,{'uint8','uint16','double','int16','single'}, ...
Error in Histogramequalization (line 13)
img_eq = histeq(a);
How can i go about it pls.
Here are the two types of images i used.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!