2
$\begingroup$

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?

Area = 100%

Area about 50%

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.

$\endgroup$
2
  • 1
    $\begingroup$ Hey! Welcome to BSE! could you explain exactly how you want the visibility ratio to be calculated? Perhaps by a pixel count or a 2D bounding box? $\endgroup$
    – HISEROD
    Mar 28, 2021 at 18:46
  • $\begingroup$ Thanks! Yes, it could be something like that.. Honestly, I don't have a good idea of how to achieve this. It thought about assigning the group of vertices in the Tshirt to some vertex-group. Then I could somehow calculated the ratio of pixel of the vertex-group divided by the total pixels. But how to get the pixels from the vertex-group appearing in the render? I dont know... $\endgroup$
    – Manveru
    Mar 28, 2021 at 19:11

1 Answer 1

-1
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .