Skip to content
Snippets Groups Projects
Commit e15000f3 authored by acoromin's avatar acoromin
Browse files

Added scilab file to prototype corner detection

parent 48e3099a
No related branches found
No related tags found
No related merge requests found
......@@ -18,11 +18,5 @@ void CaptureLaser2D::processCapture()
void CaptureLaser2D::extractCorners()
{
std::cout << "Extracting corners ... " << std::endl;
//TODO by Andreu: create class FeatureCorner2D + main to test this method.
//TODO by Juan AC
// Laser ranges are at data_
// Scan size is data_.size()
// Corners should be created as FeatureCorner2D. Corner 3 params to be stored at FeatureBase::measurement_
// After creation, they have to be pushed back to down_node_list_ by means of the method Capture::addFeature(const FeatureShPtr& _f_ptr)
}
// clear all
xdel(winsid());
clear;
//invent a set of points + noise
points = [1 2 3 4 5 6;1 2 3 4 5 6];
points = points + rand(points,"normal")*0.01;
[xx N] = size(points);
//build the system : Ax=0. Matrix A = a_ij
a_00 = sum( points(1,:).^2 );
a_01 = sum( points(1,:).*points(2,:) );
a_02 = sum( points(1,:) );
a_10 = a_01;
a_11 = sum( points(2,:).^2 );
a_12 = sum( points(2,:) );
a_20 = a_02;
a_21 = a_12;
a_22 = N;
A = [a_00 a_01 a_02; a_10 a_11 a_12; a_20 a_21 a_22; 0 0 1];
//solve
line = pinv(A)*[zeros(3,1);1];
m = -line(1)/line(2);
xc = -line(3)/line(2);
disp("line: ");disp(line);
disp("m: ");disp(m);
disp("xc: ");disp(xc);
//plot
fig1 = figure(0);
fig1.background = 8;
plot(points(1,:),points(2,:),"g.");
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment