Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions DDPFF/Dockerfile.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM gcc:latest as build

RUN apt-get update && \
apt-get install -y \
libeigen3-dev \
cmake

ADD . /app/src

WORKDIR /app/build

RUN cmake ../src && make

ENTRYPOINT ["./DDPFFAdoptation"]
14 changes: 1 addition & 13 deletions DDPFF/globals/include/globals/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,9 @@

struct Config
{
real_t systemIterationTime;
real_t debugLevel;
real_t bufferSize;

int sampleFactor;

// scene camera parameters
real_t sceneCameraRoll;
real_t sceneCameraPitch;
real_t sceneCameraYaw;
real_t sceneCameraX;
real_t sceneCameraY;
real_t sceneCameraZ;
real_t sceneRadius;

// flood fill parameters
real_t pointThresholdFloodFill_min;
real_t pointThresholdFloodFill_max;
Expand All @@ -45,7 +33,7 @@ struct Config
Config();
~Config(){}

void init();
void read_ini(const char* cfg_path);

private:
real_t sink;
Expand Down
46 changes: 27 additions & 19 deletions DDPFF/globals/src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "globals/constants.h"

#include <iostream>
#include <fstream>
#include <string>

// The global config object contains application wide configuration variables.
// Basically, the config object is a globally accessible struct with public
Expand All @@ -28,20 +30,8 @@ Config config;

Config::Config()
{
systemIterationTime = 0.05;
debugLevel = -1;
bufferSize = 10;
sampleFactor = 1;

// scene camera parameters
sceneCameraRoll = 0;
sceneCameraPitch = 0.80;
sceneCameraYaw = 0;
sceneCameraX = 0;
sceneCameraY = 0;
sceneCameraZ = 2;
sceneRadius = 10;

// flood fill parameters
pointThresholdFloodFill_min = 0.01;
pointThresholdFloodFill_max = 0.1;
Expand All @@ -61,11 +51,29 @@ Config::Config()
c_angle = 1;
}

// The init() method should be called after construction.
// Here, all config variables are registered to build a descriptor meta
// structure that allows index and key based access to their values.
// If you don't want to see a certain member on the gui, there is no
// need to register it.
void Config::init()
{
void Config::read_ini(const char* cfg_path){
std::ifstream input(cfg_path);

std::string line;
while (std::getline(input, line)){
if (line[0] == '[' || line[0] == '\n' || line.empty()) continue;
std::string param_name = line.substr(0, line.find('='));
real_t value = std::stod(line.substr(line.find('=') + 1));
if (param_name == "floodFill.pointThreshold_min") config.pointThresholdFloodFill_min = value;
else if (param_name == "floodFill.pointThreshold_max") config.pointThresholdFloodFill_max = value;
else if (param_name == "floodFill.planeThreshold_flood") config.planeThresholdFloodFill_flood = value;
else if (param_name == "floodFill.planeThreshold_merge") config.planeThresholdFloodFill_merge = value;
else if (param_name == "floodFill.planeThreshold_flood_max") config.planeThresholdFloodFill_flood_max = value;
else if (param_name == "floodFill.planeThreshold_merge_max") config.planeThresholdFloodFill_merge_max = value;
else if (param_name == "floodFill.angleThresholdFloodFill") config.angleThresholdFloodFill = value;
else if (param_name == "floodFill.angleThresholdFloodFill_max") config.angleThresholdFloodFill_max = value;
else if (param_name == "floodFill.minPlaneSize") config.minPlaneSize = value;
else if (param_name == "floodFill.normalSampleDistance_min") config.normalSampleDistance_min = value;
else if (param_name == "floodFill.normalSampleDistance_max") config.normalSampleDistance_max = value;
else if (param_name == "floodFill.c_plane") config.c_plane = value;
else if (param_name == "floodFill.c_plane_merge") config.c_plane_merge = value;
else if (param_name == "floodFill.c_point") config.c_point = value;
else if (param_name == "floodFill.c_angle") config.c_angle = value;
else if (param_name == "floodFill.c_range") config.c_range = value;
}
}
19 changes: 13 additions & 6 deletions DDPFF/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
#include <string>
#include <rep/DDPFF.h>

void read_pcd(pointBuffer_t & points_ptr) {
std::ifstream infile("result.ply");
#include "globals/Config.h"

void read_pcd(pointBuffer_t & points_ptr, const char * pcd_path) {
std::ifstream infile(pcd_path);

if (!infile.is_open()) {
throw std::runtime_error("Input file not found!");
throw std::runtime_error("Input file (cloud) not found!");
}

std::string line;
Expand All @@ -34,10 +36,11 @@ void read_pcd(pointBuffer_t & points_ptr) {
points_ptr[i] = tmp;
i++;
}
std::cout << "Parsed point cloud with point: " << i << std::endl;
}

void save_planes(const std::vector<PlanePointNormal> & planes) {
std::ofstream output("planes.txt");
std::ofstream output("output/planes.txt");

for (const auto & plane : planes) {
for (auto inlier : plane.inliers) {
Expand All @@ -47,15 +50,19 @@ void save_planes(const std::vector<PlanePointNormal> & planes) {
}
}

int main() {
int main(int argc, char** argv) {
const char* pcd_name = argv[1];
const char* cfg_name = argv[2];

config.read_ini(("input/" + std::string(cfg_name)).c_str());

auto ddpff = new DDPFF();
ddpff->init();

auto * points = new pointBuffer_t();
auto * colors = new colorBuffer_t();
auto * depth = new depthBuffer_t();
read_pcd(*points);
read_pcd(*points, ("input/" + std::string(pcd_name)).c_str());
ddpff->setBuffers(points, colors, depth);

ddpff->compute();
Expand Down