0
我想在matlab中創建和旋轉高斯濾波器。這裏是我的代碼:在matlab中旋轉高斯濾波器
function f = createGaussianArray(length, sigma, theta)
half = length/2;
[x,y] = meshgrid(-half:half, -half:half);
x2 = cos(theta)*(x)-sin(theta)*(y);
y2 = sin(theta)*(x)+cos(theta)*(x);
matrix = exp(- (x2.^2+y2.^2)/(2*sigma.^2));
f = matrix ./ sum(matrix(:));
end
當我調用此函數(函數在gauss.m文件):
filter = gauss(31, 10, pi/2);
imagesc(filter)
它非常適用PI/3,PI/6與然而,當我發送3pi/4,0,pi或2 * pi作爲參數,它只顯示一條直線。我的代碼有什麼問題,我不明白。
當我做到這一點不旋轉,高斯濾波器仍然是任何THETA價值 – otp 2013-04-20 18:46:19
@otp你們是不是要旋轉內核一樣嗎?高斯濾波器本身就是徑向對稱的。 – Justin 2013-04-20 18:49:34