MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / predict_only_rec

Method predict_only_rec

source/MaaFramework/Vision/OCRer.cpp:225–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225OCRer::Result OCRer::predict_only_rec(const cv::Mat& image_roi) const
226{
227 if (!recer_) {
228 LogError << "recer_ is null";
229 return { };
230 }
231
232 std::string reco_text;
233 float reco_score = 0;
234 bool ret = false;
235 {
236 std::unique_lock lock(s_predict_mutex_);
237 ret = recer_->Predict(image_roi, &reco_text, &reco_score);
238 }
239 if (!ret) {
240 LogWarn << "recer_ return false" << VAR(recer_) << VAR(image_) << VAR(image_roi);
241 return { };
242 }
243
244 auto text = to_u16(reco_text);
245 Result result { .text = std::move(text), .box = { 0, 0, image_roi.cols, image_roi.rows }, .score = reco_score };
246
247 return result;
248}
249
250OCRer::ResultsVec OCRer::predict_batch_rec(const std::vector<cv::Rect>& rois) const
251{

Callers

nothing calls this directly

Calls 1

moveFunction · 0.85

Tested by

no test coverage detected