MATLAB图像处理与计算机视觉(3):实现Carsten Steger 的曲线检测算法(1)

本文探讨了在MATLAB中实现Carsten Steger曲线检测算法时遇到的问题,描述了测试脚本的输出结果出现异常,作者对此表示困惑,并求助于专家。
摘要由CSDN通过智能技术生成

用MATLAB实现,结果第一步就不大对劲,是什么原因呢?

function [ linePixel, direction] = z_lineCenterPts(im, sigma)
%
%
if nargin <2 
    sigma = 1.5;
end

% derivative masks
s_D = 0.7*sigma;
x  = -round(3*s_D):round(3*s_D);
dx = x .* exp(-x.*x/(2*s_D*s_D)) ./ (s_D*s_D*s_D*sqrt(2*pi));
dy = dx';

% image derivatives
Dx = conv2(im, dx, 'same');
Dy = conv2(im, dy, 'same');

% sum of the Auto-correlation matrix
s_I = sigma;
g = fspecial('gaussian',max(1,fix(6*s_I+1)), s_I);
Dxx = conv2(Dx.^2, g, 'same'); % Smoothed squared image derivatives
Dyy = conv2(Dy.^2, g, 'same');
Dxy = conv2(Dx.*Dy, g, 'same');

[eigenvalue1, eigenvalue2, eigenvectorx, eigenvectory]=eig2image(Dxx, Dxy, Dyy);

%判断(px, py)是否在[-1/2,1/2]X[-1/2,1/2]范围内
t = (Dx.*eigenvectorx + Dy .* eigenvectory) ./...
    (Dxx .* eigenvectorx.^2 + 2*Dxy.*eigenvectorx.*eigen
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值