how to apply histogram and median filters for a jpg imag??

1 次查看(过去 30 天)
when i apply to the image it is showing error
Error using medfilt2
Expected input number 1, A, to be two-dimensional.
Error in medfilt2>parse_inputs (line 110)
validateattributes(a, {'numeric','logical'}, {'2d','real'}, mfilename, 'A', 1);
Error in medfilt2 (line 47)
[a, mn, padopt] = parse_inputs(varargin{:});
Error in medhistfilter (line 7)
m=medfilt2(pic);
how do i overcome this??
  9 个评论
Image Analyst
Image Analyst 2014-6-24
Sorry, I don't see in your code where you area extracting one color channel or are calling rgb2gray(). Where is that?
seshi reddy
seshi reddy 2014-6-24
clear;
clc;
pic=imread('C:\masters courses\applications of dsp\project2\GW_1200.jpg');
grayImage = rgb2gray(pic);
subplot(3,3,1);
imshow(grayimage);
title('original image');
m=medfilt2(grayimage);
subplot(3,3,2);
imshow(m);
title('Median Fileter of image');
a10=histeq(grayimage);
subplot(3,3,3);
imshow(a10);
title('Histogram equalization of image');

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2014-6-24
pic is probably a color image. Either take one of the color channels
oneChannel = pic(:,:,2); % Take green channel.
or convert to gray scale
grayImage = rgb2gray(pic);
  7 个评论
Abdulmu'min Musa
Abdulmu'min Musa 2020-4-1
Thanks, but what i mean here is that i dont want to use the "subplot" code but the "figure" code, so that each of the image will be displayed seperately.
I want to create a new figure window to display the gray image, another figure window to display median filtered image and another figure window to display histogram equalized image.
Pls help. Thanks
Image Analyst
Image Analyst 2020-4-1
Well just make the obvious change to replace subplot with figure;
figure; % Bring up an empty, new figure window.
imshow(grayImage); % Show original image
figure; % Bring up an empty, new figure window.
imshow(medianImage); % Show median filtered image
figure; % Bring up an empty, new figure window.
imshow(equalizedImage); % Show histogram equalized image

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by