diff --git a/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.h b/Source/functions/AbstractionLayers/DestructionPower/DestructionPower.h index 288af80..8d8eb9f 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 3 +#define DESTRUCTION_COUNT 1 #include "DestructionPower_Properties.h" #include "../AbstraktionLayer_Base.h" diff --git a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp index c62fc8f..b5e335b 100644 --- a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp +++ b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.cpp @@ -271,7 +271,7 @@ Mat analyseParts::readImages(int count) return src; } - if(DISPLAY)imshow("src",src); + //if(DISPLAY)imshow("src",src); Mat im_gray, im_bw; cvtColor(src, im_gray, CV_RGB2GRAY); diff --git a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h index 368cb63..01580d3 100644 --- a/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h +++ b/Source/functions/AbstractionLayers/Layer1/AbstractionLayer_1.h @@ -1,7 +1,3 @@ -// -// Created by mpapa on 05.12.2017. -// - #ifndef SOURCE_ABSTRACTIONLAYER_1_H #define SOURCE_ABSTRACTIONLAYER_1_H diff --git a/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h b/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h index 1a1eae8..de92bfc 100644 --- a/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h +++ b/Source/functions/AbstractionLayers/Layer_SURFFeatures/AbstractionLayer_SURFFeatures.h @@ -2,6 +2,8 @@ #define SOURCE_ABSTRACTIONLAYER_SURFFEATURES_H #include "../AbstraktionLayer_Base.h" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc.hpp" #ifdef _WIN32 #define PATH_FULL_PUZZLE "..\\..\\..\\puzzle_img\\puzzle1.jpg" diff --git a/Source/functions/solve/puzzleExtension.cpp b/Source/functions/solve/puzzleExtension.cpp index c5abf29..a358580 100644 --- a/Source/functions/solve/puzzleExtension.cpp +++ b/Source/functions/solve/puzzleExtension.cpp @@ -65,23 +65,23 @@ void Puzzle::shuffle() //deletes all constraints from all abstractionlayers void Puzzle::removeConstrains(coor removeCoordinates) { - this->a1.RemoveConstraintOnPosition(removeCoordinates); - this->a3.RemoveConstraintOnPosition(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) { //dp - this->dp.m_constraintMatrix[setConstraints.col][setConstraints.row].DestructionArray.clear(); - for(auto it:this->tmp_destructionArray) - this->dp.m_constraintMatrix[setConstraints.col][setConstraints.row].DestructionArray.emplace_back(it); +// this->dp.m_constraintMatrix[setConstraints.col][setConstraints.row].DestructionArray.clear(); +// for(auto it:this->tmp_destructionArray) +// this->dp.m_constraintMatrix[setConstraints.col][setConstraints.row].DestructionArray.emplace_back(it); //a1 - this->a1.SetConstraintOnPosition(setConstraints,constraintPiece->m_a1); + //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); @@ -187,7 +187,6 @@ Mat Puzzle::resultImage( vector& log){ sprintf(name, PATH, imageNumber); Mat img = imread(name, 1); - copyMakeBorder(img,img,200,200,200,200,BORDER_CONSTANT,Scalar(255,255,255)); Mat invert = Mat::ones(img.size(), CV_8UC3); // invert for rotation to work correctly bitwise_not ( img, invert ); diff --git a/Source/functions/solve/structure.cpp b/Source/functions/solve/structure.cpp index 1d999e1..2e7433c 100755 --- a/Source/functions/solve/structure.cpp +++ b/Source/functions/solve/structure.cpp @@ -43,7 +43,7 @@ void createNextLogElement(vector& log, Puzzle& puzzleMat) { log.emplace_back(LogEntry(coor(0, 0))); log.back().myCoor = calculateNextCoor(log, puzzleMat); - puzzleMat.dp.DestructionOfSurrounding(log.back().myCoor);//calculate dp from surrounding +// puzzleMat.dp.DestructionOfSurrounding(log.back().myCoor);//calculate dp from surrounding //get all not set pieces for(auto it:puzzleMat.p_myBox) if(!it->set) @@ -78,13 +78,15 @@ void solve(vector& log,Puzzle& puzzleMat) switch(log.back().abstractionLevel) { case 0://pömpel - puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector); + puzzleMat.a4.EvaluateQuality(log.back().myCoor,log.back().PieceCollector); + //puzzleMat.a1.EvaluateQuality(log.back().myCoor, log.back().PieceCollector); break; case 1://poempelposition + return; 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; @@ -95,10 +97,8 @@ void solve(vector& log,Puzzle& puzzleMat) } float worth = capLogElements(log); cout << " | " << worth << endl; - if(worth && log.back().abstractionLevel) - cerr << "removed something!" << endl; - calculateTrueDestructionPower(log,puzzleMat, worth); +// calculateTrueDestructionPower(log,puzzleMat, worth); CalculateNewCombinedQuality(log, log.back().PieceCollector, puzzleMat.combinedQualityVector); } @@ -227,7 +227,7 @@ float capLogElements(vector& log) newid = id; } } - cut(log,newid); + //cut(log,newid); vectorsizeAfter = log.back().PieceCollector.size(); destroyed = ((double)vectorsizeBefore - (double)vectorsizeAfter) / (double)vectorsizeBefore; @@ -241,7 +241,11 @@ float capLogElements(vector& log) void cut(vector& log, int& cutID) { while(cutID