Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
charalambos committed Jan 15, 2015
1 parent 4def00a commit cac3b8d
Show file tree
Hide file tree
Showing 66 changed files with 215,271 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The preprocessing module in IEEE PAMI 2013: A Framework for Automatic Modeling from Point Cloud Data


Structures the unstructured LiDAR data captured using an airborne scanner, into memory-manageable components which can be further processed in parallel.

The size of the "tiles" or "geospatial bounding boxes" can be adjusted by changing the preprocessor flags: RES_x, RES_Y, RES_Z.

Refereces:
1. IEEE PAMI 2013: A Framework for Automatic Modeling from Point Cloud Data
2. IEEE CVPR 2009: Automatic reconstruction of cities from remote sensor data


More information about this work: www.poullis.org




Technical details:

- The project file is provided for Code::Blocks IDE.
- It requires the libraries Image Magick and fftw3.
- A small sample file is provided in the bin folders.
-
48 changes: 48 additions & 0 deletions StructurePointcloud/BoundingBox.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
////////////////////////////////////////////////////////////////////////////////////
// Copyright © Charalambos "Charis" Poullis, [email protected] //
// This work can only be used under an exclusive license of the author. //
////////////////////////////////////////////////////////////////////////////////////

#ifndef __BOUNDING_BOX_CPP__
#define __BOUNDING_BOX_CPP__

#include "BoundingBox.h"


BoundingBox::BoundingBox() {

min_pt = Vector3f(FLT_MAX, FLT_MAX, FLT_MAX);
max_pt = Vector3f(-FLT_MAX, -FLT_MAX, -FLT_MAX);
}

BoundingBox::BoundingBox(Vector3f const &_min_pt, Vector3f const &_max_pt) {
min_pt = _min_pt;
max_pt = _max_pt;
}

BoundingBox::~BoundingBox() {

}


Vector3f BoundingBox::getMinPt() const {
return min_pt;
}

Vector3f BoundingBox::getMaxPt() const {
return max_pt;
}

void BoundingBox::setMinPt(Vector3f const _min_pt) {

min_pt = _min_pt;
return;
}

void BoundingBox::setMaxPt(Vector3f const _max_pt) {

max_pt = _max_pt;
return;
}

#endif
49 changes: 49 additions & 0 deletions StructurePointcloud/BoundingBox.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
////////////////////////////////////////////////////////////////////////////////////
// Copyright © Charalambos "Charis" Poullis, [email protected] //
// This work can only be used under an exclusive license of the author. //
////////////////////////////////////////////////////////////////////////////////////


#ifndef __BOUNDING_BOX_H__
#define __BOUNDING_BOX_H__

/** Bounding Box
* This class defines a bounding box and related functions
*
*/


#include <float.h>
#include "Vector.h"


class BoundingBox {
public:
///Constructor
BoundingBox();
///Constructor
BoundingBox(Vector3f const &_min_pt, Vector3f const &_max_pt);
///Destructor
~BoundingBox();

///Get min point
Vector3f getMinPt() const;

///Get max point
Vector3f getMaxPt() const;

///Set min point
void setMinPt(Vector3f const _min_pt);

///Set max point
void setMaxPt(Vector3f const _max_pt);

protected:
///The minimum point
Vector3f min_pt;
///The maximum point
Vector3f max_pt;
};


#endif
172 changes: 172 additions & 0 deletions StructurePointcloud/Color.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
////////////////////////////////////////////////////////////////////////////////////
// Copyright © Charalambos "Charis" Poullis, [email protected] //
// This work can only be used under an exclusive license of the author. //
////////////////////////////////////////////////////////////////////////////////////
#ifndef __COLOR_CPP__
#define __COLOR_CPP__

#include "Color.h"

Color::Color() {
data(0) = 0.0f;
data(1) = 0.0f;
data(2) = 0.0f;
data(3) = 1.0f;
}

Color::Color(Color const &_color) {
data(0) = _color.r();
data(1) = _color.g();
data(2) = _color.b();
data(3) = _color.a();
}

Color::Color(float _grayscale) {
data(0) = _grayscale;
data(1) = _grayscale;
data(2) = _grayscale;
data(3) = 1.0f;
}

Color::Color(float _r, float _g, float _b) {
data(0) = _r;
data(1) = _g;
data(2) = _b;
data(3) = 1.0f;
}

Color::Color(float _r, float _g, float _b, float _a) {
data(0) = _r;
data(1) = _g;
data(2) = _b;
data(3) = _a;
}

Color::~Color() {
}

float Color::r() const {
return data(0);
}

float &Color::r() {
return data(0);
}

float Color::g() const {
return data(1);
}

float &Color::g() {
return data(1);
}

float Color::b() const {
return data(2);
}

float &Color::b() {
return data(2);
}

float Color::a() const {
return data(3);
}

float &Color::a() {
return data(3);
}

float& Color::operator()(int elementNumber) {
return data(elementNumber);
}

float Color::operator()(int elementNumber) const {
return data(elementNumber);
}

Color operator*(Color const &c1, Color const &c2) {
Color result;
for (int i = 0; i < 3; i++)
result(i) = c1(i) * c2(i);
return result;
}

Color operator*(Color const &c1, float scalar) {
Color result;
for (int i = 0; i < 3; i++)
result(i) = c1(i) * scalar;
return result;
}

Color operator*(float scalar, Color const &c1) {
Color result;
for (int i = 0; i < 3; i++)
result(i) = c1(i) * scalar;
return result;
}

Color operator+(Color const &c1, Color const &c2) {
Color result;
for (int i = 0; i < 3; i++)
result(i) = c1(i) + c2(i);
return result;
}

Color operator-(Color const &c1, Color const &c2) {
Color result;
for (int i = 0; i < 3; i++)
result(i) = c1(i) - c2(i);
return result;
}

Color operator/(Color const &c1, Color const &c2) {
Color result;
for (int i = 0; i < 3; i++)
result(i) = c1(i) / std::max(float(COLOR_EPSILON), c2(i));
return result;
}

Color operator/(Color const &c1, float scalar) {
Color result;
for (int i = 0; i < 3; i++)
result(i) = c1(i) / std::max(float(COLOR_EPSILON), scalar);
return result;
}

bool operator==(Color const &c1, Color const &c2) {
for (int i = 0; i < 3; i++)
if (fabs(c1(i) - c2(i)) > COLOR_EPSILON)
return false;
return true;
}

bool operator!=(Color const &c1, Color const &c2) {
for (int i = 0; i < 3; i++)
if (fabs(c1(i) - c2(i)) > COLOR_EPSILON)
return true;
return false;
}

Color &Color::operator+=(Color const &vec) {
for (int i = 0; i < 3; i++) {
data(i) += vec.data(i);
}
return *this;
}

Color &Color::operator*=(float scalar) {
for (int i = 0; i < 3; i++) {
data(i) *= scalar;
}
return *this;
}

Color &Color::operator/=(float scalar) {
for (int i = 0; i < 3; i++) {
data(i) /= scalar;
}
return *this;
}

#endif
92 changes: 92 additions & 0 deletions StructurePointcloud/Color.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
////////////////////////////////////////////////////////////////////////////////////
// Copyright © Charalambos "Charis" Poullis, [email protected] //
// This work can only be used under an exclusive license of the author. //
////////////////////////////////////////////////////////////////////////////////////
#ifndef __COLOR_H__
#define __COLOR_H__

#include <math.h>
#include "Vector.h"

#define COLOR_EPSILON 1e-03

class Color {
public:
///Constructors
Color();
Color(Color const &_color);
Color(float _grayscale);
Color(float _r, float _g, float _b);
Color(float _r, float _g, float _b, float _a);
///Destructor
~Color();

///Returns the color and opacity
float r() const;
float &r();
float g() const;
float &g();
float b() const;
float &b();
float a() const;
float &a();

///Get a specific element
float& operator() (int elementNumber);
float operator() (int elementNumber) const;

///Mathematical functions
friend Color operator* ( Color const &c1, Color const &c2);
friend Color operator* ( Color const &c1, float scalar);
friend Color operator* ( float scalar, Color const &c1);
friend Color operator+ ( Color const &c1, Color const &c2);
friend Color operator- ( Color const &c1, Color const &c2);
friend Color operator/ ( Color const &c1, Color const &c2);
friend Color operator/ ( Color const &c1, float scalar);
friend bool operator== ( Color const &c1, Color const &c2);
friend bool operator!= ( Color const &c1, Color const &c2);

Color &operator+= (Color const &vec);
Color &operator*= (float scalar);
Color &operator/= (float scalar);

///Conversion functions
template<class T>
friend Vector<T,3> color2vector3(Color const &c) {
return Vector<T,3>((T) c.r(), (T) c.g(), (T) c.b());
}

template<typename T>
friend Vector<T,4> color2vector4(Color const &c) {
return Vector<T,4>((T) c.r(), (T) c.g(), (T) c.b(), (T) c.a());
}

template<typename T>
friend Color vector2color3(Vector<T,3> const &v) {
return Color(float(v(0)), float(v(1)), float(v(2)), 1.0f);
}

template<typename T>
friend Color vector2color4(Vector<T,4> const &v) {
return Color(float(v(0)), float(v(1)), float(v(2)), float(v(3)));
}

///Print functions
friend std::ostream &operator<<(std::ostream &os, Color const &c) {
os << "red: " << c.r() << " green: " << c.g() << " blue: " << c.b() << " alpha: " << c.a() << std::endl;
return os;
}

friend std::istream &operator>>(std::istream& is, Color &c) {
is >> c.data[0];
is >> c.data[1];
is >> c.data[2];
is >> c.data[3];
return is;
}

private:
Vector4f data;
};

#endif
Loading

0 comments on commit cac3b8d

Please sign in to comment.