How to implement Stroke Width Transform Algorithm

I am doing a project on Text Detection in Natural Scene Images. Does any one give me suggestions or any ideas for implementing Stroke Width Transform Algorithm. I aware of some steps 1.canny edge detection 2.gradient for canny image 3.stroke width detection 4.connected component grouping. I got struck while implementing 3rd step. Can any one give me clear steps with MATLAB code.
Thank You

5 个评论

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('12.jpg');
I1=rgb2gray(I);
ed=edge(I1,'canny',0.4);
[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 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.
Please find the below link for images.
https://www.filesanywhere.com/fs/v.aspx?v=8a726689596171aa71a1
this link does not work.... can you update it please
Has anybody found a solution to this problem. I m completely new to image processing and would like to know how to perform stroke width transform

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by