Anisotropic diffusion for a fingerprint image: resolution issues.

33 views (last 30 days)
Hello,
I have been trying to understand how to successfully use matlab in-built anisotropic diffusion function (imdiffusefilt). To test the function I chose a fingerprint image (that has some noise and some gaps) as my input image. The fingerprint image (.gif) was dowloaded from this url. Incase the hyperlink does not work here is the link: https://www.mia.uni-saarland.de/weickert/demos.html.
There are two images (on 2nd row) under the tittle Gap completion by coherence-enhancing anisotropic diffusion. I will upload the images (1st one is my input image, and 2nd one is the desired result that I am unable to achieve) here as well.
This is the input image (gif):
This is the desired output:
I tried to run 'imdiffusefilt' with default setting, and then ran it with estimated parameters (using 'imdiffuseest' function). My result for the latter is worse. I am going to upload my code below. Any tip/advice on this would be great. Thanks everyone, in advance!
Here is my code:
close all
clear all
%% Read image file
img = imread('finger2.gif');
%% Calculate diffusion parameters (to be used in imdiffusefilt below)
[gradThresh,numIter] = imdiffuseest(img);
%% Check pixel value frequencies (histogram)
figure(11)
histogram(img,805)
%% Apply anisotropic diffusion (imdiffusefilt)
img_diffusion = imdiffusefilt(img,'NumberOfIterations',5); % using default parameters
%% Anisotropic diffusion (using estimated parameters)
% img_diffusion = imdiffusefilt(img,'connectivity','maximal', ...
% 'ConductionMethod','exponential', 'GradientThreshold',gradThresh, ...
% 'NumberOfIterations',numIter);
%% Display the results (original vs anisotropic diffustion)
figure(1)
montage({img,img_diffusion},'ThumbnailSize',[1000,700])
title([' Original Imgae (Left) vs. ' ...
'Smoothing w/ Anisotropic Diffusion (Right)'])

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 8 Aug 2022
You might find that you have more control over the anisotropic diffusion with the cedif or eedif functions from the nonlinear-diffusion-toolbox. You might have to doodle around to find the best selection of input-parameters and combination of ordinary filtering and nonlinear isotropic and anisotropic filtering to suit your case. Definitely have a look at that toolbox and its demos and documentation.
HTH
  24 Comments
Walter Roberson
Walter Roberson on 7 Sep 2022 at 20:02
imwrite(rescale(flipud(zm), 'InputMin', -1000, 'InputMax', 1500),'test2.png');

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!