我想将垂直和水平边缘连接在一起,以获得图像中的所有边缘,以便将其用于Harris Corner检测。
我正在使用Sobel滤镜来获得垂直和水平边缘:
I = imread('CleanFingerprint.jpg'); // read the image
I = im2double(I); // convert it to double
G = rgb2gray(I); // convert it to gray
vert = [-1 -2 -1;
0 0 0;
1 2 1]* 0.25; // vertical filter
hor = [-1 0 1;
-2 0 2;
-1 0 1]* 0.25; // horizontal filter
OutputV = conv2(G, vert); // applying the filter to the image
OutputH = conv2(G, hor);
它运作良好。然后当我尝试将它们连接在一起时,我使用这个公式:
// sqrt((OutputV^2) + (OutputH^2))
Output = OutputV ^2;
Output1 = OutputH ^2;
Output2 = Output + Output1;
Output3 = sqrt(Output2);
我得到了一个非常奇怪的形象。任何建议
答案 0 :(得分:0)
你应该使用" Per Pixel"平方操作:
Output = sqrt((OutputV .^ 2) + (OutputH .^ 2));
你写的是MATLAB执行矩阵乘法(而不是输入操作)。