Added KantenLaenge

This commit is contained in:
Raphael Maenle 2018-01-30 18:45:54 +01:00
parent 6f02bf4f97
commit dd69066c76
14 changed files with 179 additions and 280 deletions

View File

@ -14,7 +14,7 @@ set(SOURCE_FILES
functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.cpp functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.cpp
functions/AbstractionLayers/Layer_ColorMatching/AbstractionLayer_ColorMatching.cpp functions/AbstractionLayers/Layer_ColorMatching/AbstractionLayer_ColorMatching.cpp
functions/AbstractionLayers/DestructionPower/DestructionPower.cpp functions/AbstractionLayers/DestructionPower/DestructionPower.cpp
functions/AbstractionLayers/Layer_Histogram/AbstractionLayer_Histogram.cpp functions/AbstractionLayers/Layer2_KantenLaenge/AbstractionLayer_KantenLaenge.cpp
header/solve.h header/solve.h
header/input.h header/input.h
functions/solve/puzzleExtension.cpp) functions/solve/puzzleExtension.cpp)

View File

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

View File

@ -27,8 +27,10 @@ bool AbstractionLayer_1::PreProcessing(coor mySize, const vector<Part*>* partAr
{ {
ref_partArray[iterator]->m_a1.m_connections=poempel; ref_partArray[iterator]->m_a1.m_connections=poempel;
ref_partArray[iterator]->m_a3.SideLength=analyse.getPoempelPosition(i); //do abstraction Layer 3 check ref_partArray[iterator]->m_a3.SideLength=analyse.getPoempelPosition(i); //do abstraction Layer 3 check
ref_partArray[iterator]->m_a2.SideLength=analyse.getKantenLaenge(i);//do abstraction Layer 2 check
shift(poempel,1); shift(poempel,1);
ref_partArray[iterator]->m_a3.shift(j);//rotate information ref_partArray[iterator]->m_a3.shift(j);//rotate information
ref_partArray[iterator]->m_a2.shift(j);//rotate information
iterator++; iterator++;
} }
} }
@ -432,7 +434,9 @@ bool analyseParts::getImages(){
} }
mask.setCorners(corners); mask.setCorners(corners);
vector<double> tmpPoempelPosition={0,0,0,0,0,0,0,0};//TODO somehow make this code section bearable vector<double> tmpPoempelPosition={0,0,0,0,0,0,0,0};//TODO somehow make this code section bearable
mask.setTabs(analyseContour(corners,contours[0],tmpPoempelPosition)); vector<double> tmpKantenLaenge= {0,0,0,0,0,0,0,0};
mask.setTabs(analyseContour(corners,contours[0],tmpPoempelPosition,tmpKantenLaenge));
mask.setKantenLaenge(tmpKantenLaenge);
mask.setPoempelPosition(tmpPoempelPosition); mask.setPoempelPosition(tmpPoempelPosition);
mask.setLens(analyseLens(lens, corners)); mask.setLens(analyseLens(lens, corners));
mask.setMidpoint(calcMidpoint(corners)); mask.setMidpoint(calcMidpoint(corners));
@ -638,7 +642,7 @@ vector<Point> analyseParts::findCorners(vector<Point> contour, Point center){
if(DISPLAY) imshow("draw",drawing); if(DISPLAY) imshow("draw",drawing);
return corners; return corners;
} }
unsigned char analyseParts::analyseContour(vector<Point> corners, vector<Point> contour,vector<double>& PoempelPosition){ unsigned char analyseParts::analyseContour(vector<Point> corners, vector<Point> contour,vector<double>& PoempelPosition, vector<double>& KantenLaenge){
vector<Point> contour_right; vector<Point> contour_right;
vector<Point> contour_top; vector<Point> contour_top;
@ -1078,6 +1082,7 @@ unsigned char analyseParts::analyseContour(vector<Point> corners, vector<Point>
diff = corners[0] - contour_right_new[max_dist_idx]; diff = corners[0] - contour_right_new[max_dist_idx];
PoempelPosition[3] = cv::sqrt(diff.x*diff.x + diff.y*diff.y); PoempelPosition[3] = cv::sqrt(diff.x*diff.x + diff.y*diff.y);
/*-------------------------------------*/ /*-------------------------------------*/
unsigned char tabs = 0; unsigned char tabs = 0;
int poembel_threshold = 15; int poembel_threshold = 15;
@ -1160,7 +1165,7 @@ unsigned char analyseParts::analyseContour(vector<Point> corners, vector<Point>
max_dist_idx = i; max_dist_idx = i;
} }
} }
//saves length between Corners and Poempel left //saves length between Corners and Poempel bottom
diff = corners[0] - contour_bottom_new[max_dist_idx]; diff = corners[0] - contour_bottom_new[max_dist_idx];
PoempelPosition[4] = cv::sqrt(diff.x*diff.x + diff.y*diff.y); PoempelPosition[4] = cv::sqrt(diff.x*diff.x + diff.y*diff.y);
diff = corners[1] - contour_bottom_new[max_dist_idx]; diff = corners[1] - contour_bottom_new[max_dist_idx];
@ -1175,6 +1180,15 @@ unsigned char analyseParts::analyseContour(vector<Point> corners, vector<Point>
if (abs(ref_bottom - contour_bottom_new[max_dist_idx].y) < poembel_threshold) { if (abs(ref_bottom - contour_bottom_new[max_dist_idx].y) < poembel_threshold) {
tabs |= (0 << BOTTOM); tabs |= (0 << BOTTOM);
} }
diff=corners[2] - corners[0];
KantenLaenge[2] = cv::sqrt(diff.x*diff.x + diff.y*diff.y);//right
diff=corners[1] - corners[3];
KantenLaenge[6] = cv::sqrt(diff.x*diff.x + diff.y*diff.y);//left
diff=corners[0] - corners[1];
KantenLaenge[4] = cv::sqrt(diff.x*diff.x + diff.y*diff.y);
diff=corners[3] - corners[2];
KantenLaenge[0] = cv::sqrt(diff.x*diff.x + diff.y*diff.y);
return tabs; return tabs;
} }

View File

@ -79,12 +79,15 @@ public:
Point getMidpoint(){return midpoint;} Point getMidpoint(){return midpoint;}
void setMidpoint(Point m ){midpoint = m;} void setMidpoint(Point m ){midpoint = m;}
vector<double> getPoempelPosition(){return PoempelPosition;} vector<double> getPoempelPosition(){return PoempelPosition;}
vector<double> getKantenLaenge(){return KantenLaenge;}
void setPoempelPosition(vector<double>& newPP){PoempelPosition=newPP;} void setPoempelPosition(vector<double>& newPP){PoempelPosition=newPP;}
void setKantenLaenge(vector<double>& newKL){KantenLaenge=newKL;}
vector<Point> getCorners(){return corners;} vector<Point> getCorners(){return corners;}
private: private:
Mat image; Mat image;
vector<double> PoempelPosition; vector<double> PoempelPosition;
vector<double> KantenLaenge;
vector<Point> corners; vector<Point> corners;
vector<vector<Point>> contour; vector<vector<Point>> contour;
vector<Vec4i> hierarchy; vector<Vec4i> hierarchy;
@ -104,12 +107,13 @@ public:
unsigned char getTabs(int i){if(i>= nr_parts)return masks[nr_parts-1].getTabs(); else return masks[i].getTabs();} unsigned char getTabs(int i){if(i>= nr_parts)return masks[nr_parts-1].getTabs(); else return masks[i].getTabs();}
vector<double> getLen(int i ){return masks[i].getLen();} vector<double> getLen(int i ){return masks[i].getLen();}
vector<double> getPoempelPosition(int i){return masks[i].getPoempelPosition();} vector<double> getPoempelPosition(int i){return masks[i].getPoempelPosition();}
vector<double> getKantenLaenge(int i){return masks[i].getKantenLaenge();}
vector<double> analyseLens(vector<double>, vector<Point>); vector<double> analyseLens(vector<double>, vector<Point>);
Point calcMidpoint(vector<Point>); Point calcMidpoint(vector<Point>);
Point getMidpoint(int i){return masks[i].getMidpoint();} Point getMidpoint(int i){return masks[i].getMidpoint();}
Point findCenter(Mat); Point findCenter(Mat);
vector<Point> findCorners(vector<Point>,Point); vector<Point> findCorners(vector<Point>,Point);
unsigned char analyseContour(vector<Point>, vector<Point>,vector<double>&); unsigned char analyseContour(vector<Point>, vector<Point>,vector<double>&,vector<double>&);
Mat makeBorder(Mat&); Mat makeBorder(Mat&);
Mat readImages(int); Mat readImages(int);
Mat morphDilateErode(Mat&); Mat morphDilateErode(Mat&);

View File

@ -0,0 +1,90 @@
#include "AbstractionLayer_KantenLaenge.h"
#include "../../../header.h"
bool AbstractionLayer_KantenLaenge::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 true;
}
//it through qualityVector and removes all that do not trigger PlaceOfPartGood
bool AbstractionLayer_KantenLaenge::EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector)
{
for(int i = 0;i<qVector.size();i++)
{
float value = PlaceOfPartGood(constraintCoordinate, qVector[i].second->m_a2.SideLength);
qVector[i].first=value;
}
}
bool AbstractionLayer_KantenLaenge::SetConstraintOnPosition(const coor constraintCoordinate, const AbstractionLayer_KantenLaenge_Properties constraint)
{
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SideLength=constraint.SideLength;
}
bool AbstractionLayer_KantenLaenge::RemoveConstraintOnPosition(const coor constraintCoordinate)
{
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SideLength={0,0,0,0,0,0,0,0};
}
float AbstractionLayer_KantenLaenge::PlaceOfPartGood(coor myCoor, vector<double> myPart)
{
vector<double> comparePosition={0,0,0,0,0,0,0,0};
float sum=0;
//create negativePart, watch out for edges
if(myCoor.col>0 && m_constraintMatrix[myCoor.col-1][myCoor.row].SideLength[3])//get right data from left
{
comparePosition[6]=m_constraintMatrix[myCoor.col-1][myCoor.row].SideLength[3];
comparePosition[7]=m_constraintMatrix[myCoor.col-1][myCoor.row].SideLength[2];
//sum absolute difference
sum+=abs(comparePosition[6]-myPart[6]);
sum+=abs(comparePosition[7]-myPart[7]);
}
if(myCoor.row>0 && m_constraintMatrix[myCoor.col][myCoor.row-1].SideLength[5])//get bot data from top
{
comparePosition[0]=m_constraintMatrix[myCoor.col][myCoor.row-1].SideLength[5];
comparePosition[1]=m_constraintMatrix[myCoor.col][myCoor.row-1].SideLength[4];
//sum absolute difference
sum+=abs(comparePosition[0]-myPart[0]);
sum+=abs(comparePosition[1]-myPart[1]);
}
if(myCoor.col<m_constraintMatrix.size()-1 && m_constraintMatrix[myCoor.col+1][myCoor.row].SideLength[7])// get left data from right
{
comparePosition[2]=m_constraintMatrix[myCoor.col+1][myCoor.row].SideLength[7];
comparePosition[3]=m_constraintMatrix[myCoor.col+1][myCoor.row].SideLength[6];
//sum absolute difference
sum+=abs(comparePosition[2]-myPart[2]);
sum+=abs(comparePosition[3]-myPart[3]);
}
if(myCoor.row<m_constraintMatrix[0].size()-1 && m_constraintMatrix[myCoor.col][myCoor.row+1].SideLength[1])//get top data from bot
{
comparePosition[4]=m_constraintMatrix[myCoor.col][myCoor.row+1].SideLength[1];
comparePosition[5]=m_constraintMatrix[myCoor.col][myCoor.row+1].SideLength[0];
//sum absolute difference
sum+=abs(comparePosition[4]-myPart[4]);
sum+=abs(comparePosition[5]-myPart[5]);
}
if(sum>500)
return 0;
if(sum==0)
return 1;
sum/=500;
return 1-sum;
//check vector against negative part, use sad
//return of well it fits within threshold
}
//shifts vector i steps to the right (8-2i to the left)
void AbstractionLayer_KantenLaenge_Properties::shift(int i)
{
rotate(SideLength.begin(),SideLength.begin()+(8-2*i),SideLength.end());
}

View File

@ -0,0 +1,22 @@
#pragma once
#include "AbstractionLayer_KantenLaenge_Properties.h"
#include "../AbstraktionLayer_Base.h"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace std;
using namespace cv;
class AbstractionLayer_KantenLaenge : public AbstractionLayer_Base<AbstractionLayer_KantenLaenge_Properties>
{
public:
bool PreProcessing(coor mySize, const vector<Part*>* partArray) final ;
bool EvaluateQuality ( coor constraintCoordinate, qualityVector& qVector)final;
bool SetConstraintOnPosition( coor constraintCoordinate, AbstractionLayer_KantenLaenge_Properties constraint)final;
bool RemoveConstraintOnPosition( coor constraintCoordinate)final;
float PlaceOfPartGood(coor myCoor, vector<double> myPart);
private:
};

View File

@ -0,0 +1,19 @@
#pragma once
#include <vector>
using namespace std;
class AbstractionLayer_KantenLaenge_Properties
{
public:
AbstractionLayer_KantenLaenge_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<double> SideLength;
friend class AbstractionLayer_KantenLaenge;
friend class AbstractionLayer_PoempelPosition;
friend class AbstractionLayer_1;
};

View File

@ -1,176 +0,0 @@
//
// Created by Niko on 1/11/2018.
//
#include "../../../header.h"
#include "AbstractionLayer_Histogram.h"
using namespace cv;
Mat HistogramComparer::readImages(int count)
{
char name[100];
Mat corr;
Mat ref_gray;
sprintf(name, PATH, count);
Mat src = imread(name, 1);
// namedWindow("UP1", WINDOW_AUTOSIZE);
//imshow("UP1",src);
if (!src.data)
{
cerr << "Problem loading image!!!" << endl;
return src;
}
if(DISPLAY)imshow("src",src);
Mat im_color;
cvtColor(src, im_color, COLOR_BGR2HSV);
return im_color;
}
bool AbstractionLayer_Histogram::PreProcessing(coor mySize, const vector<Part*>* partArray){
// HistogramComparer localImage;
cout << "Abstraction 2 Preprocessing... " << flush;
const vector<Part*>& ref_partArray = *partArray;
HistogramComparer analyse(mySize.row*mySize.col);
Part buf;
int iterator=0;
if(!analyse.getImages())
{
cerr << "Error occured in getImages!" << endl;
return false;
}
else // hier werden alle vier verschiedenen Rotationsarten 'gleichzeitig' abgespeichert
//TODO rows and cols
for(int i = 0; i < mySize.row*mySize.col; i++)
{
Mat src_img1 = analyse.readImages(i);
Mat hsv_img1;
/// Convert to HSV
cvtColor(src_img1, hsv_img1, COLOR_BGR2HSV);
/// Using 50 bins for hue and 60 for saturation
int h_bins = 50;
int s_bins = 60;
int histSize[] = {h_bins, s_bins};
// hue varies from 0 to 179, saturation from 0 to 255
float h_ranges[] = {0, 180};
float s_ranges[] = {0, 256};
const float *ranges[] = {h_ranges, s_ranges};
// Use the o-th and 1-st channels
int channels[] = {0, 1};
/// Histograms
MatND hist_img1;
/// Calculate the histograms for the HSV images
calcHist(&hsv_img1, 1, channels, Mat(), hist_img1, 2, histSize, ranges, true, false);
// normalize(hist_img1, hist_img1, 0, 1, NORM_MINMAX, -1, Mat());
ref_partArray[iterator]->m_his.image=hsv_img1;
iterator++;
}
InitialiseConstraintMatrixSize(mySize.col, mySize.row); //col row switched in this function
cout << "Done!" << endl;
return true;
}
bool AbstractionLayer_Histogram::EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector){
//evaluateQuality = evaluateProbabilaty
for(int i = 0;i < qVector.size();i++)
{
if(PlaceOfPartGood(constraintCoordinate, qVector[i].second->m_his.image))
{
qVector[i].first=1;
continue;
}
if(constraintCoordinate.row<1 || constraintCoordinate.col < 1 )
qVector[i].first=0.8;
else
qVector[i].first=0;
}
}
bool AbstractionLayer_Histogram::PlaceOfPartGood(coor myCoor, Mat& myPart)
{
//sets coordinates to correct position for layer
if( myCoor.row == 1 && myCoor.col == 1){return true;}
else if(myCoor.col == 1 && myCoor.row >1){
if(CompareHistogram(m_constraintMatrix[myCoor.col][myCoor.row-1].image, myPart)){
return true;
}
else return false;
}
else if( myCoor.row == 1 && myCoor.col >1){
if(CompareHistogram(m_constraintMatrix[myCoor.col-1][myCoor.row].image, myPart)){
return true;
}
else return false;
}
else if (myCoor.col > 1 && myCoor.row >1){
if( CompareHistogram(m_constraintMatrix[myCoor.col][myCoor.row-1].image, myPart) &&
CompareHistogram(m_constraintMatrix[myCoor.col-1][myCoor.row].image, myPart)){
return true;
}
else return false;
}else return false;
}
bool AbstractionLayer_Histogram::CompareHistogram(Mat hist_img1,Mat hist_img2)
{
// Correlation
double Correlation = compareHist(hist_img1, hist_img2, CV_COMP_CORREL);
if(Correlation > 0.95 ){
return true;
}
else
return false;
}
bool AbstractionLayer_Histogram::SetConstraintOnPosition(const coor constraintCoordinate, const AbstractionLayer_Histogram_Properties constraint)
{
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].image=constraint.image;
//m_constraintMatrix[constraintCoordinate.col+1][constraintCoordinate.row+1].m_connections=constraint.m_connections;
}
bool AbstractionLayer_Histogram::RemoveConstraintOnPosition(const coor constraintCoordinate)
{
Mat dummy(1,1,0);
m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].image = dummy;
}
bool HistogramComparer::getImages() {
Mat src;
for (int i = 0; i < nr_parts; i++) {
if (DISPLAY) cout << "Bild " << i << endl;
Mat img = readImages(i);
if (!img.data) {
cerr << "Error: No pic found!!" << endl;
return false;
}
else return true;
}
}

View File

@ -1,43 +0,0 @@
//
// Created by Niko on 1/11/2018.
//
#ifndef MPK_PUZZLE_ABSTRACTIONLAYER_HISTOGRAM_H
#define MPK_PUZZLE_ABSTRACTIONLAYER_HISTOGRAM_H
#define DISPLAY false
//#define PATH "..\\..\\..\\pieces\\%04d.jpg"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "AbstractionLayer_Histogram_Properties.h"
#include "../AbstraktionLayer_Base.h"
using namespace std;
using namespace cv;
class AbstractionLayer_Histogram : public AbstractionLayer_Base<AbstractionLayer_Histogram_Properties>
{
public:
bool PreProcessing(coor mySize, const vector<Part*>* partArray) override ;
bool EvaluateQuality ( coor constraintCoordinate, qualityVector& qVector)override;
bool RemoveConstraintOnPosition( coor constraintCoordinate)override;
bool PlaceOfPartGood(coor myCoor, Mat& myPart);
bool SetConstraintOnPosition( coor constraintCoordinate, AbstractionLayer_Histogram_Properties constraint)override;
qualityVector returnInBox(vector<Part>& PuzzleBox);
void printConstraintMatrix();
bool CompareHistogram(Mat Part, Mat RefPart);
private:
};
class HistogramComparer{
public:
explicit HistogramComparer(int s = 1008): nr_parts(s){}
Mat readImages(int);
bool getImages();
private:
int nr_parts;
};
#endif //MPK_PUZZLE_ABSTRACTIONLAYER_HISTOGRAM_H

View File

@ -1,29 +0,0 @@
//
// Created by Niko on 1/11/2018.
//
#ifndef MPK_PUZZLE_ABSTRACTIONLAYER_HISTOGRAM_PROPERTIES_H
#define MPK_PUZZLE_ABSTRACTIONLAYER_HISTOGRAM_PROPERTIES_H
#include <stdint.h>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;
class AbstractionLayer_Histogram_Properties
{
public:
AbstractionLayer_Histogram_Properties() : Correlation(-1){}
double getCorrelation(){return Correlation;}
Mat getmHistogram(){return m_Histogram;}
private:
double Correlation;
Mat m_Histogram;
Mat image;
friend class AbstractionLayer_Histogram;
};
#endif //MPK_PUZZLE_ABSTRACTIONLAYER_HISTOGRAM_PROPERTIES_H

View File

@ -70,7 +70,7 @@ void Puzzle::removeConstrains(coor removeCoordinates)
this->a3.RemoveConstraintOnPosition(removeCoordinates); this->a3.RemoveConstraintOnPosition(removeCoordinates);
this->a4.RemoveConstraintOnPosition(removeCoordinates); this->a4.RemoveConstraintOnPosition(removeCoordinates);
this->acm.RemoveConstraintOnPosition(removeCoordinates); this->acm.RemoveConstraintOnPosition(removeCoordinates);
this->his.RemoveConstraintOnPosition(removeCoordinates); this->a2.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)
@ -93,7 +93,7 @@ void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece)
this->acm.SetConstraintOnPosition(setConstraints,constraintPiece->m_acm); this->acm.SetConstraintOnPosition(setConstraints,constraintPiece->m_acm);
//his //his
this->his.SetConstraintOnPosition(setConstraints,constraintPiece->m_his); this->a2.SetConstraintOnPosition(setConstraints,constraintPiece->m_a2);
//TODO!! Add other layer remove here //TODO!! Add other layer remove here
} }

View File

@ -58,27 +58,25 @@ coor calculateNextCoor(vector<LogEntry>& log, Puzzle& puzzleMat)
{ {
if (log.size() == 1) if (log.size() == 1)
// return {0,0}; return {0,0};
return {1,1};
unsigned int col= log.rbegin()[1].myCoor.col; unsigned int col= log.rbegin()[1].myCoor.col;
unsigned int row= log.rbegin()[1].myCoor.row; unsigned int row= log.rbegin()[1].myCoor.row;
//level 2 edges first //level 2 edges first
// if(col == 0 && row < 27) if(col == 0 && row < 27)
// return {col,++row}; return {col,++row};
// if(row== 27 && col < 35) if(row== 27 && col < 35)
// return {++col,row}; return {++col,row};
// if(col == 35 && row >0) if(col == 35 && row >0)
// return {col, --row}; return {col, --row};
// if(col >1&& row ==0) if(col >1&& row ==0)
// return{--col,row}; return{--col,row};
// if(col==1 && row==0) if(col==1 && row==0)
// return {1,1}; return {1,1};
log.pop_back();//vis only!!!
// log.pop_back();//vis only!!! puzzleMat.resultImage(log);//vis only!!!
// puzzleMat.resultImage(log);//vis only!!!
if(row<puzzleMat.getSizeAsCoor().row-2) row++; if(row<puzzleMat.getSizeAsCoor().row-2) row++;
@ -104,10 +102,10 @@ void solve(vector<LogEntry>& log,Puzzle& puzzleMat)
//TODO!! Add more layers here //TODO!! Add more layers here
switch(log.back().abstractionLevel) switch(log.back().abstractionLevel)
{ {
case 10://pömpel case 0://pömpel
puzzleMat.a1.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); puzzleMat.a1.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
break; break;
case 2://SURFFeature case 4://SURFFeature
// return; // return;
puzzleMat.a4.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); puzzleMat.a4.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
break; break;
@ -117,8 +115,8 @@ void solve(vector<LogEntry>& log,Puzzle& puzzleMat)
case 1://color case 1://color
puzzleMat.acm.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); puzzleMat.acm.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
break; break;
case 0://histogram case 2://KantenLaenge
puzzleMat.his.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); puzzleMat.a2.EvaluateQuality(log.back().myCoor,log.back().PieceCollector);
break; break;
case -1://random case -1://random
setsolution(log,puzzleMat); setsolution(log,puzzleMat);

View File

@ -10,7 +10,7 @@
#include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition_Properties.h" #include "../functions/AbstractionLayers/Layer3_PoempelPosition/AbstractionLayer_PoempelPosition_Properties.h"
#include "../functions/AbstractionLayers/Layer_ColorMatching/AbstractionLayer_ColorMatching_Properties.h" #include "../functions/AbstractionLayers/Layer_ColorMatching/AbstractionLayer_ColorMatching_Properties.h"
#include "../functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures_Properties.h" #include "../functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures_Properties.h"
#include "../functions/AbstractionLayers/Layer_Histogram/AbstractionLayer_Histogram_Properties.h" #include "../functions/AbstractionLayers/Layer2_KantenLaenge/AbstractionLayer_KantenLaenge_Properties.h"
class LayerContainer; class LayerContainer;
class Part class Part
@ -47,7 +47,7 @@ public:
AbstractionLayer_PoempelPosition_Properties m_a3; AbstractionLayer_PoempelPosition_Properties m_a3;
AbstractionLayer_SURFFeatures_Properties m_a4; AbstractionLayer_SURFFeatures_Properties m_a4;
AbstractionLayer_ColorMatching_Properties m_acm; AbstractionLayer_ColorMatching_Properties m_acm;
AbstractionLayer_Histogram_Properties m_his; AbstractionLayer_KantenLaenge_Properties m_a2;
private: private:
int32_t m_partID; int32_t m_partID;
uint8_t m_numOfRotations; uint8_t m_numOfRotations;

View File

@ -9,7 +9,7 @@
#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/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h"
#include "../functions/AbstractionLayers/Layer_ColorMatching/AbstractionLayer_ColorMatching.h" #include "../functions/AbstractionLayers/Layer_ColorMatching/AbstractionLayer_ColorMatching.h"
#include "../functions/AbstractionLayers/Layer_Histogram/AbstractionLayer_Histogram.h" #include "../functions/AbstractionLayers/Layer2_KantenLaenge/AbstractionLayer_KantenLaenge.h"
#include "../functions/AbstractionLayers/DestructionPower/DestructionPower.h" #include "../functions/AbstractionLayers/DestructionPower/DestructionPower.h"
using namespace std; using namespace std;
@ -57,7 +57,7 @@ public:
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; if(!a4.PreProcessing({cols,rows}, &p_myBox)) return false;
if(!acm.PreProcessing({cols,rows}, &p_myBox)) return false; if(!acm.PreProcessing({cols,rows}, &p_myBox)) return false;
if(!his.PreProcessing({cols,rows}, &p_myBox)) return false; if(!a2.PreProcessing({cols,rows}, &p_myBox)) return false;
return true; return true;
} }
@ -69,7 +69,7 @@ public:
AbstractionLayer_PoempelPosition a3; AbstractionLayer_PoempelPosition a3;
AbstractionLayer_SURFFeatures a4; AbstractionLayer_SURFFeatures a4;
AbstractionLayer_ColorMatching acm; AbstractionLayer_ColorMatching acm;
AbstractionLayer_Histogram his; AbstractionLayer_KantenLaenge a2;
void removeConstrains(coor removeCoordinates); void removeConstrains(coor removeCoordinates);
void setConstraints(coor setConstraints, Part *constraintPiece); void setConstraints(coor setConstraints, Part *constraintPiece);