MERGING 3D POINT CLOUDS WITH RADIOMETRIC ENHANCEMENT

by

 

Modules for radiometric enhancement of colored 3D point clouds by propagating colors

cnnsearchTest.m
%
% Test file for the function [INDICES] = CNNSEARCH(...)
%

% Workspace
clc
clear all

% Build
fprintf('Building.......................');
mex cnnsearch.cpp
fprintf('ok!\n');

tic;
fprintf('Generating random data.........');
nA = 70*1000;
nB = 10*1000;
A = single(rand(nA,3));
B = single(0.7 + rand(nB,3));
fprintf('ok!\n');
radius = 0.022;

tic; [idx,dist] = knnsearch(A,B); fprintf('-   knnsearch: %5.2f sec (reference)\n', toc);
idx(dist>radius) = 0;

tic; bdx = cnnsearch(A,B,'brute',radius); fprintf('- brute-force: %5.2f sec (exact match = %d, (1=true,0=false))\n', toc, all(idx==bdx));
tic; hdx = cnnsearch(A,B,'hash',radius,100); fprintf('-   hash grid: %5.2f sec (exact match = %d, (1=true,0=false))\n', toc, all(idx==bdx));
tic; odx = cnnsearch(A,B,'octree',radius,10,1000); fprintf('-      octree: %5.2f sec (exact match = %d, (1=true,0=false))\n', toc, all(idx==bdx));
tic; kdx = cnnsearch(A,B,'kdtree',radius,10); fprintf('-      kdtree: %5.2f sec (exact match = %d, (1=true,0=false))\n', toc, all(idx==bdx));


hold on
i = idx(dist<=radius);
plot3(A(:,1),A(:,2),A(:,3),'g.');
plot3(B(:,1),B(:,2),B(:,3),'y.');
plot3(A(i,1),A(i,2),A(i,3),'ro');
axis equal

% End of test file

Contact us