a
    dR                     @   sh   d Z ddlZddlmZ ddlZddlmZ ddlmZ ddl	m
Z
mZ eeeeejf dd	d
ZdS )z'Module to generate synthetic 3d scenes.    N)Dict)angle_axis_to_rotation_matrix)transform_points   )projection_from_KRtrandom_intrinsics)	num_views
num_pointsreturnc                 C   s6  t d|d}tdd}t | dtj d }t | d}|| t j|ddd }t|}t | dd	}t | dd	}t | d
d}	t j	|||	gddd }
||
dd |
 }t j|d d df ddd }t |dk |	| d |	|
d d ddf< t|||
}t||| dd}t|||
|||dS )Nr      g        g      Y@g       @T)dimZkeepdimg      g      ?g      )r   ).N   r   g      ?)KRtPpoints3dpoints2d)torchZrandr   mathpiZnormr   emptyZuniform_stackZ	transposeminwherer   r   expanddict)r   r	   r   r   angZrvecZrot_matZtxtytzZtvecZpoints3d_transZmin_distr   r    r"   g/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/kornia/geometry/epipolar/scene.pygenerate_scene   s     
(r$   )__doc__r   typingr   r   Zkornia.geometry.conversionsr   Zkornia.geometry.linalgr   Z
projectionr   r   intstrZTensorr$   r"   r"   r"   r#   <module>   s   