Hi Hasanien,
You can use the "sobel" operator to compute the gradients of your fingerprint image. To find the angle (in radians) formed by the gradient vectors, you can use MATLAB's "atan2" function.
Below is a reference code snippet for your task. Make sure to replace the image file with your own.
% Read the fingerprint image
fingerprint = imread('fingerprint.png'); % replace with your image file
% Convert to grayscale if it's not already
if size(fingerprint, 3) == 3
fingerprint = rgb2gray(fingerprint);
end
% Use Sobel operator to get gradients
Gx = fspecial('sobel');
Gy = Gx';
% Calculate gradients
Ix = imfilter(double(fingerprint), Gx);
Iy = imfilter(double(fingerprint), Gy);
% Calculate the flow direction (angle)
flowDirection = atan2(Iy, Ix);
% Display the flow direction
imshow(flowDirection, []);
title('Flow Direction of Fingerprint Ridges');
colormap(hsv); % Use a color map to better visualize directions
colorbar;
For more information about the "sobel" operator and the "atan2" function, please refer to the following documentation links: