Anisotropic diffusion for a fingerprint image: resolution issues.

6 visualizaciones (últimos 30 días)
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)'])

Respuesta aceptada

Bjorn Gustavsson
Bjorn Gustavsson el 8 de Ag. de 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
  25 comentarios
Walter Roberson
Walter Roberson el 7 de Sept. de 2022
imwrite(rescale(flipud(zm), 'InputMin', -1000, 'InputMax', 1500),'test2.png');
Jay Ghosh
Jay Ghosh el 25 de Jun. de 2023
Editada: Jay Ghosh el 25 de Jun. de 2023
@Bjorn Gustavsson, I have been finally able to get back to running difusion for part of my research. Now, I have been running diffusion on original data, instead of on an image file (your advise was to do the analysis on the data).
The functions I have been using are 'cedif' and 'CorerenceFilter' (both from file exchange). For both the functions, I have noticed that the diffusion results are not the same as it was for an image file (0-255) as an input. For original data (range:(-290,273)) as an input, I have to run much longer diffusion timesteps to get similar results, but also diffusion output just does not look as sharp (in terms of preserving edges) as it did before. For an input image file, for 'CoherenceFilter', only a timestep of 20 (T=20) produced some good diffusion output, however, for input data (-290,273), it requres more timesteps to see detectable diffusion, and results are a lot more blurry than it was for an image input.
I was wondering if it has anything to do with the fact that data file has negative values (w/ mean being close to zero), and/or the fact that data file has longer range (-290,273) compared to an image file (0-255). The function description, for both cedif and CoherenceFilter says that input is an image file.
Would you have any thoughts on this? Thank you very much!

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by