Skip to content

Commit 27961cd

Browse files
committed
text: fix wrong channel swap in TestDetectorCNN
1 parent 7031316 commit 27961cd

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

modules/text/samples/text_recognition_cnn.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,3 @@ int main(int argc, const char * argv[])
106106
waitKey();
107107
return 0;
108108
}
109-

modules/text/src/text_detectorCNN.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,20 @@ class TextDetectorCNNImpl : public TextDetectorCNN
7474
void detect(InputArray inputImage_, std::vector<Rect>& Bbox, std::vector<float>& confidence)
7575
{
7676
CV_Assert(inputImage_.channels() == inputChannelCount_);
77-
Size inputSize = inputImage_.getMat().size();
77+
Mat inputImage = inputImage_.getMat();
7878
Bbox.resize(0);
7979
confidence.resize(0);
8080

8181
for(size_t i = 0; i < sizes_.size(); i++)
8282
{
8383
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");
8785
Mat outputNet = net_.forward();
8886
int nbrTextBoxes = outputNet.size[2];
8987
int nCol = outputNet.size[3];
9088
int outputChannelCount = outputNet.size[1];
9189
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());
9391
}
9492
}
9593
};

0 commit comments

Comments
 (0)