Line Length Based on Camera Angle

Say I have a box in 3d space with a size of (9, 12, 9) studs, a given camera angle, and a Field of View.

How would I find the height of the green line in studs?
In 3d space it is the same length as the red lines, but in 2d space it is slightly bigger.

Thanks for the help.

The units aren’t studs, you probably mean pixels?

What application do you need this for? That will help people give a more useful answer.