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

Method postproc_screenshot

source/MaaFramework/Controller/ControllerAgent.cpp:1061–1084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1059}
1060
1061bool ControllerAgent::postproc_screenshot(const cv::Mat& raw)
1062{
1063 if (raw.empty()) {
1064 image_ = cv::Mat();
1065 LogError << "Empty screenshot";
1066 return false;
1067 }
1068
1069 if (raw.cols != image_raw_width_ || raw.rows != image_raw_height_ || image_target_width_ == 0 || image_target_height_ == 0) {
1070 LogInfo << "Resolution changed" << VAR(raw.cols) << VAR(raw.rows) << VAR(image_raw_width_) << VAR(image_raw_height_);
1071
1072 image_raw_width_ = raw.cols;
1073 image_raw_height_ = raw.rows;
1074
1075 if (!calc_target_image_size()) {
1076 image_ = cv::Mat();
1077 LogError << "Invalid target image size";
1078 return false;
1079 }
1080 }
1081
1082 cv::resize(raw, image_, { image_target_width_, image_target_height_ }, 0, 0, image_resize_method_);
1083 return !image_.empty();
1084}
1085
1086bool ControllerAgent::calc_target_image_size()
1087{

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected