How to extract the largest square in contour?

Hello, I’m an opencv student. I’m asking you a question because I’m stuck while preparing for the contest.

In the picture below, only the beef part was extracted using the contour.
I want to find the largest square in the beef part and extract it, but the outer part of the beef outline is extracted together.
Is there a good way?


largest square? distance transform with Linf or L1 norm, can’t remember which.

in general, you have a geometry problem and it’s not trivial: Human verification - Stack Overflow