+
    åûjX  ã                   óZ   € R t ^ RIt^ RIHt ^ RIt^ RIHt ^ RIHt ^RI	H
t
Ht R R ltR# )zSGenerate random synthetic scenes to test the two-view and multi-view estimators on.N)ÚDict)Úaxis_angle_to_rotation_matrix)Útransform_points)Úprojection_from_KRtÚrandom_intrinsicsc                ór   € V ^8„  d   QhR\         R\         R\        \        \        P                  3,          /# )é   Ú	num_viewsÚ
num_pointsÚreturn)Úintr   ÚstrÚtorchÚTensor)Úformats   "ÚZC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\geometry\epipolar\scene.pyÚ__annotate__r      s4   € ÷ >añ >aœcð >a¬sð >a´t¼CÄÇÁÐ<MÕ7Nñ >aó    c                ó²  € \         P                  ! ^V^4      p\        RR4      p\         P                  ! V ^4      \        P                  ,          R,          p\         P                  ! V ^4      pWE,          \         P
                  ! V^RR7      ,          p\        V4      p\         P                  ! V 4      P                  RR4      p\         P                  ! V 4      P                  RR4      p\         P                  ! V 4      P                  RR4      p	\         P                  ! WxV	.^R7      R,          p
WbP                  RR4      ,          V
,           p\         P                  ! VR,          ^R7      ^ ,          p\         P                  ! V^ 8  Wœ,
          R,           V	4      V
R&   \        W6V
4      p\        WÒP                  V RR4      4      pR	VR
VRV
RVRVRV/# )aõ  Generate a random 3d scene seen by ``num_views`` cameras that share one camera matrix.

``scene = generate_scene(num_views, num_points)`` returns a dictionary with a random camera matrix from
:func:`random_intrinsics`, the world-to-camera rotation, translation and projection matrix of each view,
``num_points`` random 3D points in front of every view and their pixel projections, ``points2d``. Pass two of its
views to :func:`find_fundamental` or :func:`triangulate_points` to test them against the known geometry.

Convention:
    - Every point has positive depth in every view; depth and focal length are not bounded away from zero.
    - Draws from torch's global generator.

Args:
    num_views: the number of views :math:`V`.
    num_points: the number of 3d points :math:`N`.

Returns:
    A dictionary of tensors on torch's default device and in the default dtype:

    - ``"K"``: the camera matrix shared by all views, with shape ``(1, 3, 3)``.
    - ``"R"``: the rotation of each view, with shape ``(V, 3, 3)``.
    - ``"t"``: the translation of each view, with shape ``(V, 3, 1)``.
    - ``"P"``: the projection matrix :math:`K [R|t]` of each view, with shape ``(V, 3, 4)``.
    - ``"points3d"``: the 3d points, in :math:`[0, 1)` per coordinate, with shape ``(1, N, 3)``.
    - ``"points2d"``: the projection of ``points3d`` by each ``P``, with shape ``(V, N, 2)``.

See Also:
    - :func:`random_intrinsics`: the camera matrix of the scene.
    - :func:`projection_from_KRt`: the projection matrix of each view.

g        g      Y@g       @T)ÚdimÚkeepdimg      à?g      ð?)r   ÚKÚRÚtÚPÚpoints3dÚpoints2dg      à¿g      ð¿).Néþÿÿÿéÿÿÿÿ)ºNNNr   )r   r   é    )r   Úrandr   ÚmathÚpiÚnormr   ÚemptyÚuniform_ÚstackÚ	transposeÚminÚwherer   r   Úexpand)r	   r
   r   r   ÚangÚrvecÚrot_matÚtxÚtyÚtzÚtvecÚpoints3d_transÚmin_distr   r   s   &&             r   Úgenerate_scener5      s‚  € ô@ �zŠz˜!˜Z¨Ó+€Hô 	˜#˜uÓ%€Aô �*Š*�Y Ó
"¤T§W¡WÕ
,¨sÕ
2€Cä�:Š:�i Ó#€DØ�:œŸ
š
 4¨Q¸Ô=Õ=€DÜ+¨DÓ1€Gô 
�Š�YÓ	×	(Ñ	(¨¨sÓ	3€BÜ	�Š�YÓ	×	(Ñ	(¨¨sÓ	3€BÜ	�Š�YÓ	×	(Ñ	(¨¨sÓ	3€BÜ�;Š;˜ �|¨Ô+¨IÕ6€Dð × 2Ñ 2°2°rÓ :Õ:¸dÕB€NÜ�yŠy˜¨Õ-°1Ô5°aÕ8€HÜ—K’K ¨1¡¨b­m¸cÕ.AÀ2ÓF€Dˆ�Mô 	˜A¨Ó-€Aô   §?¡?°9¸bÀ"Ó#EÓF€Hà��C˜ # t¨S°!°ZÀÈ:ÐW_Ð`Ð`r   )Ú__doc__r"   Útypingr   r   Úkornia.geometry.conversionsr   Úkornia.geometry.linalgr   Ú
projectionr   r   r5   © r   r   Ú<module>r<      s#   ðñ$ Zã Ý ã å EÝ 3ç >÷>ar   