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

1 回表示 (過去 30 日間)
seshi reddy
seshi reddy 2014 年 6 月 24 日
コメント済み: Image Analyst 2020 年 4 月 1 日
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 Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by