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

조회 수: 2 (최근 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 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