When the gradients magnitude is small the edge angles are poorly defined. I would normally set a threshold on the magnitude and only calculate the angles for the pixels above the threshold. In your case it maybe that you only calculate the angles at the pixels that the cannny filter finds an edge.
Matlab/OpenCV create angle image
-
18-10-2022 - |
Question
I am following the instructions of the following paper (basically just page 2):
http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=05649943
As described in the paper, I want to do the following:
- I have an image --> Extract face rectangles
- Create edge images (using Canny)
- Create distance images (using
bwdist
in MatLab) - Create angle image
The process looks like the following:
And described here:
And I am stuck at step 4: creating the angle image.
I am using Matlab to create the angle image:
im = imread(['face_images/faces/' ims(i).name]);
I = rgb2gray(im);
[Gmag, Gdir]=imgradient(I);
GdirI=(Gdir+180)*(255/360);
imwrite(GdirI, ims(i).name);
end
But I am not getting the images that are presented in the last row in the paper. Do I have to give the edge images as input or the original images? Because I am using the original images right now...
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow