I think I remember also doing it like this with the default prman metadata.

        H_aperture=node.metadata('exr/screenWindowWidth', frame_numb)
            V_aperture=H_aperture/Aspect

On Thu, Apr 28, 2011 at 1:29 PM, Ivan Busquets <[email protected]>wrote:

> The projection matrix from prman only stores a FOV, or the relationship
> between focal-length and horizontal aperture.
> If you want the "real" focal length values, you will need to know the size
> of your filmback.
>
> If you don't care about the "real" focal length value, you can still get
> the right projection values by setting the focal length to 1, and getting
> the filmback size like this (proj_matrix is a Matrix4 object filled from the
> exr/worldToNDC metadata key):
>
>         lx =  (-1 - proj_matrix[12] - proj_matrix[8]) / proj_matrix[0]
>         by = (-1 - proj_matrix[13] - proj_matrix[9]) / proj_matrix[5]
>         rx =  (1 - proj_matrix[12] - proj_matrix[8]) / proj_matrix[0]
>         ty = (1 - proj_matrix[13] - proj_matrix[9]) / proj_matrix[5]
>
>         swW = max( lx , rx ) - min( lx , rx )  # Screen Window Width
>         swH = max( by , ty ) - min( by , ty )  # Screen Window Height
>
> If you have access to the real filmback size (either from custom metadata
> or because you can assume you'll always be dealing with cameras that have
> the same filmback size), you could then get a "real" focal length value from
> filmBack.width / swW.
>
> Hope that helps.
>
> Cheers,
> Ivan
>
>
> 2011/4/28 Lucien Fostier <[email protected]>
>
>> Hi fellow tds
>>
>> I m trying to create a camera from exr metadata coming from prman.
>>
>> So i use the projection matrix world to camera which give me position and
>> orientation in space.
>>
>> Id like to extract the focal lenght from this data but i cant find how to
>> do it.
>>
>> May someone help me about this or give me some pointer?
>>
>> Thanks
>>
>> Lucien
>>
>> Envoyé de mon iPhone_______________________________________________
>> Nuke-python mailing list
>> [email protected]
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>
>
> _______________________________________________
> Nuke-python mailing list
> [email protected]
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
_______________________________________________
Nuke-python mailing list
[email protected]
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to