在 Matlab 中使用一阶导数查找图像的梯度
In Matlab Finding gradient of an image using first derivative
如何使用一阶导数对 图像 进行增强。
我不想使用像 sobel 这样的运算符..
我想用一阶导数求梯度
您始终可以自由定义自己的脉冲响应,然后将其与您的图像进行卷积。
diff1X =[1/2, 0, -1/2] %first derivative in the x direction
diff1Y = [1/2; 0; -1/2] %first derivative in the y direction
%These are finite difference approximations to the first derivative note they
%are time reversed because the convolution involves a time reversal
x = [1,2,3; 2,4,6; 4,8,12]
x =
1 2 3
2 4 6
4 8 12
conv2(x, diff1X, 'same') %same parameter cuts results to initial image size
ans =
1 1 -1
2 2 -2
4 4 -4
%note that the image is zero padded so the derivative at the edges reflects this
conv2(x, diff1Y, 'same')
ans =
1.0000 2.0000 3.0000
1.5000 3.0000 4.5000
-1.0000 -2.0000 -3.0000
如何使用一阶导数对 图像 进行增强。
我不想使用像 sobel 这样的运算符.. 我想用一阶导数求梯度
您始终可以自由定义自己的脉冲响应,然后将其与您的图像进行卷积。
diff1X =[1/2, 0, -1/2] %first derivative in the x direction
diff1Y = [1/2; 0; -1/2] %first derivative in the y direction
%These are finite difference approximations to the first derivative note they
%are time reversed because the convolution involves a time reversal
x = [1,2,3; 2,4,6; 4,8,12]
x =
1 2 3
2 4 6
4 8 12
conv2(x, diff1X, 'same') %same parameter cuts results to initial image size
ans =
1 1 -1
2 2 -2
4 4 -4
%note that the image is zero padded so the derivative at the edges reflects this
conv2(x, diff1Y, 'same')
ans =
1.0000 2.0000 3.0000
1.5000 3.0000 4.5000
-1.0000 -2.0000 -3.0000