How do I use IMFILTER to high pass filter an image?

How can I high pass filter an image (A) using IMFILTER(A,H)? What must the filter matrix (H) be to perform a high pass filter?

 Respuesta aceptada

Ashish Uthama
Ashish Uthama el 5 de Ag. de 2011

2 votos

This tutorial might help.

5 comentarios

I've never seen a panda (the web site's example image) look like that. Looks more like a house cat to me.
One could hypothesize that it is a picture of a Red Panda, which is a small whiskered mammal about the size of a small dog. However, the ears are clearly not right for a red panda. Felis Catus, also known as Felis Domesticus, would seem to be a much better match.
Ivan Spector
Ivan Spector el 27 de Abr. de 2022
Is the tutorial link above still live? I could not access it and had the same quesiton.
It looks like the tutorial is no longer online. The link to the course is:

Iniciar sesión para comentar.

Más respuestas (3)

Image Analyst
Image Analyst el 6 de Ag. de 2011
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 20;
% Read in a standard MATLAB gray scale demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
baseFileName = 'cameraman.tif';
fullFileName = fullfile(folder, baseFileName);
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
if ~exist(fullFileName, 'file')
% Didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage = imread(fullFileName);
% Get the dimensions of the image. numberOfColorBands should be = 1.
[rows columns numberOfColorBands] = size(grayImage);
% Display the original gray scale image.
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Position', get(0,'Screensize'));
set(gcf,'name','Demo by ImageAnalyst','numbertitle','off')
% Filter 1
kernel1 = -1 * ones(3)/9;
kernel1(2,2) = 8/9
% Filter the image. Need to cast to single so it can be floating point
% which allows the image to have negative values.
filteredImage = imfilter(single(grayImage), kernel1);
% Display the image.
subplot(2, 2, 2);
imshow(filteredImage, []);
title('Filtered Image', 'FontSize', fontSize);
% Filter 2
kernel2 = [-1 -2 -1; -2 12 -2; -1 -2 -1]/16;
% Filter the image. Need to cast to single so it can be floating point
% which allows the image to have negative values.
filteredImage = imfilter(single(grayImage), kernel2);
% Display the image.
subplot(2, 2, 3);
imshow(filteredImage, []);
title('Filtered Image', 'FontSize', fontSize);

2 comentarios

+1, tagging as a tutorial
Image Analyst
Image Analyst el 12 de Oct. de 2011
I've never heard of filter1. imfilter and filter2 should give the same answer.

Iniciar sesión para comentar.

Tony
Tony el 9 de Ag. de 2011

0 votos

A typical high-pass (or high emphasize filter) would be an unsharp mask.
H = fspecial('unsharp');
Pramod Bhat
Pramod Bhat el 25 de Ag. de 2011

0 votos

Simple averaging your image can fulfill your need if u are not particular with the pass band.

Categorías

Más información sobre Image Processing Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 5 de Ag. de 2011

Comentada:

DGM
el 27 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by