added base structure into code
needs picture information expanded evaluation prototype
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
//TODO!! increase Destructioncount
|
||||
#define DESTRUCTION_COUNT 1
|
||||
#define DESTRUCTION_COUNT 2
|
||||
|
||||
#include "DestructionPower_Properties.h"
|
||||
#include "../AbstraktionLayer_Base.h"
|
||||
|
@ -36,7 +36,7 @@ bool AbstractionLayer_1::PreProcessing(coor mySize, const vector<Part*>* partAr
|
||||
|
||||
//Zugriff auf den vector mit den einzelnen teilen: part[0].getConnenctions() entspricht pömpel von bild 0.jpg und liefert ein unsigned char, poempl Belegung wie ausgemacht
|
||||
|
||||
InitialiseConstraintMatrixSize(mySize.col+2, mySize.row+2); //col row switched in this function
|
||||
InitialiseConstraintMatrixSize(mySize.col+2, mySize.row+2);
|
||||
setEdgeZero();
|
||||
|
||||
cout << "Done!" << endl;
|
||||
@ -73,15 +73,11 @@ int AbstractionLayer_1::PoempelSum(uint8_t constraint)
|
||||
//it through qualityVector and removes all that do not trigger PlaceOfPartGood
|
||||
bool AbstractionLayer_1::EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector)
|
||||
{
|
||||
if(constraintCoordinate.row==23 && constraintCoordinate.col==35)
|
||||
cout << "in" << endl;
|
||||
//evaluateQuality = evaluateProbabilaty
|
||||
for(int i = 0;i<qVector.size();i++)
|
||||
{
|
||||
if(PlaceOfPartGood(constraintCoordinate, qVector[i].second->m_a1.m_connections))
|
||||
{
|
||||
qVector[i].first=1;
|
||||
|
||||
continue;
|
||||
}
|
||||
qVector[i].first=0;
|
||||
|
@ -45,10 +45,10 @@ using namespace cv;
|
||||
class AbstractionLayer_1 : public AbstractionLayer_Base<AbstractionLayer_1_Properties>
|
||||
{
|
||||
public:
|
||||
bool PreProcessing(coor mySize, const vector<Part*>* partArray) override ;
|
||||
bool EvaluateQuality ( coor constraintCoordinate, qualityVector& qVector)override;
|
||||
bool SetConstraintOnPosition( coor constraintCoordinate, AbstractionLayer_1_Properties constraint)override;
|
||||
bool RemoveConstraintOnPosition( coor constraintCoordinate)override;
|
||||
bool PreProcessing(coor mySize, const vector<Part*>* partArray) final ;
|
||||
bool EvaluateQuality ( coor constraintCoordinate, qualityVector& qVector)final;
|
||||
bool SetConstraintOnPosition( coor constraintCoordinate, AbstractionLayer_1_Properties constraint)final;
|
||||
bool RemoveConstraintOnPosition( coor constraintCoordinate)final;
|
||||
int RemoveSimilar(qualityVector&,uint8_t&);
|
||||
|
||||
bool PlaceOfPartGood(coor myCoor, uint8_t& myPart);
|
||||
|
@ -0,0 +1,56 @@
|
||||
#include "AbstractionLayer_PoempelPosition.h"
|
||||
#include "../../../header.h"
|
||||
|
||||
bool AbstractionLayer_PoempelPosition::PreProcessing(coor mySize, const vector<Part*>* partArray)
|
||||
{
|
||||
//get layer information here
|
||||
cout << "Abstraction Poempel Position Preprocessing... " << flush;
|
||||
|
||||
|
||||
InitialiseConstraintMatrixSize(mySize.col, mySize.row);
|
||||
|
||||
cout << "Done" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
//it through qualityVector and removes all that do not trigger PlaceOfPartGood
|
||||
bool AbstractionLayer_PoempelPosition::EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector)
|
||||
{
|
||||
for(int i = 0;i<qVector.size();i++)
|
||||
{
|
||||
float value = PlaceOfPartGood(constraintCoordinate, qVector[i].second->m_a3.SideLength));
|
||||
if(value > 0.8)//TODO find threshold
|
||||
{
|
||||
qVector[i].first=value;
|
||||
continue;
|
||||
}
|
||||
qVector[i].first=0;
|
||||
}
|
||||
}
|
||||
|
||||
bool AbstractionLayer_PoempelPosition::SetConstraintOnPosition(const coor constraintCoordinate, const AbstractionLayer_PoempelPosition_Properties constraint)
|
||||
{
|
||||
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SideLength=constraint.SideLength;
|
||||
}
|
||||
|
||||
bool AbstractionLayer_PoempelPosition::RemoveConstraintOnPosition(const coor constraintCoordinate)
|
||||
{
|
||||
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SideLength={0,0,0,0,0,0,0,0};
|
||||
}
|
||||
|
||||
float AbstractionLayer_PoempelPosition::PlaceOfPartGood(coor myCoor, vector<float> myPart)
|
||||
{
|
||||
//sets coordinates to correct position for layer
|
||||
|
||||
//create negativePart, watch out for edges
|
||||
|
||||
//check vector against negative part
|
||||
|
||||
//return of well it fits within threshold
|
||||
}
|
||||
|
||||
//shifts vector i steps to the right (8-2i to the left)
|
||||
void AbstractionLayer_PoempelPosition_Properties::shift(int i)
|
||||
{
|
||||
rotate(SideLength.begin(),SideLength.begin()+(8-2*i),SideLength.end());
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "AbstractionLayer_PoempelPosition_Properties.h"
|
||||
#include "../AbstraktionLayer_Base.h"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
class AbstractionLayer_PoempelPosition : public AbstractionLayer_Base<AbstractionLayer_PoempelPosition_Properties>
|
||||
{
|
||||
public:
|
||||
bool PreProcessing(coor mySize, const vector<Part*>* partArray) final ;
|
||||
bool EvaluateQuality ( coor constraintCoordinate, qualityVector& qVector)final;
|
||||
bool SetConstraintOnPosition( coor constraintCoordinate, AbstractionLayer_PoempelPosition_Properties constraint)final;
|
||||
bool RemoveConstraintOnPosition( coor constraintCoordinate)final;
|
||||
|
||||
float PlaceOfPartGood(coor myCoor, vector<float> myPart);
|
||||
|
||||
private:
|
||||
};
|
@ -0,0 +1,17 @@
|
||||
|
||||
#pragma once
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
class AbstractionLayer_PoempelPosition_Properties
|
||||
{
|
||||
public:
|
||||
AbstractionLayer_PoempelPosition_Properties():SideLength({0,0,0,0,0,0,0,0}){}
|
||||
float getSideLength(int i){if (i<8 && i>=0)return SideLength[i]; else return -1;};
|
||||
void shift(int i);
|
||||
private:
|
||||
|
||||
vector<float> SideLength;
|
||||
friend class AbstractionLayer_PoempelPosition;
|
||||
};
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
//
|
||||
// Created by Niko on 1/15/2018.
|
||||
//
|
||||
|
||||
#ifndef MPK_PUZZLE_ABSTRACTIONLAYER_MEANDIFFERENCE_H
|
||||
#define MPK_PUZZLE_ABSTRACTIONLAYER_MEANDIFFERENCE_H
|
||||
#define DISPLAY false
|
||||
#define PATH "..\\..\\..\\pieces\\%04d.jpg"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
class AbstractionLayer_MeanDifference : public AbstractionLayer_Base<AbstractionLayer_MeanDifference_Properties>
|
||||
{
|
||||
public:
|
||||
bool PreProcessing(coor mySize, const vector<Part*>* partArray) override ;
|
||||
bool EvaluateQuality ( coor constraintCoordinate, qualityVector& qVector)override;
|
||||
bool SetConstraintOnPosition( coor constraintCoordinate, AbstractionLayer_1_Properties constraint)override;
|
||||
bool RemoveConstraintOnPosition( coor constraintCoordinate)override;
|
||||
bool PlaceOfPartGood(coor myCoor, Mat& myPart);
|
||||
|
||||
qualityVector returnInBox(vector<Part>& PuzzleBox);
|
||||
void printConstraintMatrix();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class cMeanDifference{
|
||||
public:
|
||||
Mat readImages(int);
|
||||
bool calculateMeanDifference(Mat Part, Mat RefPart);
|
||||
private:
|
||||
|
||||
};
|
||||
#endif //MPK_PUZZLE_ABSTRACTIONLAYER_MEANDIFFERENCE_H
|
@ -1,20 +0,0 @@
|
||||
//
|
||||
// Created by Niko on 1/15/2018.
|
||||
//
|
||||
|
||||
#ifndef MPK_PUZZLE_ABSTRACTIONLAYER_MEANDIFFERENCE_PROPERTIES_H
|
||||
#define MPK_PUZZLE_ABSTRACTIONLAYER_MEANDIFFERENCE_PROPERTIES_H
|
||||
|
||||
class AbstractionLayer_MeanDifference_Properties
|
||||
{
|
||||
public:
|
||||
AbstractionLayer_MeanDifference_Properties() : MeanDifference(-1){}
|
||||
double getMeanDifference(){return MeanDifference;};
|
||||
|
||||
private:
|
||||
|
||||
double MeanDifference;
|
||||
friend class AbstractionLayer_MeanDifference;
|
||||
Mat image;
|
||||
};
|
||||
#endif //MPK_PUZZLE_ABSTRACTIONLAYER_MEANDIFFERENCE_PROPERTIES_H
|
Reference in New Issue
Block a user