KJB
|
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 |
end dir_im | ( | ind | ) |
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 | ) |
|
pure virtual |
if lambda | ( | 1 | , |
1 | |||
) |
lines | ( | line_count | , |
1:6 | |||
) |
sum | ( | zmx.* | zmy | ) |
end if conf = 100000 |
count = 0 |
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 |
for I |
im_canny = edge(grayIm, 'canny') |
end ind = find(im_canny > 0) |
function straight edges Input |
for k |
line_count = 0 |
end end end end lines |
for m |
mean_x = mean(x) |
mean_y = mean(y) |
minLen = 15 |
num_dir = 8 |
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)) |
tmpcount = length(tind) |
used = zeros(size(im_canny)) |
zmy = (y-mean_y) |