Included the Layer_SURFFeature in code

This commit is contained in:
Maximilian Papa 2018-01-25 22:14:00 +01:00
parent ec4a5da05c
commit b4641fe65b
10 changed files with 82 additions and 3 deletions

View File

@ -11,6 +11,7 @@ set(SOURCE_FILES
functions/AbstractionLayers/AbstraktionLayer_Base.h functions/AbstractionLayers/AbstraktionLayer_Base.h
functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp
functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition.cpp functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition.cpp
functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.cpp
functions/AbstractionLayers/DestructionPower/DestructionPower.cpp functions/AbstractionLayers/DestructionPower/DestructionPower.cpp
header/solve.h header/solve.h
header/input.h header/input.h

View File

@ -7,7 +7,8 @@ map<int,float> DestructionPower_Properties::SpeedTable =
{ {
{0,0.99}, {0,0.99},
{1,0.7}, {1,0.7},
{2,0.7} {2,0.7},
{3,0.5}
}; };
bool DestructionPower::PreProcessing(coor mySize,const vector<Part*>* partArray) bool DestructionPower::PreProcessing(coor mySize,const vector<Part*>* partArray)

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
//TODO!! increase Destructioncount //TODO!! increase Destructioncount
#define DESTRUCTION_COUNT 2 #define DESTRUCTION_COUNT 3
#include "DestructionPower_Properties.h" #include "DestructionPower_Properties.h"
#include "../AbstraktionLayer_Base.h" #include "../AbstraktionLayer_Base.h"

View File

@ -0,0 +1,28 @@
#include "AbstractionLayer_SURFFeatures.h"
bool AbstractionLayer_SURFFeatures::PreProcessing(coor mySize, const vector<Part*>* 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.
}

View File

@ -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<AbstractionLayer_SURFFeatures_Properties>
{
public:
bool PreProcessing(coor mySize, const vector<Part*>* 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

View File

@ -0,0 +1,16 @@
#ifndef SOURCE_ABSTRACTIONLAYER_SURFFEATURES_PROPERTIES_H
#define SOURCE_ABSTRACTIONLAYER_SURFFEATURES_PROPERTIES_H
#include <stdint.h>
class AbstractionLayer_SURFFeatures_Properties
{
public:
AbstractionLayer_SURFFeatures_Properties() {}
private:
uint16_t m_numberOfFeaturesDetected;
friend class AbstractionLayer_SURFFeatures;
};
#endif //SOURCE_ABSTRACTIONLAYER_SURFFEATURES_PROPERTIES_H

View File

@ -38,6 +38,7 @@ void Puzzle::putIntoBox()
tmpPart.m_a1=this->a1.m_constraintMatrix[i+1][j+1]; tmpPart.m_a1=this->a1.m_constraintMatrix[i+1][j+1];
tmpPart.m_a3=this->a3.m_constraintMatrix[i][j]; tmpPart.m_a3=this->a3.m_constraintMatrix[i][j];
tmpPart.m_a4=this->a4.m_constraintMatrix[i][j];
//sets part id //sets part id
tmpPart.SetPartID(id++); tmpPart.SetPartID(id++);
// adds all 4 rotations to Box // adds all 4 rotations to Box
@ -66,6 +67,7 @@ void Puzzle::removeConstrains(coor removeCoordinates)
{ {
this->a1.RemoveConstraintOnPosition(removeCoordinates); this->a1.RemoveConstraintOnPosition(removeCoordinates);
this->a3.RemoveConstraintOnPosition(removeCoordinates); this->a3.RemoveConstraintOnPosition(removeCoordinates);
this->a4.RemoveConstraintOnPosition(removeCoordinates);
//TODO!! Add other layer remove here //TODO!! Add other layer remove here
} }
void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece) void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece)
@ -80,6 +82,9 @@ void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece)
//a3 //a3
this->a3.SetConstraintOnPosition(setConstraints,constraintPiece->m_a3); this->a3.SetConstraintOnPosition(setConstraints,constraintPiece->m_a3);
//a4
this->a4.SetConstraintOnPosition(setConstraints,constraintPiece->m_a4);
//TODO!! Add other layer remove here //TODO!! Add other layer remove here
} }

View File

@ -83,6 +83,9 @@ void solve(vector<LogEntry>& log,Puzzle& puzzleMat)
case 1://poempelposition case 1://poempelposition
puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
break; break;
case 4://SURFFeature
puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
break;
case -1://random case -1://random
cout << endl; cout << endl;
setsolution(log,puzzleMat); setsolution(log,puzzleMat);

View File

@ -5,10 +5,11 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include "../functions/AbstractionLayers/Layer1/AbstractionLayer_1_Properties.h" #include "../functions/AbstractionLayers/Layer1/AbstractionLayer_1_Properties.h"
#include "../functions/AbstractionLayers/DestructionPower/DestructionPower_Properties.h" #include "../functions/AbstractionLayers/DestructionPower/DestructionPower_Properties.h"
#include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition_Properties.h" #include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition_Properties.h"
#include "../functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures_Properties.h"
class LayerContainer; class LayerContainer;
class Part class Part
@ -43,6 +44,7 @@ public:
bool set; bool set;
AbstractionLayer_1_Properties m_a1; AbstractionLayer_1_Properties m_a1;
AbstractionLayer_PoempelPosition_Properties m_a3; AbstractionLayer_PoempelPosition_Properties m_a3;
AbstractionLayer_SURFFeatures_Properties m_a4;
private: private:
int32_t m_partID; int32_t m_partID;
uint8_t m_numOfRotations; uint8_t m_numOfRotations;

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
@ -6,6 +7,7 @@
#include "../functions/AbstractionLayers/Layer1/AbstractionLayer_1.h" #include "../functions/AbstractionLayers/Layer1/AbstractionLayer_1.h"
#include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition.h" #include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition.h"
#include "../functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h"
#include "../functions/AbstractionLayers/DestructionPower/DestructionPower.h" #include "../functions/AbstractionLayers/DestructionPower/DestructionPower.h"
using namespace std; using namespace std;
@ -45,6 +47,7 @@ public:
if(!dp.PreProcessing({cols,rows}, nullptr)) return false; if(!dp.PreProcessing({cols,rows}, nullptr)) return false;
if(!a1.PreProcessing({cols,rows}, &p_myBox)) return false; if(!a1.PreProcessing({cols,rows}, &p_myBox)) return false;
if(!a3.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; return true;
} }
@ -54,6 +57,7 @@ public:
DestructionPower dp; DestructionPower dp;
AbstractionLayer_1 a1; AbstractionLayer_1 a1;
AbstractionLayer_PoempelPosition a3; AbstractionLayer_PoempelPosition a3;
AbstractionLayer_SURFFeatures a4;
void removeConstrains(coor removeCoordinates); void removeConstrains(coor removeCoordinates);
void setConstraints(coor setConstraints, Part *constraintPiece); void setConstraints(coor setConstraints, Part *constraintPiece);