KJB
APPgetLargeConnectedEdges.m File Reference

## Functions

if (ss(2)==3) grayIm

remove border edges im_canny ([1 2 end-1 end],:)=0

end remove edges that are too
small and give all edges that
have the same direction a
unique id
edges (height, width, [angle id]) lines

ind (count+1:count+tmpcount)

end dir_im (ind)

edge_size (id)

edges (id).ind(edge_size(id))

sum (zmx.*zmy) sum(zmy.^2)]

if lambda (1, 1)>0 conf

used (edges(id).ind)

disp (num2str([lambda(1, 1) lambda(2, 2)])) r

lines (line_count, 1:6)

end fclose (fid)

## Variables

function lines

function straight edges Input

function straight edges
straight lines(nlines,[x1 x2
y1 y2 theta r])%%To display
result
ss = size(size(grayIm))

end minLen = 15

im_canny = edge(grayIm, 'canny')

height = size(im_canny, 1)

ind = find(im_canny > 0)

num_dir = 8

dX_ind = dX(ind)

dY_ind = dY(ind)

a_ind = atan(dY_ind ./ (dX_ind+1E-10))

get the indices of edges in
each direction for
i

used = zeros(size(im_canny))

line_count = 0

for k

for m

dir_im = zeros(size(im_canny))

count = 0

tind = direction(m2).ind(~used(direction(m2).ind))

tmpcount = length(tind)

get the number of pixels in
each edge
edge_size = zeros(num_edges, 1)

edges = repmat(struct('ind', zeros(200, 1)), num_edges, 1)

end get the endpoints of the
long edges and an image of the
long edges for
id

x = floor((edges(id).ind-1) / height)+1

mean_x = mean(x)

mean_y = mean(y)

zmx = (x-mean_x)

zmy = (y-mean_y)

D = [sum(zmx.^2) sum(zmx.*zmy)

theta = atan2(v(2, 2) , v(1, 2))

else conf = 100000

x1 = mean_x - cos(theta)*r/2

x2 = mean_x + cos(theta)*r/2

y1 = mean_y - sin(theta)*r/2

y2 = mean_y + sin(theta)*r/2

r = mean_x*cos(theta)+mean_y*sin(theta)

fid = fopen(out_path,'w')

for I

## Function Documentation

 end dir_im ( ind )
 disp ( num2str([lambda(1, 1) lambda(2, 2)]) )
 edge_size ( id )
 end remove edges that are too small and give all edges that have the same direction a unique id edges ( height , width )
 edges ( id )
 end fclose ( fid )
 if ( ss(2) = `=3` )
 remove border edges im_canny ( : )
pure virtual
 ind ( count+1:count+ tmpcount )
 if lambda ( 1 , 1 )
 lines ( line_count , 1:6 )
 sum ( zmx.* zmy )
 used ( edges(id). ind )

## Variable Documentation

 a_ind ranges from to num_dir with bin centered around pi a_ind = atan(dY_ind ./ (dX_ind+1E-10))
 end if conf = 100000
 count = 0
 D = [sum(zmx.^2) sum(zmx.*zmy)
 dir_im = zeros(size(im_canny))
 dX_ind = dX(ind)
 dY_ind = dY(ind)
 get the number of pixels in each edge edge_size = zeros(num_edges, 1)
 edges = repmat(struct('ind', zeros(200, 1)), num_edges, 1)
 fid = fopen(out_path,'w')
 height = size(im_canny, 1)
 end for i
Initial value:
direction(i).ind = ind(find(a_ind==i))
a_ind
Definition: APPgetLargeConnectedEdges.m:41
num_dir
Definition: APPgetLargeConnectedEdges.m:37
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
ind
Definition: APPgetLargeConnectedEdges.m:35
 for I
Initial value:
fprintf(fid,'%d %d %d %d\n', lines(I, 3), lines(I, 1), lines(I, 4),lines(I, 2))
function lines
Definition: APPgetLargeConnectedEdges.m:1
line_count
Definition: APPgetLargeConnectedEdges.m:60
for I
Definition: APPgetLargeConnectedEdges.m:141
fid
Definition: APPgetLargeConnectedEdges.m:140
 end get the endpoints of the long edges and an image of the long edges for id
Initial value:
= 1:num_edges
if edge_size(id) > minLen
y = mod(edges(id).ind-1, height)+1
height
Definition: APPgetLargeConnectedEdges.m:33
get the number of pixels in each edge edge_size
Definition: APPgetLargeConnectedEdges.m:84
end minLen
Definition: APPgetLargeConnectedEdges.m:24
ind
Definition: APPgetLargeConnectedEdges.m:35
edges
Definition: APPgetLargeConnectedEdges.m:85
 im_canny = edge(grayIm, 'canny')
 end ind = find(im_canny > 0)
 function straight edges Input
 for k
Initial value:
num_ind = 0
num_dir
Definition: APPgetLargeConnectedEdges.m:37
 line_count = 0
 end end end end lines
Initial value:
= APPgetLargeConnectedEdges(impath, out_path, minLenstr)
% lines = APPgetLargeConnectedEdges(grayIm, minLen)
%
% Uses the method of Video Compass [Kosecka, et al 2002] to get long
function lines
Definition: APPgetLargeConnectedEdges.m:1
end minLen
Definition: APPgetLargeConnectedEdges.m:24
 for m
Initial value:
= (k-1):k+1
num_ind = num_ind + sum(~used(direction(mod(m-1, num_dir)+1).ind))
used
Definition: APPgetLargeConnectedEdges.m:58
for k
Definition: APPgetLargeConnectedEdges.m:61
num_dir
Definition: APPgetLargeConnectedEdges.m:37
for m
Definition: APPgetLargeConnectedEdges.m:64
 mean_x = mean(x)
 mean_y = mean(y)
 minLen = 15
 num_dir = 8
 r = mean_x*cos(theta)+mean_y*sin(theta)
 function straight edges straight lines (nlines, [x1 x2 y1 y2 theta r]) % % To display result ss = size(size(grayIm))
 theta = atan2(v(2, 2) , v(1, 2))
 tind = direction(m2).ind(~used(direction(m2).ind))
 tmpcount = length(tind)
 used = zeros(size(im_canny))
 x = floor((edges(id).ind-1) / height)+1
 x1 = mean_x - cos(theta)*r/2
 x2 = mean_x + cos(theta)*r/2
 y1 = mean_y - sin(theta)*r/2
 y2 = mean_y + sin(theta)*r/2
 zmx = (x-mean_x)
 zmy = (y-mean_y)