perf: 优化截图判空

This commit is contained in:
MistEO
2023-04-11 23:42:35 +08:00
parent 78fa9933a8
commit dc2de435d6

View File

@@ -364,9 +364,8 @@ bool asst::AdbController::screencap(cv::Mat& image_payload, bool allow_reconnect
if (temp.empty()) {
return false;
}
std::vector<cv::Mat> channels;
cv::split(temp, channels);
if (cv::countNonZero(channels[3] != 255) != 0) {
const auto& br = *(temp.end<cv::Vec4b>() - 1);
if (br[3] != 255) { // only check alpha
return false;
}
cv::cvtColor(temp, temp, cv::COLOR_RGBA2BGR);