how to remove error ??? Error using ==> iptcheckinput Function MEDFILT2 expected its first input, A, to be two-dimensional. Error in ==> medfilt2>parse_inputs at 109 iptcheckinput(a, {'numeric','logical'}, {'2d','real'}, mfilename, 'A', 1); Error i
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Amin ur Rehman
am 28 Dez. 2015
Beantwortet: DGM
am 11 Dez. 2024 um 23:01
>> i=imread('chm.jpg'); imshow(i) noisy_img = imnoise(i,'salt & pepper',0.02); imshow(noisy_img) k = medfilt2(noisy_img); close all; subplot(211);imshow(noisy_img); subplot(212); imshow(k);
0 Kommentare
Akzeptierte Antwort
DGM
am 11 Dez. 2024 um 23:01
The image is a JPG. Most JPGs are RGB. Medfilt2() only accepts a single-channel input. You either need to make the input single-channel (gray), or you need to filter it channelwise. Alternatively, you can use medfilt3() with a single-page window specification.
% the inputs
inpict = imread('peppers.png');
winsize = [9 9];
% use medfilt2() in a loop
op1 = inpict;
for c = 1:size(inpict,3)
op1(:,:,c) = medfilt2(inpict(:,:,c),winsize,'symmetric');
end
% use medfilt3() with the window depth set to 1
op2 = medfilt3(inpict,[winsize 1],'symmetric');
% the results are identical
immse(op1,op2)
% show it
imshow(op2)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Visualization and Data Export finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!