From e906b63dc1e5ed79c085e0d7a41be0151966fd95 Mon Sep 17 00:00:00 2001 From: Raphael Maenle <17550607+g-spacewhale@users.noreply.github.com> Date: Sat, 27 Jan 2018 16:06:03 +0100 Subject: [PATCH] removed minor changes --- .../Layer1/AbstractionLayer_1.h | 2 +- .../AbstractionLayer_SURFFeatures.h | 4 +-- Source/functions/solve/puzzleExtension.cpp | 4 +-- Source/functions/solve/structure.cpp | 33 ++++++++----------- Source/header/solve.h | 2 +- 5 files changed, 19 insertions(+), 26 deletions(-) diff --git a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h index 01580d3..66ea9f2 100644 --- a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h +++ b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h @@ -22,7 +22,7 @@ #define DISPLAY false #ifdef _WIN32 -#define PATH "..\\..\\..\\pieces\\%04d.jpg" +#define PATH "..\\..\\..\\pieces_bb\\%04d.jpg" #elif defined __unix__ #define PATH "..//..//..//pieces//%04d.jpg" #elif defined __APPLE__ diff --git a/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h b/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h index 5dd0070..a50e1f1 100644 --- a/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h +++ b/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h @@ -6,7 +6,7 @@ #include "opencv2/imgproc/imgproc.hpp" #ifdef _WIN32 -#define PATH_FULL_PUZZLE "..\\..\\..\\puzzle_img\\puzzle2.jpg" +#define PATH_FULL_PUZZLE "..\\..\\..\\puzzle_img_bb\\puzzle2.jpg" #elif defined __unix__ #define PATH_FULL_PUZZLE "..//..//..//puzzle_img//puzzle1.jpg" #elif defined __APPLE__ @@ -14,7 +14,7 @@ #endif #ifdef _WIN32 //TODO: Code duplicate from AbstractionLayer_1.h -#define PATH1 "..\\..\\..\\pieces\\%04d.jpg" +#define PATH1 "..\\..\\..\\pieces_bb\\%04d.jpg" #elif defined __unix__ #define PATH1 "..//..//..//pieces//%04d.jpg" #elif defined __APPLE__ diff --git a/Source/functions/solve/puzzleExtension.cpp b/Source/functions/solve/puzzleExtension.cpp index 1e6012e..bb42a14 100644 --- a/Source/functions/solve/puzzleExtension.cpp +++ b/Source/functions/solve/puzzleExtension.cpp @@ -66,7 +66,7 @@ void Puzzle::shuffle() void Puzzle::removeConstrains(coor removeCoordinates) { this->a1.RemoveConstraintOnPosition(removeCoordinates); - //this->a3.RemoveConstraintOnPosition(removeCoordinates); + this->a3.RemoveConstraintOnPosition(removeCoordinates); this->a4.RemoveConstraintOnPosition(removeCoordinates); //TODO!! Add other layer remove here } @@ -81,7 +81,7 @@ void Puzzle::setConstraints(coor setConstraints, Part* constraintPiece) this->a1.SetConstraintOnPosition(setConstraints,constraintPiece->m_a1); //a3 - //this->a3.SetConstraintOnPosition(setConstraints,constraintPiece->m_a3); + this->a3.SetConstraintOnPosition(setConstraints,constraintPiece->m_a3); //a4 this->a4.SetConstraintOnPosition(setConstraints,constraintPiece->m_a4); diff --git a/Source/functions/solve/structure.cpp b/Source/functions/solve/structure.cpp index 10471c9..5b3f95e 100755 --- a/Source/functions/solve/structure.cpp +++ b/Source/functions/solve/structure.cpp @@ -72,8 +72,7 @@ coor calculateNextCoor(vector& log, Puzzle& puzzleMat) void solve(vector& log,Puzzle& puzzleMat) { log.back().abstractionLevel = puzzleMat.dp.getNextAbstractionLayer(log.back().myCoor,log.back().abstractionLevel); //sets in abstractionLevel - cout << "abs: " << log.back().abstractionLevel; - //status(log,p_Box,puzzleMat); + //status(log,p_Box,puzzleMat); //TODO!! Add more layers here switch(log.back().abstractionLevel) { @@ -81,14 +80,14 @@ void solve(vector& log,Puzzle& puzzleMat) puzzleMat.a1.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); //puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector); break; - case 1://poempelposition + case 1://SURFFeature // return; puzzleMat.a4.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); break; - case 4://SURFFeature + case 2://poempelposition + puzzleMat.a3.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); break; case -1://random - cout << endl; setsolution(log,puzzleMat); return; default: @@ -117,12 +116,11 @@ void setsolution(vector& log, Puzzle& puzzleMat) puzzleMat.setConstraints(log.back().myCoor,log.back().PieceCollector.begin()->second); cout << "set:" << log.back().myCoor.col << "," << log.back().myCoor.row << endl; //cout << "ID: " << log.back().PieceCollector[0].second->GetPartID() << endl; - cout << "Size of Log: " << log.back().PieceCollector.size() << endl; - //if(log.back().myCoor.col==32 && log.back().myCoor.row==16) - //{ -// puzzleMat.resultImage(log); -// waitKey(0); -// } + if(log.back().myCoor.col==32 && log.back().myCoor.row==16) + { + puzzleMat.resultImage(log); + waitKey(0); + } } bool backtrack(vector& log, Puzzle& puzzleMat) @@ -133,7 +131,6 @@ bool backtrack(vector& log, Puzzle& puzzleMat) cout << "Puzzle not solveable!" << endl; return false; } - cout << "Size of Log: " << log.back().PieceCollector.size() << endl; puzzleMat.combinedQualityVector.clear(); //remove all data from temp quality save //if more pieces possible, tset piece as not logged if((log.back().PieceCollector.size())>1) @@ -144,20 +141,18 @@ bool backtrack(vector& log, Puzzle& puzzleMat) //remove similar in log - Part myPart = *log.back().PieceCollector[0].second;//tmpsaves bad part + //Part myPart = *log.back().PieceCollector[0].second;//tmpsaves bad part log.back().PieceCollector.erase(log.back().PieceCollector.begin());//removes bad part from log - puzzleMat.removeSimilar(log.back().PieceCollector,myPart); //removes all pieces from log that are similar to bad part + //puzzleMat.removeSimilar(log.back().PieceCollector,myPart); //removes all pieces from log that are similar to bad part //TODO reprogram similar removal to allow multilayer tracking if(log.back().PieceCollector.size()) // this checks if 'removeSimilar' has cleared entire LogElement { - cout << "next Piece" << endl; if(log.back().PieceCollector.size()==1) log.back().decreaseRandomed(); setsolution(log,puzzleMat); return true; } } - cout << "more backtrack" << endl; //else remove log element and backtrack once more puzzleMat.removeConstrains(log.back().myCoor); //this should remove constraints from all layers if((log.back().PieceCollector.size())) //unset all @@ -229,7 +224,8 @@ float capLogElements(vector& log) newid = id; } } - cut(log,newid); +// if(log.back().abstractionLevel==0) + cut(log,newid); vectorsizeAfter = log.back().PieceCollector.size(); destroyed = ((double)vectorsizeBefore - (double)vectorsizeAfter) / (double)vectorsizeBefore; @@ -243,10 +239,7 @@ float capLogElements(vector& log) void cut(vector& log, int& cutID) { while(cutID