MCPcopy Create free account
hub / github.com/WallBreaker2/op / FindStr

Method FindStr

libop/image/ImageSearchAlgorithms.cpp:996–1021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

994}
995
996long ImageSearchAlgorithms::FindStr(std::map<point_t, ocr_rec_t> &ps, const vector<wstring> &vstr, long &retx,
997 long &rety) {
998 retx = rety = -1;
999
1000 std::vector<ocr_text_span_t> spans;
1001 const std::wstring str = build_ocr_text_spans(ps, spans);
1002
1003 for (size_t i = 0; i < vstr.size(); ++i) {
1004 if (vstr[i].empty())
1005 continue;
1006
1007 const size_t idx = str.find(vstr[i]);
1008 if (idx == std::wstring::npos)
1009 continue;
1010
1011 const ocr_text_span_t *span = find_ocr_text_span(spans, idx);
1012 if (span == nullptr)
1013 continue;
1014
1015 retx = span->point.x + _x1 + _dx;
1016 rety = span->point.y + _y1 + _dy;
1017 return static_cast<long>(i);
1018 }
1019
1020 return -1;
1021}
1022
1023long ImageSearchAlgorithms::FindStrEx(std::map<point_t, ocr_rec_t> &ps, const vector<wstring> &vstr,
1024 std::wstring &retstr) {

Callers

nothing calls this directly

Calls 5

build_ocr_text_spansFunction · 0.85
find_ocr_text_spanFunction · 0.85
findMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected