How to calculate what percentage of the area of an object appears in the render view? Take the pictures below as an example, I want to calculate how much of the jersey number on the tshirt of the human model is visible on the render view. In the first case the jersey number is totally visible, but in the second just about 50% is visible. How to calculate it with python?


CONTEXT: I am working in a jersey number recognition task. My project is to generate artificial data with blender to train the network. So I will take a human model as below and generate thousands of randomized screenshots with different tshirts, different poses, different camera angles, etc. Since I will generate new poses randomly it could be that in some of them the arm is blocking part of the jersey number. I want to somehow be able to detect it in order to discard these screenshots.
In case anyone have a similar problem, I 'kinda' solved the problem using ray-cast. I basically created a for loop that generates ray-casts coming from the camera with destination to the 4 vertices that frame the jersey number. I have to perform this calculation for every object that I think might be between the camera and the body. With this approach I don't really calculate the area but it turns out that it is sufficient for my goal to know that at least one of the ray-casts intercept an object.