void Characterization::execute() { Mat img; // load image try { VerboseOutput::println(string("Characterization"), "loading image: " + string(const_cast<char*>(filename->c_str()))); img = imread(const_cast<char*>(filename->c_str()), CV_LOAD_IMAGE_COLOR); VerboseOutput::println(string("Characterization"), "image loaded" ); } catch (Exception& e) { throw runtime_error("Error while reading image"); } // check image if ((img.rows == 0) || (img.cols == 0)) { throw runtime_error("Corrupt Image"); } // execute feature extraction try { list<Feature*>::iterator i; VerboseOutput::println(string("Characterization"), "extract features" ); // iterate through all tasks for(i=tasks.begin(); i != tasks.end(); ++i) { Feature* task = *i; if(canExecute(task)) { VerboseOutput::println(string("Characterization"), "execute task: " + task->getName()); task->execute(img); VerboseOutput::println(string("Characterization"), "persist data from task: " + task->getName()); task->persist(featureFileOutputDirectory); } } VerboseOutput::println(string("Characterization"), "feature extraction finished"); } catch (Exception& ex) { stringstream msg; msg << "Error while executing feature extraction: " << ex.msg; throw runtime_error(msg.str()); } }
Feature* FeatureTreeWidget::getCorrespondingFeature(QString featureName){ for(int i=0; i<featureList->size(); i++){ Feature *currentFeature = &(featureList->at(i)); if(currentFeature->getName() == featureName){ return currentFeature; } } //cout << "Feature mit dem Namen " + featureName +" existiert nicht." <<endl; return NULL; }