[DEV] update recorder
This commit is contained in:
parent
62e176efd6
commit
11d1ee76d8
@ -47,12 +47,23 @@ std::vector<vec2> dollar::rotateToZero(const std::vector<vec2>& _points) {
|
||||
return rotateBy(_points, -rotation);
|
||||
}
|
||||
|
||||
float maxKeepAspectRatio = 5.5f;
|
||||
|
||||
// TODO : Rework this to have a correct scale with keeping aspect ration ... or not ...
|
||||
std::vector<vec2> dollar::scaleToOne(const std::vector<vec2>& _points, bool _keepAspectRation) {
|
||||
dollar::Rectangle box(_points);
|
||||
std::vector<vec2> out;
|
||||
vec2 scale(1.0f/box.getSize().x(), 1.0f/box.getSize().y());
|
||||
vec2 offset(0,0);
|
||||
/*
|
||||
float aspectRatio = box.getSize().x() / box.getSize().y();
|
||||
if (aspectRatio < 1.0f) {
|
||||
aspectRatio = 1.0f / aspectRatio;
|
||||
}
|
||||
if (aspectRatio > maxKeepAspectRatio) {
|
||||
_keepAspectRation = true;
|
||||
}
|
||||
*/
|
||||
if (_keepAspectRation == true) {
|
||||
float val = 1;
|
||||
offset = box.getSize() * val;
|
||||
@ -79,6 +90,15 @@ std::vector<std::vector<vec2>> dollar::scaleToOne(const std::vector<std::vector<
|
||||
std::vector<std::vector<vec2>> out;
|
||||
vec2 scale(1.0f/box.getSize().x(), 1.0f/box.getSize().y());
|
||||
vec2 offset(0,0);
|
||||
/*
|
||||
float aspectRatio = box.getSize().x() / box.getSize().y();
|
||||
if (aspectRatio < 1.0f) {
|
||||
aspectRatio = 1.0f / aspectRatio;
|
||||
}
|
||||
if (aspectRatio > maxKeepAspectRatio) {
|
||||
_keepAspectRation = true;
|
||||
}
|
||||
*/
|
||||
if (_keepAspectRation == true) {
|
||||
float val = 1;
|
||||
offset = box.getSize() * val;
|
||||
|
@ -165,6 +165,11 @@ bool testCorpus(const std::string& _srcCorpus) {
|
||||
if (etk::end_with(it, ".json") == true) {
|
||||
std::vector<std::string> path = etk::split(it, '/');
|
||||
std::string elemName = etk::split(path[path.size()-1],'_')[0];
|
||||
if (elemName == "slash") {
|
||||
elemName = "/";
|
||||
}if (elemName == "back-slash") {
|
||||
elemName = "\\";
|
||||
}
|
||||
if (std::find(listOfElementInCorpus.begin(), listOfElementInCorpus.end(), elemName) == listOfElementInCorpus.end()) {
|
||||
listOfElementInCorpus.push_back(elemName);
|
||||
}
|
||||
@ -183,11 +188,17 @@ bool testCorpus(const std::string& _srcCorpus) {
|
||||
TEST_PRINT("-- Generate FOR: '" << itTypeOfCorpus << "'");
|
||||
TEST_PRINT("---------------------------------------------------------------------------");
|
||||
std::vector<std::string> fileFiltered;
|
||||
std::string fileNameIt = itTypeOfCorpus;
|
||||
if (fileNameIt == "/") {
|
||||
fileNameIt = "slash";
|
||||
} else if (fileNameIt == "\\") {
|
||||
fileNameIt = "back-slash";
|
||||
}
|
||||
for (auto &it : files) {
|
||||
if (etk::end_with(it, ".json") == true) {
|
||||
std::vector<std::string> path = etk::split(it, '/');
|
||||
std::string filename = path[path.size()-1];
|
||||
if (etk::start_with(filename, itTypeOfCorpus + "_") == true) {
|
||||
if (etk::start_with(filename, fileNameIt + "_") == true) {
|
||||
fileFiltered.push_back(it);
|
||||
}
|
||||
}
|
||||
|
@ -85,6 +85,8 @@ void appl::widget::TextAreaRecognition::store(const std::string& _userName, cons
|
||||
fileName = "HOME:DOLLAR/corpus/";
|
||||
if (_value == "/") {
|
||||
fileName += "slash";
|
||||
} else if (_value == "\\") {
|
||||
fileName += "back-slash";
|
||||
} else {
|
||||
fileName += _value;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user