Commit 551d1e68 authored by Anguelos Nicolaou's avatar Anguelos Nicolaou

GSOC 2016

Implemented Classifier and Wordspotter as two independent classes
parent 44d7339f
...@@ -24,7 +24,7 @@ if(${Tesseract_FOUND}) ...@@ -24,7 +24,7 @@ if(${Tesseract_FOUND})
target_link_libraries(opencv_text ${Tesseract_LIBS}) target_link_libraries(opencv_text ${Tesseract_LIBS})
endif() endif()
#anguelos: Principal source from which adaptation came is the cnn_3dobj module #Principal source from which adaptation came is the cnn_3dobj module
find_package(Caffe) find_package(Caffe)
if(Caffe_FOUND) if(Caffe_FOUND)
......
...@@ -15,13 +15,7 @@ ...@@ -15,13 +15,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
//Lluis:DONT KNOW WHY ITS NOT VISIBLE HERE //should this be moved elsewhere?
#define CV_StsNotImplemented (-213)
#define CV_StsError (-2)
//Luis: should this be moved elsewhere?
//In precomp.hpp It doesn't work //In precomp.hpp It doesn't work
#ifdef HAVE_CAFFE #ifdef HAVE_CAFFE
#include "caffe/caffe.hpp" #include "caffe/caffe.hpp"
...@@ -30,7 +24,7 @@ ...@@ -30,7 +24,7 @@
namespace cv { namespace text { namespace cv { namespace text {
//Lluis: Maybe OpenCV has a routine better suited //Maybe OpenCV has a routine better suited
inline bool fileExists (String filename) { inline bool fileExists (String filename) {
std::ifstream f(filename.c_str()); std::ifstream f(filename.c_str());
return f.good(); return f.good();
...@@ -55,7 +49,7 @@ protected: ...@@ -55,7 +49,7 @@ protected:
input.convertTo(output, CV_32FC1); input.convertTo(output, CV_32FC1);
} }
}else{ }else{
CV_Error(CV_StsError,"Expecting images with either 1 or 3 channels"); CV_Error(Error::StsError,"Expecting images with either 1 or 3 channels");
} }
resize(output,output,this->inputGeometry_); resize(output,output,this->inputGeometry_);
Scalar dev,mean; Scalar dev,mean;
...@@ -120,7 +114,7 @@ public: ...@@ -120,7 +114,7 @@ public:
this->outputSize_=net_->output_blobs()[0]->channels(); this->outputSize_=net_->output_blobs()[0]->channels();
#else #else
CV_Error(CV_StsError,"Caffe not available during compilation!"); CV_Error(Error::StsError,"Caffe not available during compilation!");
#endif #endif
} }
...@@ -166,7 +160,7 @@ Ptr<DictNet> DictNet::create(String archFilename,String weightsFilename,int mini ...@@ -166,7 +160,7 @@ Ptr<DictNet> DictNet::create(String archFilename,String weightsFilename,int mini
break; break;
case OCR_HOLISTIC_BACKEND_NONE: case OCR_HOLISTIC_BACKEND_NONE:
default: default:
CV_Error(CV_StsError,"DictNet::create backend not implemented"); CV_Error(Error::StsError,"DictNet::create backend not implemented");
return Ptr<DictNet>(); return Ptr<DictNet>();
break; break;
} }
...@@ -208,7 +202,7 @@ public: ...@@ -208,7 +202,7 @@ public:
CV_Assert(fileExists(vocabullaryFilename));//this fails for some rason CV_Assert(fileExists(vocabullaryFilename));//this fails for some rason
std::ifstream labelsFile(vocabullaryFilename.c_str()); std::ifstream labelsFile(vocabullaryFilename.c_str());
if(!labelsFile){ if(!labelsFile){
CV_Error(CV_StsError,"Could not read Labels from file"); CV_Error(Error::StsError,"Could not read Labels from file");
} }
std::string line; std::string line;
while (std::getline(labelsFile, line)){ while (std::getline(labelsFile, line)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment