How to implement Stroke Width Transform Algorithm

I aware of some steps

    canny edge detection
    gradient for canny image
    stroke width detection
    connected component grouping.

I got struck while implementing 3rd step. Please any one give me clear steps with MATLAB code for 3rd step.

clc;
clear all;
close all;
I=imread('ss.bmp');
I1=rgb2gray(I);
ed=edge(I1,'canny',0.2);
[gx gy]=gradient(double(ed),0.5);
figure;
imshow(I);
gm=sqrt(gx.^2+gy.^2);
gdp=atan2(gy,gx);
figure;
imshow(gm);
[r c]=size(gdp);
%if pixel p lies on the stroke boundary,then gdp(gradient direction) must%%be perpendicular to the orientation of the stroke%for i=1:r
for i=1:r
for j=1:c
    if gdp(i,j)==ed(i,j)
       ray(i,j)=gm(i,j)+1*gdp(i,j);
    end
end
end

In above code after finding gradient magnitude and direction, after that i need to consider gradient direction gdp of edge pixel p.then i need to follow the ray, ray=p+n.gdp, for n>0 until another edge pixel q is found. Please help me how to implement these steps.

Kodaganur on 4 Dec 2012

Please find the below link for images.

https://www.filesanywhere.com/fs/v.aspx?v=8a726689596171aa71a1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值