Hi all, I am trying calculate fp orientation using equation given the image (Jain 1995). I am only getting two values 2.3562 and 0.7875 rad(45 deg and 135 deg) in the output matrix. Please help me to know where i am going wrong.
clc;clear all;close all;
for i1=-8:+8 for j1=-8:+8 gxy=gxy+((gx(i+i1,j+j1)).*(gy(i+i1,j+j1))); gxx=gxx+power((gx(i+i1,j+j1)),2);
end end Q(i,j)=pi/2+0.5*(atan2(double(2*gxy),double((gxx-gyy)))); end end
No products are associated with this question.
Are gx and gy integers or doubles before you start multiplying them together. If things are being quantized, the first thing I look at is if it's doing integer math instead of floating point math. By the way, you can use ^ to raise to a power instead of calling the power() function.