A Code Monkey's Blog

Iterative closest points(ICP) demo

http://www.youtube.com/watch?v=igb8mAJ6F5I

The Perl code generating the plot is listed below

#!/usr/bin/perl

use strict;
use warnings;
use Chart::Gnuplot;

### Write running time  
open my $IN, '<', "benchmark.dat" or die $!;

# Data
my @x;
my @y;

while( <$IN> ) {
    chomp;
    my ($t1, $t2) = split /\s/;
    push @x, $t1;
    push @y, $t2;
}

# Create chart object and specify the properties of the chart
my $chart = Chart::Gnuplot->new(
    output => "out.eps",
    title  => "Iterative Closest Points with Stanford Bunny",
    xlabel => "Number of threads",
    ylabel => "Time(s)",
    boxwidth => "0.8 relative"
);

# Create dataset object and specify the properties of the dataset
my $dataSet = Chart::Gnuplot::DataSet->new(
    xdata => \@x,
    ydata => \@y,
    title => "Time",
    #style => "linespoints",
    style => "boxes",
    fill => "0.75",
);

# Plot the data set on the chart
$chart->plot2d($dataSet);

##################################################

# Plot many data sets on a single chart
#$chart->plot2d($dataSet1, $dataSet2, ...);