Merge pull request #3790 from masterAllen:fix_OCRBeamSearchDecoder

Fix OCRBeamSearchDecoder bug: a risk of assigning value to NULL.
pull/3795/head^2
Alexander Smorkalov 6 months ago committed by GitHub
commit 80f1ca2442
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      modules/text/src/ocr_beamsearch_decoder.cpp

@ -338,9 +338,12 @@ public:
double lp = score_segmentation( beam[0].segmentation, out_sequence );
// fill other (dummy) output parameters
component_rects->push_back(Rect(0,0,src.cols,src.rows));
component_texts->push_back(out_sequence);
component_confidences->push_back((float)exp(lp));
if (component_rects != NULL)
component_rects->push_back(Rect(0,0,src.cols,src.rows));
if (component_texts != NULL)
component_texts->push_back(out_sequence);
if (component_confidences != NULL)
component_confidences->push_back((float)exp(lp));
return;
}

Loading…
Cancel
Save