Ignoring Background in Binarization

a simple threshold() call can’t do this. I suspect you’re applying more than a threshold() to the picture.

MRE please.

also: one of the pictures is a cropped screenshot. don’t do that. save the image itself, not a screenshot.