@@ -74,22 +74,20 @@ class TextDetectorCNNImpl : public TextDetectorCNN
74
74
void detect (InputArray inputImage_, std::vector<Rect>& Bbox, std::vector<float >& confidence)
75
75
{
76
76
CV_Assert (inputImage_.channels () == inputChannelCount_);
77
- Size inputSize = inputImage_.getMat (). size ();
77
+ Mat inputImage = inputImage_.getMat ();
78
78
Bbox.resize (0 );
79
79
confidence.resize (0 );
80
80
81
81
for (size_t i = 0 ; i < sizes_.size (); i++)
82
82
{
83
83
Size inputGeometry = sizes_[i];
84
- Mat inputImage = inputImage_.getMat ().clone ();
85
- resize (inputImage, inputImage, inputGeometry);
86
- net_.setInput (blobFromImage (inputImage, 1 , inputGeometry, Scalar (123 , 117 , 104 )), " data" );
84
+ net_.setInput (blobFromImage (inputImage, 1 , inputGeometry, Scalar (123 , 117 , 104 ), false , false ), " data" );
87
85
Mat outputNet = net_.forward ();
88
86
int nbrTextBoxes = outputNet.size [2 ];
89
87
int nCol = outputNet.size [3 ];
90
88
int outputChannelCount = outputNet.size [1 ];
91
89
CV_Assert (outputChannelCount == 1 );
92
- getOutputs ((float *)(outputNet.data ), nbrTextBoxes, nCol, Bbox, confidence, inputSize );
90
+ getOutputs ((float *)(outputNet.data ), nbrTextBoxes, nCol, Bbox, confidence, inputImage. size () );
93
91
}
94
92
}
95
93
};
0 commit comments