Anisotropic diffusion for a fingerprint image: resolution issues.
46 views (last 30 days)
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:
%% 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)
%% 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, ...
%% Display the results (original vs anisotropic diffustion)
title([' Original Imgae (Left) vs. ' ...
'Smoothing w/ Anisotropic Diffusion (Right)'])
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.