简体   繁体   中英

Set minimum confidence to ocr in Matlab

My Matlab program for extracting text using ocr function gives many false positives which having lower confidence. Is there any way to set ocrtxt.WordConfidence to a minimum value and ignore all lower values? I want ocrtxt.Words or ocrtxt.Text only above confidence 0.8 for further process.

ocrtxt = ocr(regionFilteredTextMask);
ocrtxt.Text;

The easiest way would be to create a logical index based on your threshold value:

bestWordsIdx = ocrtxt.WordConfidence > 0.8;
bestWords = ocrtxt.Words(bestWordsIdx)

And same for Text:

bestTextIdx = ocrtxt.CharacterConfidence > 0.8
bestText = ocrtxt.Text(bestTextIdx)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM