0

I'm attempting to narrow a screenshot of an app to a specific section of the UI for later processing by Tesseract; in particular, the X Battle ratings located in the lower half of the image.

The test image to process, see the X Battle data in the lower half of the image, above where it says "Top Weapon Wielders".

I did a little bit of research, and saw that color segmentation might be the most practical choice for me. However, the following code, when run, produces a completely black mask:

    // step 1: read the image into a cv::Mat
    cv::Mat source_image = cv::imread("test_data/xrec/ocr_splatnet3/Screenshot_20251021_074323_Nintendo_Switch_App.jpg");

    // step 2: convert to hsv
    cv::Mat hsv;
    cv::cvtColor(source_image, hsv, cv::COLOR_BGR2HSV);
    
    // step 3, make a color mask
    cv::Mat mask;
    cv::Scalar lower_bound(220, 24, 8);
    cv::Scalar upper_bound(224, 34, 18);
    cv::inRange(hsv, lower_bound, upper_bound, mask);
    
    cv::imshow("mask", mask);
    cv::waitKey();
    cv::destroyAllWindows();

    // Tesseract code follows...

Is the range of the upper & lower bound too tight? Or am I just missing some step completely?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.