-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmain.m
More file actions
79 lines (72 loc) · 2.06 KB
/
main.m
File metadata and controls
79 lines (72 loc) · 2.06 KB
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
warning off;
dbstop if error;
rand('seed', 255);
clear;
clc;
%% prepare save folders
config_dir = './config';
if ~exist(config_dir, 'dir')
mkdir(config_dir);
end
save_dir = './results';
log_file = fullfile(save_dir, 'log.txt');
if ~exist(save_dir, 'dir')
mkdir(save_dir);
end
%% denoise models
model_names = ["anchor", "daratech", "dc", "gargoyle", "lordquas"];
for i = 1 : 5
model_name = char(model_names(i));
gt_name = ['./models/gt/', model_name, '_GT.ply'];
noise_level = num2str(0.05);
noise_name = ['./models/noise/', model_name, '_gaussian_noise_', noise_level, '.ply'];
% check if the parameter configuration file exists
config_file = [model_name, '_', noise_level, '.mat'];
config_file = fullfile(config_dir, config_file);
if ~exist(config_file, 'file')
kMaxIteration = 30;
kDownSampleRate = 0.3;
kPatchSize = 9;
kPatchNeighborCount = 10;
kChangeTolerance = 5e-5;
alpha = 25.0 * (exp((1:kMaxIteration) / 20) - 1);
alpha = repmat(alpha, 5, 1);
alpha = reshape(alpha, 5 * kMaxIteration, 1);
use_matlab_down_sample = false;
use_normal = true;
use_cosine = false;
use_color = false;
C = 5;
save_iter_cloud = false;
save(config_file, ...
'kMaxIteration', ...
'kDownSampleRate', ...
'kPatchSize', ...
'kPatchNeighborCount', ...
'kChangeTolerance', ...
'alpha', ...
'use_matlab_down_sample', ...
'use_normal', ...
'use_cosine', ...
'use_color', ...
'C', ...
'save_iter_cloud');
else
load(config_file);
end
gt_cloud = pcread(gt_name);
noisy_cloud = pcread(noise_name);
[best_mse, best_snr, max_iterations] = denoise_with_learning( ...
noisy_cloud, gt_cloud, model_name, ...
kMaxIteration, kChangeTolerance, ...
kDownSampleRate, kPatchSize, kPatchNeighborCount, ...
alpha, ...
use_matlab_down_sample, ...
use_normal, ...
use_cosine, ...
use_color, ...
C, ...
save_iter_cloud, ...
log_file, ...
save_dir);
end