diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 3be9ee9..cbdec11 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -11,6 +11,7 @@ set(SOURCE_FILES functions/AbstractionLayers/AbstraktionLayer_Base.h functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition.cpp + functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.cpp functions/AbstractionLayers/DestructionPower/DestructionPower.cpp header/solve.h header/input.h diff --git a/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.cpp b/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.cpp index 4cf06d0..5a901c6 100644 --- a/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.cpp +++ b/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.cpp @@ -7,7 +7,8 @@ map DestructionPower_Properties::SpeedTable = { {0,0.99}, {1,0.7}, - {2,0.7} + {2,0.7}, + {3,0.5} }; bool DestructionPower::PreProcessing(coor mySize,const vector* partArray) diff --git a/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.h b/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.h index f51fc35..288af80 100644 --- a/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.h +++ b/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.h @@ -1,6 +1,6 @@ #pragma once //TODO!! increase Destructioncount -#define DESTRUCTION_COUNT 2 +#define DESTRUCTION_COUNT 3 #include "DestructionPower_Properties.h" #include "../AbstraktionLayer_Base.h" diff --git a/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.cpp b/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.cpp new file mode 100644 index 0000000..2f990ab --- /dev/null +++ b/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.cpp @@ -0,0 +1,28 @@ +#include "AbstractionLayer_SURFFeatures.h" + +bool AbstractionLayer_SURFFeatures::PreProcessing(coor mySize, const vector* partArray) +{ + //TODO: Gesamtbild mit OpenCV einlesen + //TODO: Gesamtbild anhand der berechneten Spalten und Zeilen auseinander schneiden (Sind in der puzzleKlasse gespeichert) + //TODO: Features der einzelnen Felder des ausgeschnittenen Gesamtbildes in der m_constraintMatrix speichern + + //TODO: Alle Bilder mit OpenCV öffnen und deren erkannten Features in SURFFeature_Properties der Part-Klasse speichern +} + +bool AbstractionLayer_SURFFeatures::EvaluateQuality (coor constraintCoordinate, qualityVector& qVector) +{ + //TODO: Vergleichen, welche der in qualityVector erhaltenen ähnlich viele Features besitzen, wie an der jeweiligen constraintCoordinate in der m_constraintMatrix gespeichert sind +} + +bool AbstractionLayer_SURFFeatures::SetConstraintOnPosition(const coor constraintCoordinate,const AbstractionLayer_SURFFeatures_Properties constraint) +{ + //TODO: Benötigen wir nicht unbedint. + //TODO: Hier erhalten wir vom Dispatcher welches Teil an welche Position gesetzt wird und wir könnten hier die Features des Bilds in die m_constraintMatrix speichern +} + +bool AbstractionLayer_SURFFeatures::RemoveConstraintOnPosition(const coor constraintCoordinate) +{ + //TODO: Wie auch beim SetConstraint sollte uns das hier nicht wirklich interessieren. + //TODO: Außer wir setzen etwas in die Contraintmatrix. + //TODO: Dann ruft uns der Dispatcher beim Backtrack hier auf und wir müssten das jeweilige PuzzlePart hier wieder rauslöschen. +} \ No newline at end of file diff --git a/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h b/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h new file mode 100644 index 0000000..58a5c3d --- /dev/null +++ b/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h @@ -0,0 +1,19 @@ +#ifndef SOURCE_ABSTRACTIONLAYER_SURFFEATURES_H +#define SOURCE_ABSTRACTIONLAYER_SURFFEATURES_H + +#include "../AbstraktionLayer_Base.h" + +using namespace std; + +class AbstractionLayer_SURFFeatures : public AbstractionLayer_Base +{ +public: + bool PreProcessing(coor mySize, const vector* partArray) ; + bool EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector); + bool SetConstraintOnPosition(const coor constraintCoordinate,const AbstractionLayer_SURFFeatures_Properties constraint); + bool RemoveConstraintOnPosition(const coor constraintCoordinate); + +private: +}; + +#endif //SOURCE_ABSTRACTIONLAYER_SURFFEATURES_H diff --git a/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures_Properties.h b/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures_Properties.h new file mode 100644 index 0000000..46164ce --- /dev/null +++ b/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures_Properties.h @@ -0,0 +1,16 @@ +#ifndef SOURCE_ABSTRACTIONLAYER_SURFFEATURES_PROPERTIES_H +#define SOURCE_ABSTRACTIONLAYER_SURFFEATURES_PROPERTIES_H + +#include + +class AbstractionLayer_SURFFeatures_Properties +{ +public: + AbstractionLayer_SURFFeatures_Properties() {} + +private: + uint16_t m_numberOfFeaturesDetected; + friend class AbstractionLayer_SURFFeatures; +}; + +#endif //SOURCE_ABSTRACTIONLAYER_SURFFEATURES_PROPERTIES_H diff --git a/Source/functions/solve/puzzleExtension.cpp b/Source/functions/solve/puzzleExtension.cpp index 60e21fd..c5abf29 100644 --- a/Source/functions/solve/puzzleExtension.cpp +++ b/Source/functions/solve/puzzleExtension.cpp @@ -38,6 +38,7 @@ void Puzzle::putIntoBox() tmpPart.m_a1=this->a1.m_constraintMatrix[i+1][j+1]; tmpPart.m_a3=this->a3.m_constraintMatrix[i][j]; + tmpPart.m_a4=this->a4.m_constraintMatrix[i][j]; //sets part id tmpPart.SetPartID(id++); // adds all 4 rotations to Box @@ -66,6 +67,7 @@ void Puzzle::removeConstrains(coor removeCoordinates) { this->a1.RemoveConstraintOnPosition(removeCoordinates); this->a3.RemoveConstraintOnPosition(removeCoordinates); + this->a4.RemoveConstraintOnPosition(removeCoordinates); //TODO!! Add other layer remove here } void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece) @@ -80,6 +82,9 @@ void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece) //a3 this->a3.SetConstraintOnPosition(setConstraints,constraintPiece->m_a3); + + //a4 + this->a4.SetConstraintOnPosition(setConstraints,constraintPiece->m_a4); //TODO!! Add other layer remove here } diff --git a/Source/functions/solve/structure.cpp b/Source/functions/solve/structure.cpp index 3b924fc..1d999e1 100755 --- a/Source/functions/solve/structure.cpp +++ b/Source/functions/solve/structure.cpp @@ -83,6 +83,9 @@ void solve(vector& log,Puzzle& puzzleMat) case 1://poempelposition puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); break; + case 4://SURFFeature + puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); + break; case -1://random cout << endl; setsolution(log,puzzleMat); diff --git a/Source/header/input.h b/Source/header/input.h index dff917f..98506b5 100755 --- a/Source/header/input.h +++ b/Source/header/input.h @@ -5,10 +5,11 @@ #pragma once #include - #include "../functions/AbstractionLayers/Layer1/AbstractionLayer_1_Properties.h" #include "../functions/AbstractionLayers/DestructionPower/DestructionPower_Properties.h" #include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition_Properties.h" +#include "../functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures_Properties.h" + class LayerContainer; class Part @@ -43,6 +44,7 @@ public: bool set; AbstractionLayer_1_Properties m_a1; AbstractionLayer_PoempelPosition_Properties m_a3; + AbstractionLayer_SURFFeatures_Properties m_a4; private: int32_t m_partID; uint8_t m_numOfRotations; diff --git a/Source/header/solve.h b/Source/header/solve.h index 368609d..2e3f509 100755 --- a/Source/header/solve.h +++ b/Source/header/solve.h @@ -1,4 +1,5 @@ #pragma once + #include #include #include @@ -6,6 +7,7 @@ #include "../functions/AbstractionLayers/Layer1/AbstractionLayer_1.h" #include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition.h" +#include "../functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h" #include "../functions/AbstractionLayers/DestructionPower/DestructionPower.h" using namespace std; @@ -45,6 +47,7 @@ public: if(!dp.PreProcessing({cols,rows}, nullptr)) return false; if(!a1.PreProcessing({cols,rows}, &p_myBox)) return false; if(!a3.PreProcessing({cols,rows}, &p_myBox)) return false; + if(!a4.PreProcessing({cols,rows}, &p_myBox)) return false; return true; } @@ -54,6 +57,7 @@ public: DestructionPower dp; AbstractionLayer_1 a1; AbstractionLayer_PoempelPosition a3; + AbstractionLayer_SURFFeatures a4; void removeConstrains(coor removeCoordinates); void setConstraints(coor setConstraints, Part *constraintPiece);