フィルターのクリア

problem with the use of medfilt2

4 ビュー (過去 30 日間)
joanna
joanna 2012 年 11 月 16 日
コメント済み: Image Analyst 2017 年 12 月 7 日
i want to reduce the noise of my image after i apply histogram equalization but i cannot seem to make it work.
I1 = rgb2gray(image1);
i1 = histeq(I1);
med1 = medfilt2(i1)
axes(handles.axes7);
imshow(med1);
  3 件のコメント
Walter Roberson
Walter Roberson 2012 年 11 月 16 日
try
imshow(med1, [])
Image Analyst
Image Analyst 2012 年 11 月 16 日
Should not be necessary unless image1 was a floating point rgb image, which would be very rare/unusual. If image1 is uint8, then I1 and i1 and med1 will all be uint8 also, and so [] would just scale the image for display but it should have displayed even with out that.

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2012 年 11 月 16 日
Try this code and see if it works.
image1 = imread('peppers.png');
I1 = rgb2gray(image1);
i1 = histeq(I1);
med1 = medfilt2(i1);
imshow(med1);
It's essentially your code and works fine for me.

Nidhi Adakoli
Nidhi Adakoli 2017 年 12 月 7 日
clc;
close all;
clear all;
f=imread('nid1.jpg');
% fg=rgb2gray(f);
figure(1);imshow(f,[]);
fn=imnoise(f, 'salt & pepper', 0.1);%add 10% salt & pepper noise
figure(2)
subplot(2,2,1);
imshow(f);title('original image');
subplot(2,2,2);
imshow(fn);title('10% salt & pepper noise');
% noise removal by using average filter
w=[1 1 1; 1 1 1;1 1 1]*(1/9);
f_avg1=imfilter(fn,w,'conv');
subplot(2,2,3);
imshow(f_avg1);title('average filtered image');
%noise removal by using median filter
f_med1=medfilt2(fn);
subplot(2,2,4);
imshow(f_med1);title('median filtered image');
I am finding problem with line number 19 that is using median Average filter, it shoots up an error!
  1 件のコメント
Image Analyst
Image Analyst 2017 年 12 月 7 日
You forgot to attach nid1.jpg and the error message. You should probably start your own question for this rather than tack onto Joanna's discussion.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by