-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeneratePoints.m
89 lines (77 loc) · 2.32 KB
/
GeneratePoints.m
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
profile off
N = 1001; % number of points per plane
a = 50; % min value of co-ordinate
b = -50; % max value of co-ordinate
c = 5; % value of the constant co-ordinate
s = RandStream('mcg16807', 'Seed', 0);
RandStream.setGlobalStream(s)
points = [];
options.RHT.t = 70;
options.RHT.nT = 150;
options.RHT.COUNTTEST = 10;
options.RANSAC.TOLERANCE = 10;
options.RANSAC.THRESH = 0.3;
options.RANSAC.COUNTTEST = 10;
x = a + (b-a).*rand(N,1);
y = a + (b-a).*rand(N,1);
z = -(2*x + 2*y)/2 + 1;
%simplePlanePlot([x y z], 'r');
points = [points; [x y z]];
x = points(:,1);
y = points(:,2);
z = points(:,3);
x_min = min(x); y_min = min(y); z_min = min(z);
x_max = max(x); y_max = max(y); z_max = max(z);
defs = [x_min y_min z_min;x_max y_max z_max];
options.DEFS = defs;
options.NomeTeste = 'Sem Ruído';
RESULT1 = HoughPointsTeste(points, options);
% add random noise
points = points + randn(size(points));
x = points(:,1);
y = points(:,2);
z = points(:,3);
x_min = min(x); y_min = min(y); z_min = min(z);
x_max = max(x); y_max = max(y); z_max = max(z);
defs = [x_min y_min z_min;x_max y_max z_max];
options.DEFS = defs;
options.NomeTeste = 'Com Ruído';
RESULT2 = HoughPointsTeste(points, options);
% formatSpec = '%f %f %f';
% sizeA = [3 Inf];
% fileID = fopen('C:\\Users\\rodri\\Source\\Repos\\DepthSensor\\DepthSensor\\points.txt','r');
% A = fscanf(fileID,formatSpec, sizeA);
% points = A';
% points = points(find(points(:,1) > 0),:);
% %vMax = max(A);
%
% idx = randperm(length(points),5000);
% pointsR = points(idx,:);
%
% %idx = randperm(length(points),100000);
% %points = points(idx,:);
%
%
%
% x = points(:,1);
% y = points(:,2);
% z = points(:,3);
%
% x_min = min(x); y_min = min(y); z_min = min(z);
% x_max = max(x); y_max = max(y); z_max = max(z);
%
% defs = [x_min y_min z_min;x_max y_max z_max];
%
%
% plot3(0, 0, 0, 'MarkerSize', 11, 'Marker', 'o', 'MarkerEdgeColor', 'k', 'MarkerFaceColor', 'k');
% % plot all the points
% c = linspace(10,10,length(data));
% scatter3(pointsR(:,1), pointsR(:,2), pointsR(:,3),8,'b', 'filled');
%
% [P,S] = ransac(points, 25000, 0.027);
% if length(P)>0
% for i=1:min(length(P),3)
% [A,B,C,D] = simplePlanePlot(P(i,:), defs, 'r');
% end
% end
%RESULT3 = HoughPointsTeste(points);