Skip to content

Commit

Permalink
add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Moschkin committed Feb 7, 2024
1 parent 9f873e3 commit 70d801d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/beholdhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,14 @@ SearchResults BeholdHelper::AnalyzeBehold(cv::Mat query, size_t fileSize)
// Some images are encoded with 2 bytes per channel, scale down for template matching to work
if (query.depth() == CV_16U) {
// convert to 1-byte
std::cout << "Scale down image to 1-byte per channel." << std::endl;

query.convertTo(query, CV_8U, 0.00390625);
}

// If the image has an alpha channel, remove it
if (query.type() == CV_8UC4) {
std::cout << "Remove alpha channel." << std::endl;
cv::Mat dst;
cv::cvtColor(query, dst, cv::COLOR_BGRA2BGR);
query = dst;
Expand All @@ -364,6 +367,7 @@ SearchResults BeholdHelper::AnalyzeBehold(cv::Mat query, size_t fileSize)
results.input_height = query.rows;
results.input_width = query.cols;

std::cout << "Image size is" << query.cols << "x" << query.rows << std::endl;
cv::Mat top = SubMat(query, 0, std::min(query.rows / 13, 80), query.cols / 3, query.cols * 2 / 3);
if (top.empty()) {
results.error = "Top row was empty";
Expand Down

0 comments on commit 70d801d

Please sign in to comment.