Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
75c1d979
Commit
75c1d979
authored
10 years ago
by
acoromin
Browse files
Options
Downloads
Patches
Plain Diff
scilab prototype for corner detector ready
parent
24e9afa1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lineFit.sce
+19
-19
19 additions, 19 deletions
src/lineFit.sce
with
19 additions
and
19 deletions
src/lineFit.sce
+
19
−
19
View file @
75c1d979
//info about 2D homogeneous lines and points: http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/BEARDSLEY/node2.html
// clear all
xdel(winsid());
clear;
//user inputs
Nrays = 250;
Aperture = %pi;
r_max = 20;
r_stdev = 0.1;
//User Tunning params
Nw = 6; //window size
theta_th = %pi/6;
K = 3; //How many std_dev are tolerated to count that a point is supporting a line
r_stdev = 0.1; //ranging std dev
//init
result_lines = [];
line_indexes = [];
corners = [];
//create lines in the environment
//map
//generate a scan
// for i=1:Nrays
// azimuth = -Aperture/2 + (i/Nrays)*Aperture;
// end
//invent a set of points + noise
points = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43;
7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 7.4 7.3 7.2 7.1 7 6.9 6.8 6.7 6.6 6.5 6.4];
...
...
@@ -35,19 +27,27 @@ for (i = Nw:Np)
points_w = points(:,(i-Nw+1):i)
//Found the best fitting line over the window. Build the system: Ax=0. Matrix A = a_ij
// a_00 = sum( points_w(1,:).^2 );
// a_01 = sum( points_w(1,:).*points_w(2,:) );
// a_02 = sum( points_w(1,:) );
// a_10 = a_01;
// a_11 = sum( points_w(2,:).^2 );
// a_12 = sum( points_w(2,:) );
// a_20 = a_02;
// a_21 = a_12;
// a_22 = Nw;
// A = [a_00 a_01 a_02; a_10 a_11 a_12; a_20 a_21 a_22; 0 0 1];
a_00 = sum( points_w(1,:).^2 );
a_01 = sum( points_w(1,:).*points_w(2,:) );
a_02 = sum( points_w(1,:) );
a_10 = a_01;
a_11 = sum( points_w(2,:).^2 );
a_12 = sum( points_w(2,:) );
a_20 = a_02;
a_21 = a_12;
a_22 = Nw;
A = [a_00 a_01 a_02; a_10 a_11 a_12; a_20 a_21 a_22; 0 0 1];
A = [a_00 a_01 a_02; a_10 a_11 a_12; 0 0 1];
//solve
line = pinv(A)*[zeros(3,1);1];
// line = pinv(A)*[zeros(3,1);1];
line = inv(A)*[0; 0; 1];
//compute error
err = 0;
...
...
@@ -58,7 +58,7 @@ for (i = Nw:Np)
//disp("error: "); disp(err);
//if error below stdev, add line to result set
if err < r_stdev then
if err <
K*
r_stdev then
result_lines = [result_lines [line;points_w(:,1);points_w(:,$)]];
line_indexes = [line_indexes i]; //ray index where the segment ends
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment