@@ -41,10 +41,10 @@ std::string keys =
41
41
" 4: CANN + NPU}" ;
42
42
43
43
44
- class DB {
44
+ class PPOCRv3DB {
45
45
public:
46
46
47
- DB (string modPath, Size inSize = Size(736 , 736 ), float binThresh = 0.3 ,
47
+ PPOCRv3DB (string modPath, Size inSize = Size(736 , 736 ), float binThresh = 0.3 ,
48
48
float polyThresh = 0.5 , int maxCand = 200 , double unRatio = 2.0 ,
49
49
dnn::Backend bId = DNN_BACKEND_DEFAULT, dnn::Target tId = DNN_TARGET_CPU) : modelPath(modPath), inputSize(inSize), binaryThreshold(binThresh),
50
50
polygonThreshold (polyThresh), maxCandidates(maxCand), unclipRatio(unRatio),
@@ -215,7 +215,7 @@ int main(int argc, char** argv)
215
215
bool save = parser.get <bool >(" save" );
216
216
bool viz = parser.get <float >(" viz" );
217
217
218
- DB detector (" ../text_detection_db/text_detection_DB_IC15_resnet18_2021sep .onnx" , inpSize, binThresh, polyThresh, maxCand, unRatio, backendTargetPairs[backendTargetid].first , backendTargetPairs[backendTargetid].second );
218
+ PPOCRv3DB detector (" ../text_detection_db/text_detection_en_ppocrv3_2023may .onnx" , inpSize, binThresh, polyThresh, maxCand, unRatio, backendTargetPairs[backendTargetid].first , backendTargetPairs[backendTargetid].second );
219
219
CRNN recognizer (modelPath, backendTargetPairs[backendTargetid].first , backendTargetPairs[backendTargetid].second );
220
220
// ! [Open a video file or an image file or a camera stream]
221
221
VideoCapture cap;
@@ -232,9 +232,13 @@ int main(int argc, char** argv)
232
232
cap >> originalImage;
233
233
if (originalImage.empty ())
234
234
{
235
- cout << " Frame is empty" << endl;
236
- waitKey ();
237
- break ;
235
+ if (parser.has (" input" ))
236
+ {
237
+ cout << " Frame is empty" << endl;
238
+ break ;
239
+ }
240
+ else
241
+ continue ;
238
242
}
239
243
int originalW = originalImage.cols ;
240
244
int originalH = originalImage.rows ;
0 commit comments