Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
73ddeab6
Commit
73ddeab6
authored
Jul 19, 2017
by
sghoshcvc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simple cleaning and added comments
parent
1bc908bd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
141 deletions
+6
-141
erfilter.hpp
modules/text/include/opencv2/text/erfilter.hpp
+1
-0
ocr_holistic.cpp
modules/text/src/ocr_holistic.cpp
+0
-59
text_detector.cpp
modules/text/src/text_detector.cpp
+3
-4
text_detectorCNN.cpp
modules/text/src/text_detectorCNN.cpp
+2
-78
No files found.
modules/text/include/opencv2/text/erfilter.hpp
View file @
73ddeab6
...
...
@@ -65,6 +65,7 @@ component tree of the image. :
*/
struct
CV_EXPORTS
ERStat
{
public
:
//! Constructor
explicit
ERStat
(
int
level
=
256
,
int
pixel
=
0
,
int
x
=
0
,
int
y
=
0
);
...
...
modules/text/src/ocr_holistic.cpp
View file @
73ddeab6
...
...
@@ -459,56 +459,6 @@ protected:
#endif
}
// void process_(Mat inputImage, Mat &outputMat)
// {
// // do forward pass and stores the output in outputMat
// //Process one image
// CV_Assert(this->minibatchSz_==1);
// //CV_Assert(outputMat.isContinuous());
//#ifdef HAVE_CAFFE
// net_->input_blobs()[0]->Reshape(1, this->channelCount_,this->inputGeometry_.height,this->inputGeometry_.width);
// net_->Reshape();
// float* inputBuffer=net_->input_blobs()[0]->mutable_cpu_data();
// float* inputData=inputBuffer;
// std::vector<Mat> input_channels;
// Mat preprocessed;
// // if the image have multiple color channels the input layer should be populated accordingly
// for (int channel=0;channel < this->channelCount_;channel++){
// cv::Mat netInputWraped(this->inputGeometry_.height, this->inputGeometry_.width, CV_32FC1, inputData);
// input_channels.push_back(netInputWraped);
// //input_data += width * height;
// inputData+=(this->inputGeometry_.height*this->inputGeometry_.width);
// }
// this->preprocess(inputImage,preprocessed);
// split(preprocessed, input_channels);
// //preprocessed.copyTo(netInputWraped);
// this->net_->Forward();
// const float* outputNetData=net_->output_blobs()[0]->cpu_data();
// // const float* outputNetData1=net_->output_blobs()[1]->cpu_data();
// this->outputGeometry_ = Size(net_->output_blobs()[0]->width(),net_->output_blobs()[0]->height());
// int outputSz = this->outputSize_ * this->outputGeometry_.height * this->outputGeometry_.width;
// outputMat.create(this->outputGeometry_.height , this->outputGeometry_.width,CV_32FC1);
// float*outputMatData=(float*)(outputMat.data);
// memcpy(outputMatData,outputNetData,sizeof(float)*outputSz);
//#endif
// }
#ifdef HAVE_CAFFE
Ptr
<
caffe
::
Net
<
float
>
>
net_
;
#endif
...
...
@@ -587,15 +537,6 @@ public:
inputImageList
.
push_back
(
image
.
getMat
());
classifyBatch
(
inputImageList
,
classProbabilities
);
}
// void detect(InputArray image, OutputArray Bbox_prob)
// {
// Bbox_prob.create(this->outputGeometry_,CV_32F); // dummy initialization is it needed
// Mat outputMat = Bbox_prob.getMat();
// process_(image.getMat(),outputMat);
// //copy back to outputArray
// outputMat.copyTo(Bbox_prob);
// }
void
classifyBatch
(
InputArrayOfArrays
inputImageList
,
OutputArray
classProbabilities
)
{
...
...
modules/text/src/text_detector.cpp
View file @
73ddeab6
...
...
@@ -74,7 +74,7 @@ public:
void
textDetectInImage
(
InputArray
inputImage
,
CV_OUT
std
::
vector
<
Rect
>&
Bbox
,
CV_OUT
std
::
vector
<
float
>&
confidence
)
{
Mat
netOutput
;
// call the detect function of deepCNN class
// call the detect function of deep
Text
CNN class
this
->
classifier_
->
detect
(
inputImage
,
netOutput
);
// get the output geometry i.e height and width of output blob from caffe
Size
OutputGeometry_
=
this
->
classifier_
->
getOutputGeometry
();
...
...
@@ -102,12 +102,11 @@ public:
int
component_level
=
0
)
{
CV_Assert
(
component_level
==
OCR_LEVEL_WORD
);
//Componnents not applicable for word spotting
//double confidence;
//String transcription;
std
::
vector
<
Rect
>
bbox
;
std
::
vector
<
float
>
score
;
textDetectInImage
(
image
,
bbox
,
score
);
//output_text=transcription.c_str();
if
(
component_rects
!=
NULL
)
{
component_rects
->
resize
(
bbox
.
size
());
// should be a user behavior
...
...
modules/text/src/text_detectorCNN.cpp
View file @
73ddeab6
...
...
@@ -26,27 +26,6 @@ inline bool fileExists (String filename) {
return
f
.
good
();
}
//************************************************************************************
//****************** TextImageClassifier *****************************************
//************************************************************************************
//void TextImageClassifier::preprocess(const Mat& input,Mat& output)
//{
// this->preprocessor_->preprocess_(input,output,this->inputGeometry_,this->channelCount_);
//}
//void TextImageClassifier::setPreprocessor(Ptr<ImagePreprocessor> ptr)
//{
// CV_Assert(!ptr.empty());
// preprocessor_=ptr;
//}
//Ptr<ImagePreprocessor> TextImageClassifier::getPreprocessor()
//{
// return preprocessor_;
//}
class
DeepCNNTextDetectorCaffeImpl
:
public
DeepCNNTextDetector
{
protected
:
...
...
@@ -54,9 +33,7 @@ protected:
void
process_
(
Mat
inputImage
,
Mat
&
outputMat
)
{
// do forward pass and stores the output in outputMat
//Process one image
// CV_Assert(this->outputGeometry_.batchSize==1);
//CV_Assert(outputMat.isContinuous());
#ifdef HAVE_CAFFE
net_
->
input_blobs
()[
0
]
->
Reshape
(
1
,
this
->
inputChannelCount_
,
this
->
inputGeometry_
.
height
,
this
->
inputGeometry_
.
width
);
...
...
@@ -191,12 +168,6 @@ public:
outputMat
.
copyTo
(
Bbox_prob
);
}
//int getOutputSize()
//{
// return this->outputSize_;
//}
Size
getOutputGeometry
()
{
return
this
->
outputGeometry_
;
...
...
@@ -290,54 +261,7 @@ void DeepCNNTextDetector::preprocess(const Mat& input,Mat& output)
this
->
preprocessor_
->
preprocess
(
input
,
output
,
inputHtWd
,
this
->
inputChannelCount_
);
}
//namespace cnn_config{
//namespace caffe_backend{
//#ifdef HAVE_CAFFE
//bool getCaffeGpuMode()
//{
// return caffe::Caffe::mode()==caffe::Caffe::GPU;
//}
//void setCaffeGpuMode(bool useGpu)
//{
// if(useGpu)
// {
// caffe::Caffe::set_mode(caffe::Caffe::GPU);
// }else
// {
// caffe::Caffe::set_mode(caffe::Caffe::CPU);
// }
//}
//bool getCaffeAvailable()
//{
// return true;
//}
//#else
//bool getCaffeGpuMode()
//{
// CV_Error(Error::StsError,"Caffe not available during compilation!");
// return 0;
//}
//void setCaffeGpuMode(bool useGpu)
//{
// CV_Error(Error::StsError,"Caffe not available during compilation!");
// CV_Assert(useGpu==1);//Compilation directives force
//}
//bool getCaffeAvailable(){
// return 0;
//}
//#endif
//}//namespace caffe
//}//namespace cnn_config
}
}
//namespace text namespace cv
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment