Skip to content
Snippets Groups Projects
Commit 31c20bf9 authored by simon.fanetti's avatar simon.fanetti
Browse files

add distanceSandboxTop in config + fixe adjutProjection

parent 2dfcac8e
Branches camera
No related tags found
1 merge request!1Camera
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <QDialog> #include <QDialog>
#include <QTimer> #include <QTimer>
#include <QMutex>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
#include "qtfullscreen.h" #include "qtfullscreen.h"
#include "monitorgui.h" #include "monitorgui.h"
......
...@@ -28,13 +28,17 @@ CroppingMask::~CroppingMask() ...@@ -28,13 +28,17 @@ CroppingMask::~CroppingMask()
} }
void CroppingMask::valideRoutine(){ void CroppingMask::valideRoutine(){
timer->stop(); timer->stop();
setup->getCamera()->capture();
cv::Size s = setup->getCamera()->getDepthFrame().size(); cv::Size s = setup->getCamera()->getDepthFrame().size();
cv::Point center(s.width / 2, s.height / 2); cv::Point center(s.width / 2, s.height / 2);
std::vector<cv::Point> rectPoints = getRectPoints(); std::vector<cv::Point> rectPoints = getRectPoints();
cv::Mat depthFrame = setup->getCamera()->getDepthFrame();
setup->setupAdjustMatrix(rectPoints, center); setup->setupAdjustMatrix(rectPoints, center);
setup->setupCroppingMask(rectPoints); setup->setupCroppingMask(rectPoints);
setup->getProjection()->setDistanceTopSandbox(depthFrame.at<float>(center));
endSuccess = true; endSuccess = true;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
class BeamerProjection{ class BeamerProjection{
private: private:
cv::Mat adjustingMatrix; cv::Mat adjustingMatrix;
float topSandboxDistance = 1.0f; float distanceTopSandbox = 1.0f;
cv::Point2i findMatchingPixel(int i, int j, float z, Camera *camera, cv::Point3f beamer_pos); cv::Point2i findMatchingPixel(int i, int j, float z, Camera *camera, cv::Point3f beamer_pos);
void copyPixelsInto(cv::Point2i pixel_dst, cv::Mat &dst, cv::Point2i pixel_src, cv::Mat &src, cv::Rect base); void copyPixelsInto(cv::Point2i pixel_dst, cv::Mat &dst, cv::Point2i pixel_src, cv::Mat &src, cv::Rect base);
...@@ -18,7 +18,9 @@ class BeamerProjection{ ...@@ -18,7 +18,9 @@ class BeamerProjection{
BeamerProjection(); BeamerProjection();
void setAdjustingMatrix(cv::Mat matrix){ adjustingMatrix = matrix; } void setAdjustingMatrix(cv::Mat matrix){ adjustingMatrix = matrix; }
cv::Mat getAdjustingMatrix(){ return adjustingMatrix.clone(); } cv::Mat getAdjustingMatrix(){ return adjustingMatrix; }
void setDistanceTopSandbox(float dist){ distanceTopSandbox = dist; };
float getDistanceTopSandbox(){ return distanceTopSandbox; };
cv::Point2i rotatePixel(cv::Point2i pixel); cv::Point2i rotatePixel(cv::Point2i pixel);
void adjustFrame(cv::Mat depth, cv::Mat src, cv::Mat &dst, Camera *camera, cv::Point3f beamer_pos); void adjustFrame(cv::Mat depth, cv::Mat src, cv::Mat &dst, Camera *camera, cv::Point3f beamer_pos);
......
...@@ -21,6 +21,10 @@ class Sandbox{ ...@@ -21,6 +21,10 @@ class Sandbox{
public: public:
Sandbox(); Sandbox();
Camera* getCamera(){ return &camera; };
Beamer* getBeamer(){ return &beamer; };
BeamerProjection* getProjection(){ return &projection; };
void init(); void init();
cv::Mat getColorFrame(); cv::Mat getColorFrame();
cv::Mat getDepthFrame(); cv::Mat getDepthFrame();
......
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
#include "beamerProjection.h" #include "beamerProjection.h"
#include "beamer.h" #include "beamer.h"
#define MASK "CroppingMask" #define SCFG_MASK "CroppingMask"
#define POSITION "BeamerPosition" #define SCFG_POSITION "BeamerPosition"
#define MATRIX "AdjustingMatrix" #define SCFG_MATRIX "AdjustingMatrix"
#define RESOLUTION "BeamerResolution" #define SCFG_DISTANCE "DistanceTopSandbox"
#define PROCESSPROFIL "FrameProcessProfil" #define SCFG_RESOLUTION "BeamerResolution"
#define SCFG_PROCESS_PROFIL "FrameProcessProfil"
class SandboxConfig{ class SandboxConfig{
private: private:
...@@ -19,12 +20,14 @@ class SandboxConfig{ ...@@ -19,12 +20,14 @@ class SandboxConfig{
public: public:
static int saveAdjustingMatrixInto(char *path, cv::Mat matrix); static int saveAdjustingMatrixInto(char *path, cv::Mat matrix);
static int saveDistanceToSandboxTop(char *path, float distance);
static int saveCroppingMaskInto(char *path, cv::Rect mask); static int saveCroppingMaskInto(char *path, cv::Rect mask);
static int saveBeamerPositionInto(char *path, cv::Point3f position); static int saveBeamerPositionInto(char *path, cv::Point3f position);
static int saveBeamerResolutionInto(char *path, cv::Size resolution); static int saveBeamerResolutionInto(char *path, cv::Size resolution);
static int saveFrameProcessProfil(char *path, FrameProcessProfil profil); static int saveFrameProcessProfil(char *path, FrameProcessProfil profil);
static int loadAdjustingMatrixFrom(char *path, BeamerProjection *projection); static int loadAdjustingMatrixFrom(char *path, BeamerProjection *projection);
static int loadDistanceToSandboxTop(char *path, BeamerProjection *projection);
static int loadCroppingMaskFrom(char *path, Camera *camera); static int loadCroppingMaskFrom(char *path, Camera *camera);
static int loadBeamerPositionFrom(char *path, Beamer *beamer); static int loadBeamerPositionFrom(char *path, Beamer *beamer);
static int loadBeamerResolutionFrom(char *path, Beamer *beamer); static int loadBeamerResolutionFrom(char *path, Beamer *beamer);
......
...@@ -241,8 +241,8 @@ std::vector<cv::Point3i> Beamer::findCircles(cv::Mat &rgb, double contrast, int ...@@ -241,8 +241,8 @@ std::vector<cv::Point3i> Beamer::findCircles(cv::Mat &rgb, double contrast, int
// min_dist : Minimal distance between the detected centers // min_dist : Minimal distance between the detected centers
// param_1 : Upper threshold of the canny edge detector, determines if a pixel is an edge // param_1 : Upper threshold of the canny edge detector, determines if a pixel is an edge
// param_2 : Threshold for the center detection, after the accumulator is complet, threshold to keep only the possible centers // param_2 : Threshold for the center detection, after the accumulator is complet, threshold to keep only the possible centers
// min_radius : Min radius of the circles drew on the accumulator // min_radius : Min radius of the circles drawn on the accumulator
// max_radius : Max radius of the circles drew on the accumulator // max_radius : Max radius of the circles drawn on the accumulator
cv::HoughCircles(src_gray, circles, CV_HOUGH_GRADIENT, 1, centersMinDist, (double)cannyEdgeThreshold, (double)houghAccThreshold, minRadius, maxRadius); cv::HoughCircles(src_gray, circles, CV_HOUGH_GRADIENT, 1, centersMinDist, (double)cannyEdgeThreshold, (double)houghAccThreshold, minRadius, maxRadius);
std::vector<cv::Point3i> result; std::vector<cv::Point3i> result;
......
...@@ -19,13 +19,12 @@ void BeamerProjection::adjustFrame(cv::Mat depth, cv::Mat src, cv::Mat &dst, Cam ...@@ -19,13 +19,12 @@ void BeamerProjection::adjustFrame(cv::Mat depth, cv::Mat src, cv::Mat &dst, Cam
cv::Rect mask = camera->getCroppingMask(); cv::Rect mask = camera->getCroppingMask();
cv::Size dst_size = dst.size(); cv::Size dst_size = dst.size();
cv::resize(src, src, dst.size());
// resize the frames to be a multiple of the camera size : // resize the frames to be a multiple of the camera size :
// src.size = n * camera.depth.size , where n is uint > 0 // src.size = n * camera.depth.size , where n is uint > 0
cv::resize(src, src, getMatchingSize(src, mask)); cv::resize(dst, dst, getMatchingSize(dst, mask));
cv::resize(dst, dst, src.size()); cv::resize(src, src, dst.size());
cv::Mat pixelsDeprojectMap = cv::Mat_<cv::Point2i>(mask.height, mask.width, cv::Point2i(-1,-1)); cv::Mat pixelsDeprojectMap = cv::Mat_<cv::Point2i>(mask.height, mask.width, cv::Point2i(-1,-1));
cv::Mat pixelsDeprojectHighestMap = cv::Mat_<cv::Point2i>(mask.height, mask.width, cv::Point2i(-1,-1)); cv::Mat pixelsDeprojectHighestMap = cv::Mat_<cv::Point2i>(mask.height, mask.width, cv::Point2i(-1,-1));
...@@ -79,10 +78,9 @@ void BeamerProjection::adjustFrame(cv::Mat depth, cv::Mat src, cv::Mat &dst, Cam ...@@ -79,10 +78,9 @@ void BeamerProjection::adjustFrame(cv::Mat depth, cv::Mat src, cv::Mat &dst, Cam
} }
} }
} }
cv::resize(dst, dst, dst_size);
cv::resize(src, src, dst_size);
cv::warpAffine(dst, dst, adjustingMatrix, dst.size()); cv::warpAffine(dst, dst, adjustingMatrix, dst.size());
} }
...@@ -131,9 +129,8 @@ cv::Point2i BeamerProjection::findMatchingPixel(int i, int j, float z, Camera *c ...@@ -131,9 +129,8 @@ cv::Point2i BeamerProjection::findMatchingPixel(int i, int j, float z, Camera *c
float pixel[2] = {static_cast<float>(i), static_cast<float>(j)}; float pixel[2] = {static_cast<float>(i), static_cast<float>(j)};
cv::Point3f CP = camera->deprojectPixelToPoint(pixel, z); cv::Point3f CP = camera->deprojectPixelToPoint(pixel, z);
cv::Point3f BP = CB - CP; cv::Point3f BP = CB - CP;
//float alpha = (topSandboxDistance - CP.z) / BP.z;
float BAz = CB.z + BP.z; float BAz = CB.z + BP.z;
float BEz = topSandboxDistance - CB.z; float BEz = distanceTopSandbox - CB.z;
float alpha = BEz / BAz; float alpha = BEz / BAz;
cv::Point3f V = (alpha * BP); cv::Point3f V = (alpha * BP);
cv::Point3f CV = V + CB; cv::Point3f CV = V + CB;
......
...@@ -36,8 +36,8 @@ cv::Mat Sandbox::adjustProjection(cv::Mat frame){ ...@@ -36,8 +36,8 @@ cv::Mat Sandbox::adjustProjection(cv::Mat frame){
projection.adjustFrame(depth, frame, imageCalibrate, &camera, beamer.getPosition()); projection.adjustFrame(depth, frame, imageCalibrate, &camera, beamer.getPosition());
// frame after process // frame after process
cv::dilate(imageCalibrate, imageCalibrate, cv::Mat(), cv::Point(-1, -1), 2, 1, 1); //cv::dilate(imageCalibrate, imageCalibrate, cv::Mat(), cv::Point(-1, -1), 2, 1, 1);
cv::erode(imageCalibrate, imageCalibrate, cv::Mat(), cv::Point(-1, -1), 2, 1, 1); //cv::erode(imageCalibrate, imageCalibrate, cv::Mat(), cv::Point(-1, -1), 2, 1, 1);
return imageCalibrate; return imageCalibrate;
} }
...@@ -53,6 +53,8 @@ int Sandbox::loadConfigFrom(char *path){ ...@@ -53,6 +53,8 @@ int Sandbox::loadConfigFrom(char *path){
int err = SandboxConfig::loadAdjustingMatrixFrom(path, &projection); int err = SandboxConfig::loadAdjustingMatrixFrom(path, &projection);
if(err){ return err; } if(err){ return err; }
err = SandboxConfig::loadDistanceToSandboxTop(path, &projection);
if(err){ return err; }
err = SandboxConfig::loadCroppingMaskFrom(path, &camera); err = SandboxConfig::loadCroppingMaskFrom(path, &camera);
if(err){ return err; } if(err){ return err; }
err = SandboxConfig::loadBeamerResolutionFrom(path, &beamer); err = SandboxConfig::loadBeamerResolutionFrom(path, &beamer);
...@@ -64,13 +66,7 @@ int Sandbox::loadConfigFrom(char *path){ ...@@ -64,13 +66,7 @@ int Sandbox::loadConfigFrom(char *path){
int Sandbox::loadConfig(){ int Sandbox::loadConfig(){
int err = loadConfigFrom(defaultConfigFilePath); return loadConfigFrom(defaultConfigFilePath);
if(err){
std::cout << "error config" << std::endl;
return err;
}
return 0;
} }
void Sandbox::initWindowsFullScreen(){ void Sandbox::initWindowsFullScreen(){
......
...@@ -14,6 +14,9 @@ SandboxSetup::SandboxSetup(){ ...@@ -14,6 +14,9 @@ SandboxSetup::SandboxSetup(){
int SandboxSetup::saveConfigFrom(char *path){ int SandboxSetup::saveConfigFrom(char *path){
if(SandboxConfig::saveAdjustingMatrixInto(path, projection.getAdjustingMatrix())) if(SandboxConfig::saveAdjustingMatrixInto(path, projection.getAdjustingMatrix()))
return 1; return 1;
if(SandboxConfig::saveDistanceToSandboxTop(path, projection.getDistanceTopSandbox()))
return 1;
if(SandboxConfig::saveCroppingMaskInto(path, camera.getCroppingMask())) if(SandboxConfig::saveCroppingMaskInto(path, camera.getCroppingMask()))
return 1; return 1;
......
...@@ -26,7 +26,26 @@ int SandboxConfig::saveAdjustingMatrixInto(char *path, cv::Mat matrix){ ...@@ -26,7 +26,26 @@ int SandboxConfig::saveAdjustingMatrixInto(char *path, cv::Mat matrix){
//std::cout << "[Error] No Config File found : " << err.what() << std::endl; //std::cout << "[Error] No Config File found : " << err.what() << std::endl;
} }
config[MATRIX] = val; config[SCFG_MATRIX] = val;
return saveConfigIn(path, config);
}
int SandboxConfig::saveDistanceToSandboxTop(char *path, float distance){
YAML::Node val;
val["distance"] = distance;
YAML::Node config;
try{
config = YAML::LoadFile(path);
}catch(YAML::BadFile err){
//std::cout << "[Error] No Config File found : " << err.what() << std::endl;
}
config[SCFG_DISTANCE] = val;
return saveConfigIn(path, config); return saveConfigIn(path, config);
} }
...@@ -48,7 +67,7 @@ int SandboxConfig::saveCroppingMaskInto(char *path, cv::Rect mask){ ...@@ -48,7 +67,7 @@ int SandboxConfig::saveCroppingMaskInto(char *path, cv::Rect mask){
//std::cout << "[Error] No Config File found : " << err.what() << std::endl; //std::cout << "[Error] No Config File found : " << err.what() << std::endl;
} }
config[MASK] = val; config[SCFG_MASK] = val;
return saveConfigIn(path, config); return saveConfigIn(path, config);
} }
...@@ -69,7 +88,7 @@ int SandboxConfig::saveBeamerPositionInto(char *path, cv::Point3f pos){ ...@@ -69,7 +88,7 @@ int SandboxConfig::saveBeamerPositionInto(char *path, cv::Point3f pos){
//std::cout << "[Error] No Config File found : " << err.what() << std::endl; //std::cout << "[Error] No Config File found : " << err.what() << std::endl;
} }
config[POSITION] = val; config[SCFG_POSITION] = val;
return saveConfigIn(path, config); return saveConfigIn(path, config);
} }
...@@ -79,8 +98,8 @@ int SandboxConfig::saveBeamerResolutionInto(char *path, cv::Size res){ ...@@ -79,8 +98,8 @@ int SandboxConfig::saveBeamerResolutionInto(char *path, cv::Size res){
YAML::Node val; YAML::Node val;
val["height"] = res.height;
val["width"] = res.width; val["width"] = res.width;
val["height"] = res.height;
YAML::Node config; YAML::Node config;
try{ try{
...@@ -89,7 +108,7 @@ int SandboxConfig::saveBeamerResolutionInto(char *path, cv::Size res){ ...@@ -89,7 +108,7 @@ int SandboxConfig::saveBeamerResolutionInto(char *path, cv::Size res){
//std::cout << "[Error] No Config File found : " << err.what() << std::endl; //std::cout << "[Error] No Config File found : " << err.what() << std::endl;
} }
config[RESOLUTION] = val; config[SCFG_RESOLUTION] = val;
return saveConfigIn(path, config); return saveConfigIn(path, config);
} }
...@@ -114,7 +133,7 @@ int SandboxConfig::saveFrameProcessProfil(char *path, FrameProcessProfil profil) ...@@ -114,7 +133,7 @@ int SandboxConfig::saveFrameProcessProfil(char *path, FrameProcessProfil profil)
//std::cout << "[Error] No Config File found : " << err.what() << std::endl; //std::cout << "[Error] No Config File found : " << err.what() << std::endl;
} }
config[PROCESSPROFIL] = val; config[SCFG_PROCESS_PROFIL] = val;
return saveConfigIn(path, config); return saveConfigIn(path, config);
} }
...@@ -132,23 +151,23 @@ int SandboxConfig::loadAdjustingMatrixFrom(char *path, BeamerProjection *project ...@@ -132,23 +151,23 @@ int SandboxConfig::loadAdjustingMatrixFrom(char *path, BeamerProjection *project
try{ try{
config = YAML::LoadFile(path); config = YAML::LoadFile(path);
}catch(YAML::BadFile err){ }catch(YAML::BadFile err){
std::cout << "[Error] No Config File found : " << err.what() << std::endl; //std::cout << "[Error] No Config File found : " << err.what() << std::endl;
return 1; return 1;
} }
// no node for adjusting matrix // no node for adjusting matrix
if(!config[MATRIX]){ if(!config[SCFG_MATRIX]){
return 2; return 2;
}; };
// uncomplet data for adjusting matrix // uncomplet data for adjusting matrix
if(!(config[MATRIX]["width"] && config[MATRIX]["height"] && config[MATRIX]["matrix"])){ if(!(config[SCFG_MATRIX]["width"] && config[SCFG_MATRIX]["height"] && config[SCFG_MATRIX]["matrix"])){
return 2; return 2;
} }
int height = config[MATRIX]["height"].as<int>(); int height = config[SCFG_MATRIX]["height"].as<int>();
int width = config[MATRIX]["width"].as<int>(); int width = config[SCFG_MATRIX]["width"].as<int>();
std::vector<float> values = config[MATRIX]["matrix"].as<std::vector<float>>(); std::vector<float> values = config[SCFG_MATRIX]["matrix"].as<std::vector<float>>();
// verify the number of values in the matrix // verify the number of values in the matrix
if(height*width != (int)values.size()){ if(height*width != (int)values.size()){
...@@ -162,16 +181,38 @@ int SandboxConfig::loadAdjustingMatrixFrom(char *path, BeamerProjection *project ...@@ -162,16 +181,38 @@ int SandboxConfig::loadAdjustingMatrixFrom(char *path, BeamerProjection *project
for (int j=0; j<width; j++){ for (int j=0; j<width; j++){
matrix.at<float>(i,j) = values.at(v_i); matrix.at<float>(i,j) = values.at(v_i);
v_i++; v_i++;
std::cout << matrix.at<float>(i,j) << " ";
} }
std::cout << std::endl;
} }
std::cout << "load matrix" << std::endl;
projection->setAdjustingMatrix(matrix); projection->setAdjustingMatrix(matrix);
std::cout << "Ok matrix" << std::endl; return 0;
}
int SandboxConfig::loadDistanceToSandboxTop(char *path, BeamerProjection *projection){
YAML::Node config;
try{
config = YAML::LoadFile(path);
}catch(YAML::BadFile err){
//std::cout << "[Error] No Config File found : " << err.what() << std::endl;
return 1;
}
if(!config[SCFG_DISTANCE]){
return 2;
};
if(!(config[SCFG_DISTANCE]["distance"])){
return 2;
}
float distance = config[SCFG_DISTANCE]["distance"].as<float>();
projection->setDistanceTopSandbox(distance);
return 0; return 0;
} }
...@@ -183,24 +224,24 @@ int SandboxConfig::loadCroppingMaskFrom(char *path, Camera *camera){ ...@@ -183,24 +224,24 @@ int SandboxConfig::loadCroppingMaskFrom(char *path, Camera *camera){
try{ try{
config = YAML::LoadFile(path); config = YAML::LoadFile(path);
}catch(YAML::BadFile err){ }catch(YAML::BadFile err){
std::cout << "[Error] No Config File found : " << err.what() << std::endl; //std::cout << "[Error] No Config File found : " << err.what() << std::endl;
return 1; return 1;
} }
// no node for cropping mask // no node for cropping mask
if(!config[MASK]){ if(!config[SCFG_MASK]){
return 2; return 2;
}; };
// uncomplet data for cropping mask // uncomplet data for cropping mask
if(!(config[MASK]["x"] && config[MASK]["y"] && config[MASK]["width"] && config[MASK]["height"])){ if(!(config[SCFG_MASK]["x"] && config[SCFG_MASK]["y"] && config[SCFG_MASK]["width"] && config[SCFG_MASK]["height"])){
return 2; return 2;
} }
cv::Rect mask( cv::Point( config[MASK]["x"].as<int>(), cv::Rect mask( cv::Point( config[SCFG_MASK]["x"].as<int>(),
config[MASK]["y"].as<int>()), config[SCFG_MASK]["y"].as<int>()),
cv::Size( config[MASK]["width"].as<int>(), cv::Size( config[SCFG_MASK]["width"].as<int>(),
config[MASK]["height"].as<int>())); config[SCFG_MASK]["height"].as<int>()));
camera->setCroppingMask(mask); camera->setCroppingMask(mask);
...@@ -215,23 +256,23 @@ int SandboxConfig::loadBeamerPositionFrom(char *path, Beamer *beamer){ ...@@ -215,23 +256,23 @@ int SandboxConfig::loadBeamerPositionFrom(char *path, Beamer *beamer){
try{ try{
config = YAML::LoadFile(path); config = YAML::LoadFile(path);
}catch(YAML::BadFile err){ }catch(YAML::BadFile err){
std::cout << "[Error] No Config File found : " << err.what() << std::endl; //std::cout << "[Error] No Config File found : " << err.what() << std::endl;
return 1; return 1;
} }
// no node for beamer position // no node for beamer position
if(!config[POSITION]){ if(!config[SCFG_POSITION]){
return 2; return 2;
}; };
// uncomplet data for beamer position // uncomplet data for beamer position
if(!(config[POSITION]["x"] && config[POSITION]["y"] && config[POSITION]["z"])){ if(!(config[SCFG_POSITION]["x"] && config[SCFG_POSITION]["y"] && config[SCFG_POSITION]["z"])){
return 2; return 2;
} }
cv::Point3f pos( config[POSITION]["x"].as<float>(), cv::Point3f pos( config[SCFG_POSITION]["x"].as<float>(),
config[POSITION]["y"].as<float>(), config[SCFG_POSITION]["y"].as<float>(),
config[POSITION]["z"].as<float>()); config[SCFG_POSITION]["z"].as<float>());
beamer->setPosition(pos); beamer->setPosition(pos);
...@@ -246,22 +287,22 @@ int SandboxConfig::loadBeamerResolutionFrom(char *path, Beamer *beamer){ ...@@ -246,22 +287,22 @@ int SandboxConfig::loadBeamerResolutionFrom(char *path, Beamer *beamer){
try{ try{
config = YAML::LoadFile(path); config = YAML::LoadFile(path);
}catch(YAML::BadFile err){ }catch(YAML::BadFile err){
std::cout << "[Error] No Config File found : " << err.what() << std::endl; //std::cout << "[Error] No Config File found : " << err.what() << std::endl;
return 1; return 1;
} }
// no node for beamer resolution // no node for beamer resolution
if(!config[RESOLUTION]){ if(!config[SCFG_RESOLUTION]){
return 2; return 2;
}; };
// uncomplet data for beamer resolution // uncomplet data for beamer resolution
if(!(config[RESOLUTION]["height"] && config[RESOLUTION]["width"])){ if(!(config[SCFG_RESOLUTION]["height"] && config[SCFG_RESOLUTION]["width"])){
return 2; return 2;
} }
cv::Size res( config[RESOLUTION]["width"].as<int>(), cv::Size res( config[SCFG_RESOLUTION]["width"].as<int>(),
config[RESOLUTION]["height"].as<int>()); config[SCFG_RESOLUTION]["height"].as<int>());
beamer->setWidth(res.width); beamer->setWidth(res.width);
beamer->setHeight(res.height); beamer->setHeight(res.height);
...@@ -277,34 +318,34 @@ int SandboxConfig::loadFrameProcessProfil(char *path, FrameProcessProfil *profil ...@@ -277,34 +318,34 @@ int SandboxConfig::loadFrameProcessProfil(char *path, FrameProcessProfil *profil
try{ try{
config = YAML::LoadFile(path); config = YAML::LoadFile(path);
}catch(YAML::BadFile err){ }catch(YAML::BadFile err){
std::cout << "[Error] No Config File found : " << err.what() << std::endl; //std::cout << "[Error] No Config File found : " << err.what() << std::endl;
return 1; return 1;
} }
// no node for frame process profil // no node for frame process profil
if(!config[PROCESSPROFIL]){ if(!config[SCFG_PROCESS_PROFIL]){
return 2; return 2;
}; };
// uncomplet data for frame process profil // uncomplet data for frame process profil
if(!( config[PROCESSPROFIL]["contrast"] && if(!( config[SCFG_PROCESS_PROFIL]["contrast"] &&
config[PROCESSPROFIL]["brightness"] && config[SCFG_PROCESS_PROFIL]["brightness"] &&
config[PROCESSPROFIL]["minDistance"] && config[SCFG_PROCESS_PROFIL]["minDistance"] &&
config[PROCESSPROFIL]["cannyEdgeThreshold"] && config[SCFG_PROCESS_PROFIL]["cannyEdgeThreshold"] &&
config[PROCESSPROFIL]["houghAccThreshold"] && config[SCFG_PROCESS_PROFIL]["houghAccThreshold"] &&
config[PROCESSPROFIL]["minRadius"] && config[SCFG_PROCESS_PROFIL]["minRadius"] &&
config[PROCESSPROFIL]["maxRadius"] config[SCFG_PROCESS_PROFIL]["maxRadius"]
)){ )){
return 2; return 2;
} }
profil->setContrast(config[PROCESSPROFIL]["contrast"].as<double>()); profil->setContrast(config[SCFG_PROCESS_PROFIL]["contrast"].as<double>());
profil->setBrightness(config[PROCESSPROFIL]["brightness"].as<int>()); profil->setBrightness(config[SCFG_PROCESS_PROFIL]["brightness"].as<int>());
profil->setMinDistance(config[PROCESSPROFIL]["minDistance"].as<uint>()); profil->setMinDistance(config[SCFG_PROCESS_PROFIL]["minDistance"].as<uint>());
profil->setCannyEdgeThreshold(config[PROCESSPROFIL]["cannyEdgeThreshold"].as<uint>()); profil->setCannyEdgeThreshold(config[SCFG_PROCESS_PROFIL]["cannyEdgeThreshold"].as<uint>());
profil->setHoughAccThreshold(config[PROCESSPROFIL]["houghAccThreshold"].as<uint>()); profil->setHoughAccThreshold(config[SCFG_PROCESS_PROFIL]["houghAccThreshold"].as<uint>());
profil->setMinRadius(config[PROCESSPROFIL]["minRadius"].as<uint>()); profil->setMinRadius(config[SCFG_PROCESS_PROFIL]["minRadius"].as<uint>());
profil->setMaxRadius(config[PROCESSPROFIL]["maxRadius"].as<uint>()); profil->setMaxRadius(config[SCFG_PROCESS_PROFIL]["maxRadius"].as<uint>());
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment