Ë
    ÃÓ^jÚ•  ã                  óü  — d Z ddlmZ ddlmZmZ ddlZddlZddl	m
Z
mZmZmZmZmZ ddlmZ ddlmZ ddlmZ g d	¢Ze	 d#	 	 	 	 	 	 	 d$d
„«       Z	 	 	 	 	 	 	 	 d%d„Zed&d„«       Zd'd„Zd(d„Zd)d„Z	 	 	 	 	 	 	 	 	 	 d*d„Z	 	 	 	 	 	 	 	 	 	 d+d„Z	 	 	 	 	 	 	 	 	 	 d,d„Z	 	 	 	 	 	 	 	 	 	 d-d„Z 	 	 	 	 	 	 	 	 	 	 d.d„Z!	 	 	 	 	 	 	 	 	 	 d/d„Z" ed«      d0d„«       Z# ed«      	 	 	 	 	 	 d1d„«       Z$	 	 	 	 	 	 	 	 	 	 	 	 d2d„Z%	 	 	 	 	 	 	 	 	 	 d3d„Z&	 	 	 	 	 	 	 	 	 	 	 	 	 	 d4d„Z' ed«      	 	 	 	 	 	 	 	 	 	 	 	 d5d„«       Z( ed«      	 	 	 	 	 	 d6d„«       Z)d7d8d„Z*	 	 	 	 	 	 	 	 	 	 	 	 d9d „Z+	 	 	 	 	 	 	 	 d:d!„Z,	 	 	 	 	 	 	 	 	 	 	 	 	 	 d;d"„Z-y)<a§  Functional implementations of dropout operations for image augmentation.

This module provides low-level functions for various dropout techniques used in image
augmentation, including channel dropout, grid dropout, mask dropout, and coarse dropout.
These functions create and apply dropout patterns to images, masks, bounding boxes, and
keypoints, with support for different filling methods and hole generation strategies.
é    )Úannotations)ÚLiteralÚcastN)ÚMAX_VALUES_BY_DTYPEÚNUM_MULTI_CHANNEL_DIMENSIONSÚget_num_channelsÚis_grayscale_imageÚpreserve_channel_dimÚuint8_io)Úsplit_uniform_grid)Úhandle_empty_array)ÚMONO_CHANNEL_DIMENSIONS)Úcalculate_grid_dimensionsÚchannel_dropoutÚcutoutÚfilter_bboxes_by_holesÚfilter_keypoints_in_holesÚgenerate_grid_holesÚgenerate_random_fillc                ód   — t        | «      rd}t        |«      ‚| j                  «       } || d|f<   | S )ah  Drop channels from an image.

    This function drops channels from an image.

    Args:
        img (np.ndarray): Input image.
        channels_to_drop (int | tuple[int, ...] | np.ndarray): Channels to drop.
        fill (tuple[float, ...] | float): Value to fill the dropped channels with.

    Returns:
        np.ndarray: Image with channels dropped.

    z0Only one channel. ChannelDropout is not defined..)r	   ÚNotImplementedErrorÚcopy)ÚimgÚchannels_to_dropÚfillÚmsgs       úz/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/albumentations/augmentations/dropout/functional.pyr   r   '   s<   € ô& ˜#ÔØ@ˆÜ! #Ó&Ð&à
�(‰(‹*€CØ!%€CˆÐÐÑØ€Jó    c                ó6  — t         |    }t        j                  | t        j                  «      r|j	                  d|dz   || ¬«      S t        j                  | t        j
                  «      r#|j                  d||¬«      j                  | «      S t        d| › �«      ‚)a=  Generate a random fill array based on the given dtype and target shape.

    This function creates a numpy array filled with random values. The range and type of these values
    depend on the input dtype. For integer dtypes, it generates random integers. For floating-point
    dtypes, it generates random floats.

    Args:
        dtype (np.dtype): The data type of the array to be generated.
        shape (tuple[int, ...]): The shape of the array to be generated.
        random_generator (np.random.Generator): The random generator to use for generating values.
            If None, the default numpy random generator is used.

    Returns:
        np.ndarray: A numpy array of the specified shape and dtype, filled with random values.

    Raises:
        ValueError: If the input dtype is neither integer nor floating-point.

    Examples:
        >>> import numpy as np
        >>> random_state = np.random.RandomState(42)
        >>> result = generate_random_fill(np.dtype('uint8'), (2, 2), random_state)
        >>> print(result)
        [[172 251]
         [ 80 141]]

    r   é   )ÚsizeÚdtype©r!   zUnsupported dtype: )	r   ÚnpÚ
issubdtypeÚintegerÚintegersÚfloatingÚuniformÚastypeÚ
ValueError)r"   ÚshapeÚrandom_generatorÚ	max_values       r   r   r   C   s‡   € ô@ $ EÑ*€IÜ	‡}�}�UœBŸJ™JÔ'Ø×(Ñ(¨¨I¸©MÀÈUÐ(ÓSÐSÜ	‡}�}�UœBŸK™KÔ(Ø×'Ñ'¨¨9¸5Ð'ÓA×HÑHÈÓOÐOÜ
Ð*¨5¨'Ð2Ó
3Ð3r   c                ó”  — t        | «      }t        j                  | j                  dd t        j                  ¬«      }|D ]  \  }}}}d|||…||…f<   Œ |dk(  rt
        j                  nt
        j                  }	|dk(  r³| j                  t        k(  r| j                  «       } t        j                  | t
        j                  «      }
t        j                  |
|d|	«      }|t        k(  r't        j                  |t
        j                  «      d   S t        j                  |t
        j                  «      S t        j                  | |d|	«      S )	a“  Apply OpenCV inpainting to fill the holes in the image.

    Args:
        img (np.ndarray): Input image (grayscale or BGR)
        holes (np.ndarray): Array of [x1, y1, x2, y2] coordinates
        method (Literal["inpaint_telea", "inpaint_ns"]): Inpainting method to use

    Returns:
        np.ndarray: Inpainted image

    Raises:
        NotImplementedError: If image has more than 3 channels

    Né   ©r"   éÿ   Úinpaint_telear    é   ).N)r   r$   Úzerosr,   Úuint8Úcv2ÚINPAINT_TELEAÚ
INPAINT_NSÚndimr   ÚsqueezeÚcvtColorÚCOLOR_GRAY2BGRÚinpaintÚCOLOR_BGR2GRAY)r   ÚholesÚmethodÚnum_channelsÚmaskÚx_minÚy_minÚx_maxÚy_maxÚinpaint_methodÚimg_3chÚresults               r   Úapply_inpaintingrK   k   s  € ô  $ CÓ(€Lä�8‰8�C—I‘I˜b˜q�M¬¯©Ô2€DØ&+ò -Ñ"ˆˆu�e˜UØ),ˆˆU�5ˆ[˜% ˜+Ð%Ò&ð-ð +1°OÒ*C”S×&Ò&ÌÏÉ€Nð �qÒØ�8‰8Ô3Ò3Ø—+‘+“-ˆCÜ—,‘,˜s¤C×$6Ñ$6Ó7ˆÜ—‘˜W d¨A¨~Ó>ˆð Ô;Ò;ô �L‰L˜¤×!3Ñ!3Ó4°YÑ?ð	
ô —‘˜f¤c×&8Ñ&8Ó9ð	
ô �;‰;�s˜D ! ^Ó4Ð4r   c                ó4   — |D ]  \  }}}}|| ||…||…f<   Œ | S )zÒFill holes with a constant value.

    Args:
        img (np.ndarray): Input image
        holes (np.ndarray): Array of [x1, y1, x2, y2] coordinates
        fill (np.ndarray): Value to fill the holes with

    © )r   r@   r   rD   rE   rF   rG   s          r   Úfill_holes_with_valuerN   ’   s8   € ð ',ò -Ñ"ˆˆu�e˜UØ(,ˆˆE�%ˆK˜˜u˜Ð$Ò%ð-à€Jr   c                ó:   — |D ]  \  }}}}|| dd…||…||…f<   Œ | S )zâFill holes in a volume with a constant value.

    Args:
        volume (np.ndarray): Input volume
        holes (np.ndarray): Array of [x1, y1, x2, y2] coordinates
        fill (np.ndarray): Value to fill the holes with

    NrM   )Úvolumer@   r   rD   rE   rF   rG   s          r   Úfill_volume_holes_with_valuerQ       s:   € ð ',ò 3Ñ"ˆˆu�e˜UØ.2ˆŠq�%˜�+˜u U˜{Ð*Ò+ð3à€Mr   c                ó@   — |D ]  \  }}}}|| dd…dd…||…||…f<   Œ | S )z÷Fill holes in a batch of volumes with a constant value.

    Args:
        volumes (np.ndarray): Input batch of volumes
        holes (np.ndarray): Array of [x1, y1, x2, y2] coordinates
        fill (np.ndarray): Value to fill the holes with

    NrM   )Úvolumesr@   r   rD   rE   rF   rG   s          r   Úfill_volumes_holes_with_valuerT   ®   s<   € ð ',ò 7Ñ"ˆˆu�e˜UØ26ˆ’’1�e˜E�k 5¨ ;Ð.Ò/ð7à€Nr   c                óò   — |D ]q  \  }}}}|rdn	||z
  ||z
  f}| j                   t        k7  r'|rd| j                  d   fng |¢| j                  d   ‘­}t        | j                  ||«      }	|	| ||…||…f<   Œs | S )a&  Fill holes with random values.

    Args:
        img (np.ndarray): Input image
        holes (np.ndarray): Array of [x1, y1, x2, y2] coordinates
        random_generator (np.random.Generator): Random number generator
        uniform (bool): If True, use same random value for entire hole

    )r    r    r0   )r:   r   r,   r   r"   )
r   r@   r-   r)   rD   rE   rF   rG   r,   Úrandom_fills
             r   Úfill_holes_with_randomrW   ¼   s™   € ð ',ò 4Ñ"ˆˆu�e˜UÙ‘ e¨e¡m°U¸U±]Ð%CˆØ�8‰8Ô.Ò.Ù)0�Q˜Ÿ	™	 !™Ñ%Ð6L¸Ð6L¸s¿y¹yÈ¹|Ñ6LˆEä*¨3¯9©9°eÐ=MÓNˆØ(3ˆˆE�%ˆK˜˜u˜Ð$Ò%ð4ð €Jr   c                óJ  — |D ]�  \  }}}}|r| j                   d   ddfn| j                   d   ||z
  ||z
  f}| j                  dk7  r6|r | j                   d   dd| j                   d   fng |¢| j                   d   ‘­}t        | j                  ||«      }	|	| dd…||…||…f<   ŒŸ | S )ah  Fill holes in a volume with random values.

    Args:
        volume (np.ndarray): Input volume of shape (D, H, W, C) or (D, H, W)
        holes (np.ndarray): Array of [x1, y1, x2, y2] coordinates
        random_generator (np.random.Generator): Random number generator
        uniform (bool): If True, use same random value for entire hole in each image.

    r   r    r4   N©r,   r:   r   r"   )
rP   r@   r-   r)   rD   rE   rF   rG   r,   rV   s
             r   Úfill_volume_holes_with_randomrZ   Õ   sÈ   € ð ',ò :Ñ"ˆˆu�e˜UÙ+2�—‘˜a‘ ! QÑ'¸¿¹Àa¹È%ÐRWÉ-ÐY^ÐafÑYfÐ8gˆØ�;‰;˜!ÒÙ@G�V—\‘\ !‘_ a¨¨F¯L©L¸©OÑ<ÐMfÈuÐMfÐV\×VbÑVbÐcdÑVeÑMfˆEä*¨6¯<©<¸Ð@PÓQˆØ.9ˆŠq�%˜�+˜u U˜{Ð*Ò+ð:ð €Mr   c                ó¤  — |D ]Ê  \  }}}}|r | j                   d   | j                   d   ddfn%| j                   d   | j                   d   ||z
  ||z
  f}| j                  dk7  rD|r.| j                   d   | j                   d   dd| j                   d   fng |¢| j                   d   ‘­}t        | j                  ||«      }	|	| dd…dd…||…||…f<   ŒÌ | S )ay  Fill holes in a batch of volumes with random values.

    Args:
        volumes (np.ndarray): Input volume of shape (N, D, H, W, C) or (N, D, H, W)
        holes (np.ndarray): Array of [x1, y1, x2, y2] coordinates
        random_generator (np.random.Generator): Random number generator
        uniform (bool): If True, use same random value for entire hole for each image

    r   r    é   NrY   )
rS   r@   r-   r)   rD   rE   rF   rG   r,   rV   s
             r   Úfill_volumes_holes_with_randomr]   î   sü   € ð ',ò >Ñ"ˆˆu�e˜Uñ ð �]‰]˜1Ñ˜wŸ}™}¨QÑ/°°AÑ6à—-‘- Ñ" G§M¡M°!Ñ$4°e¸e±mÀUÈUÁ]ÐSð 	ð
 �<‰<˜1ÒáPW�—‘˜qÑ! 7§=¡=°Ñ#3°Q¸¸7¿=¹=ÈÑ;KÑLÐ]wÐ_dÐ]wÐfm×fsÑfsÐtuÑfvÑ]wð ô +¨7¯=©=¸%ÐAQÓRˆØ2=ˆ’’1�e˜E�k 5¨ ;Ð.Ò/ð>ð €Nr   c                ó–  — | j                  «       } t        |t        «      rQ|dv rt        | |t	        d|«      «      S |dk(  rt        | ||d¬«      S |dk(  rt        | ||d¬«      S t        d|› �«      ‚t        |t        t        f«      r.t        j                  || j                  ¬	«      }t        | ||«      S t        j                  || j                  ¬	«      }| j                  t        k(  rT|j                  «       }|j                   | j"                  d
   k7  r(t        d|j                   › d| j"                  d
   › �«      ‚t        | ||«      S )al  Apply cutout augmentation to the image by cutting out holes and filling them.

    Args:
        img (np.ndarray): The image to augment
        holes (np.ndarray): Array of [x1, y1, x2, y2] coordinates
        fill (tuple[float, ...] | float | Literal["random", "random_uniform", "inpaint_telea", "inpaint_ns"]):
            Value to fill holes with. Can be:
            - number (int/float): Will be broadcast to all channels
            - sequence (tuple/list/ndarray): Must match number of channels
            - "random": Different random values for each pixel
            - "random_uniform": Same random value for entire hole
            - "inpaint_telea"/"inpaint_ns": OpenCV inpainting methods
        random_generator (np.random.Generator): Random number generator for random fills

    Raises:
        ValueError: If fill length doesn't match number of channels

    ¾   Ú
inpaint_nsr3   ú&Literal['inpaint_telea', 'inpaint_ns']ÚrandomF©r)   Úrandom_uniformTúUnsupported string fill: r1   r0   ú;Fill value must have same number of channels as image. Got ú, expected )r   Ú
isinstanceÚstrrK   r   rW   r+   ÚintÚfloatr$   Úarrayr"   rN   r:   r   Úravelr!   r,   )r   r@   r   r-   Ú
fill_arrays        r   r   r     sA  € ð0 �(‰(‹*€Cô �$œÔØÐ2Ñ2Ü# C¨´Ð5]Ð_cÓ0dÓeÐeØ�8ÒÜ)¨#¨uÐ6FÐPUÔVÐVØÐ#Ò#Ü)¨#¨uÐ6FÐPTÔUÐUÜÐ4°T°FÐ;Ó<Ð<ô �$œœe˜Ô%Ü—X‘X˜d¨#¯)©)Ô4ˆ
Ü$ S¨%°Ó<Ð<ô —‘˜$ c§i¡iÔ0€Jð ‡x�xÔ/Ò/Ø×%Ñ%Ó'ˆ
Ø�?‰?˜cŸi™i¨™lÒ*ÜðØ!—‘Ð' {°3·9±9¸Q±<°.ðBóð ô
 !  e¨ZÓ8Ð8r   c                ó  — | j                  «       } t        |t        «      rŽ|dv rT| D �cg c]  }t        ||t	        d|«      «      ‘Œ }}t        j                  |«      }|j                  | j                  «      S |dk(  rt        | ||d¬«      S |dk(  rt        | ||d¬«      S t        d|› �«      ‚t        |t        t        f«      r.t        j                  || j                  ¬	«      }t        | ||«      S t        j                  || j                  ¬	«      }| j                  d
k(  rT|j!                  «       }|j"                  | j                  d   k7  r(t        d|j"                  › d| j                  d   › �«      ‚t        | ||«      S c c}w )a²  Apply cutout augmentation to a volume of shape (D, H, W) or (D, H, W, C) by cutting out holes and filling them.

    Args:
        volume (np.ndarray): The volume to augment
        holes (np.ndarray): Array of [x1, y1, x2, y2] coordinates
        fill (tuple[float, ...] | float | Literal["random", "random_uniform", "inpaint_telea", "inpaint_ns"]):
            Value to fill holes with. Can be:
            - number (int/float): Will be broadcast to all channels
            - sequence (tuple/list/ndarray): Must match number of channels
            - "random": Different random values for each pixel
            - "random_uniform": Same random value for entire hole, different values across images
            - "inpaint_telea"/"inpaint_ns": OpenCV inpainting methods
        random_generator (np.random.Generator): Random number generator for random fills

    Raises:
        ValueError: If fill length doesn't match number of channels

    r_   ra   rb   Frc   rd   Tre   r1   r\   r4   rf   rg   )r   rh   ri   rK   r   r$   rl   Úreshaper,   rZ   r+   rj   rk   r"   rQ   r:   rm   r!   )rP   r@   r   r-   r   Úprocessed_imagesrJ   rn   s           r   Úcutout_on_volumerr   D  s€  € ð0 �[‰[‹]€Fô �$œÔØÐ2Ñ2àntö ØgjÔ   e¬TÐ2ZÐ\`Ó-aÕbð Ðð  ô —X‘XÐ.Ó/ˆFà—>‘> &§,¡,Ó/Ð/Ø�8ÒÜ0°¸Ð@PÐZ_Ô`Ð`ØÐ#Ò#Ü0°¸Ð@PÐZ^Ô_Ð_ÜÐ4°T°FÐ;Ó<Ð<ô �$œœe˜Ô%Ü—X‘X˜d¨&¯,©,Ô7ˆ
Ü+¨F°E¸:ÓFÐFô —‘˜$ f§l¡lÔ3€Jð ‡{�{�aÒØ×%Ñ%Ó'ˆ
Ø�?‰?˜fŸl™l¨1™oÒ-ÜðØ!—‘Ð' {°6·<±<À±?Ð2CðEóð ô
 (¨°°zÓBÐBùò; s   ©Fc                ó&  — | j                  «       } t        |t        «      r—|dv r]| D ��cg c]   }|D ]  }t        ||t	        d|«      «      ‘Œ Œ" }}}t        j                  |«      }|j                  | j                  «      S |dk(  rt        | ||d¬«      S |dk(  rt        | ||d¬«      S t        d|› �«      ‚t        |t        t        f«      r.t        j                  || j                  ¬	«      }t        | ||«      S t        j                  || j                  ¬	«      }| j                  d
k(  rT|j!                  «       }|j"                  | j                  d   k7  r(t        d|j"                  › d| j                  d   › �«      ‚t        | ||«      S c c}}w )a›  Apply cutout augmentation to a batch of volumes of shape (N, D, H, W) or (N, D, H, W, C)

    Args:
        volumes (np.ndarray): The image to augment
        holes (np.ndarray): Array of [x1, y1, x2, y2] coordinates
        fill (tuple[float, ...] | float | Literal["random", "random_uniform", "inpaint_telea", "inpaint_ns"]):
            Value to fill holes with. Can be:
            - number (int/float): Will be broadcast to all channels
            - sequence (tuple/list/ndarray): Must match number of channels
            - "random": Different random values for each pixel
            - "random_uniform": Same random value for entire hole, different values across images
            - "inpaint_telea"/"inpaint_ns": OpenCV inpainting methods
        random_generator (np.random.Generator): Random number generator for random fills

    Raises:
        ValueError: If fill length doesn't match number of channels

    r_   ra   rb   Frc   rd   Tre   r1   é   r\   rf   rg   )r   rh   ri   rK   r   r$   rl   rp   r,   r]   r+   rj   rk   r"   rT   r:   rm   r!   )	rS   r@   r   r-   rP   r   rq   rJ   rn   s	            r   Úcutout_on_volumesru   �  s›  € ð0 �l‰l‹n€Gô �$œÔØÐ2Ñ2ð &÷ àØ!ò ð ô !  e¬TÐ2ZÐ\`Ó-aÕbð Øbð Ðñ  ô
 —X‘XÐ.Ó/ˆFà—>‘> '§-¡-Ó0Ð0Ø�8ÒÜ1°'¸5ÐBRÐ\aÔbÐbØÐ#Ò#Ü1°'¸5ÐBRÐ\`ÔaÐaÜÐ4°T°FÐ;Ó<Ð<ô �$œœe˜Ô%Ü—X‘X˜d¨'¯-©-Ô8ˆ
Ü,¨W°e¸ZÓHÐHô —‘˜$ g§m¡mÔ4€Jð ‡|�|�qÒØ×%Ñ%Ó'ˆ
Ø�?‰?˜gŸm™m¨AÑ.Ò.ÜðØ!—‘Ð' {°7·=±=ÀÑ3CÐ2DðFóð ô
 )¨°%¸ÓDÐDùó? s   ª%FÚ	keypointsc                ó*  — | dd…df   dd…t         j                  f   }| dd…df   dd…t         j                  f   }|dd…df   }|dd…df   }|dd…df   }|dd…df   }||k\  ||k  z  ||k\  z  ||k  z  }t        j                  |d¬«       }	| |	   S )aÌ  Filter out keypoints that are inside any of the holes.

    Args:
        keypoints (np.ndarray): Array of keypoints with shape (num_keypoints, 2+).
                                The first two columns are x and y coordinates.
        holes (np.ndarray): Array of holes with shape (num_holes, 4).
                            Each hole is represented as [x1, y1, x2, y2].

    Returns:
        np.ndarray: Array of keypoints that are not inside any hole.

    Nr   r    r0   r4   ©Úaxis)r$   ÚnewaxisÚany)
rv   r@   Úkp_xÚkp_yÚhole_x1Úhole_y1Úhole_x2Úhole_y2Úinside_holeÚvalid_keypointss
             r   r   r   À  s³   € ð ’Q˜�T‰?š1œbŸj™j˜=Ñ)€DØ’Q˜�T‰?š1œbŸj™j˜=Ñ)€Dà’A�q�D‰k€GØ’A�q�D‰k€GØ’A�q�D‰k€GØ’A�q�D‰k€Gð ˜7‘? t¨g¡~Ñ6¸$À'¹/ÑJÈdÐU\ÉnÑ]€Kô —v‘v˜k°Ô2Ð2€Oà�_Ñ%Ð%r   Úbboxesc                óà  — | dd…df   j                  t        «      }| dd…df   j                  t        «      }| dd…df   j                  t        «      }| dd…df   j                  t        «      }g }t        t        | «      «      D �cg c]  }|||   ||   …||   ||   …f   ‘Œ }}|D �	cg c]  }	d|	z
  ‘Œ	 }
}	t	        t        |
| «      «      D ]Ì  \  }\  }}|j                  «       sŒ|j                  d¬«      }|j                  d¬«      }t        j                  |«      d   }t        j                  |«      d   }|j                  «       }||   |d   z   |d<   ||   |d   z   |d<   ||   |d   z   dz   |d<   ||   |d   z   dz   |d<   |j                  |«       ŒÎ |rt        j                  |«      S t        j                  d| j                  d   f| j                  ¬«      S c c}w c c}	w )	z:Resize boxes to their largest visible rectangular regions.Nr   r    r0   r4   rx   éÿÿÿÿr1   )r*   rj   ÚrangeÚlenÚ	enumerateÚzipr{   r$   Únonzeror   Úappendrl   r5   r,   r"   )ÚboxesÚ	hole_maskÚx1Úy1Úx2Úy2Ú	new_boxesÚiÚregionsÚregionÚvisible_areasÚvisibleÚboxÚ	y_visibleÚ	x_visibleÚy_coordsÚx_coordsÚnew_boxs                     r   Úresize_boxes_to_visible_arearŸ   à  sõ  € ð 
Šq�!ˆt‰×	Ñ	œCÓ	 €BØ	Šq�!ˆt‰×	Ñ	œCÓ	 €BØ	Šq�!ˆt‰×	Ñ	œCÓ	 €BØ	Šq�!ˆt‰×	Ñ	œCÓ	 €Bð #%€Iä@EÄcÈ%ÃjÓ@QÖR¸1ˆy˜˜A™  A¡˜¨¨1©°°1±¨Ð5Ó6ÐR€GÐRØ.5Ö6 F�Q˜“ZÐ6€MÐ6ä&¤s¨=¸%Ó'@ÓAò "Ñˆ‰>ˆG�SØ�{‰{Œ}Øð —K‘K Q�KÓ'ˆ	Ø—K‘K Q�KÓ'ˆ	ä—:‘:˜iÓ(¨Ñ+ˆÜ—:‘:˜iÓ(¨Ñ+ˆð —(‘(“*ˆØ˜‘U˜X a™[Ñ(ˆ�‰
Ø˜‘U˜X a™[Ñ(ˆ�‰
Ø˜‘U˜X b™\Ñ)¨AÑ-ˆ�‰
Ø˜‘U˜X b™\Ñ)¨AÑ-ˆ�‰
à×Ñ˜Õ!ð%"ñ, #,Œ2�8‰8�IÓÐa´·±¸1¸e¿k¹kÈ!¹nÐ:MÐUZ×U`ÑU`Ô1aÐaùò3 SùÚ6s   Â	G&Â-G+c                óÊ  — t        | «      dk(  st        |«      dk(  r| S t        j                  |t        j                  ¬«      }|D ]'  }|j	                  t
        «      \  }}}	}
d|||
…||	…f<   Œ) | j	                  t
        «      }|dd…df   |dd…df   z
  |dd…df   |dd…df   z
  z  }t        j                  |dd…dd…f   D ����cg c]%  \  }}}}t        j                  |||…||…f   «      ‘Œ' c}}}}«      }||z
  }||z  }||k\  ||k\  z  |dkD  z  }| |   }t        |«      dk(  r$t        j                  d| j                  d   f«      S t        ||«      S c c}}}}w )a¼  Filter bounding boxes by holes.

    This function filters bounding boxes by holes.

    Args:
        bboxes (np.ndarray): Array of bounding boxes.
        holes (np.ndarray): Array of holes.
        image_shape (tuple[int, int]): Shape of the image.
        min_area (float): Minimum area of a bounding box.
        min_visibility (float): Minimum visibility of a bounding box.

    Returns:
        np.ndarray: Filtered bounding boxes.

    r   r1   r    Nr0   r4   r\   )rˆ   r$   r5   r6   r*   rj   rl   ÚsumÚemptyr,   rŸ   )r„   r@   Úimage_shapeÚmin_areaÚmin_visibilityrŽ   ÚholerD   rE   rF   rG   Ú
bboxes_intÚ	box_areasÚxÚyr‘   r’   Úintersection_areasÚremaining_areasÚvisibility_ratiosrC   Úvalid_boxess                         r   r   r     s�  € ô, ˆ6ƒ{�aÒœ3˜u›:¨š?Øˆô —‘˜¬B¯H©HÔ5€IØò 0ˆØ%)§[¡[´Ó%5Ñ"ˆˆu�e˜UØ./ˆ	�%˜�+˜u U˜{Ð*Ò+ð0ð
 —‘œsÓ#€JØšA˜q˜DÑ! Jªq°!¨tÑ$4Ñ4¸ÂAÀqÀDÑ9IÈJÒWXÐZ[ÐW[ÑL\Ñ9\Ñ]€IÜŸ™ÐU_Ò`aÐceÐdeÐceÐ`eÑUf×"gÑ"gÁ\ÀQÈÈ2Èr¤2§6¡6¨)°A°b°D¸!¸B¸$°JÑ*?Õ#@Õ"gÓhÐØÐ"4Ñ4€OØ'¨)Ñ3ÐØ˜xÑ'Ð,=ÀÑ,OÑPÐTcÐfgÑTgÑh€Dà˜‘,€KÜ
ˆ;Ó˜1ÒÜ�x‰x˜˜FŸL™L¨™OÐ,Ó-Ð-ô (¨°YÓ?Ð?ùõ #hs   Ã*Ec                óè   — | dd \  }}|�2|d   t        | dd «      kD  rt        d«      ‚ |j                  |Ž }||fS |r|\  }}||z  }	||z  }
|
|	fS t        d|dz  «      }	t        d|dz  «      }
|
|	fS )aÈ  Calculate the dimensions of grid units for GridDropout.

    This function determines the size of grid units based on the input parameters.
    It supports three modes of operation:
    1. Using a range of unit sizes
    2. Using a specified number of holes in x and y directions
    3. Falling back to a default calculation

    Args:
        image_shape (tuple[int, int]): The shape of the image as (height, width).
        unit_size_range (tuple[int, int] | None, optional): A range of possible unit sizes.
            If provided, a random size within this range will be chosen for both height and width.
        holes_number_xy (tuple[int, int] | None, optional): The number of holes in the x and y directions.
            If provided, the grid dimensions will be calculated to fit this number of holes.
        random_generator (np.random.Generator): The random generator to use for generating random values.

    Returns:
        tuple[int, int]: The calculated grid unit dimensions as (unit_height, unit_width).

    Raises:
        ValueError: If the upper limit of unit_size_range is greater than the shortest image edge.

    Notes:
        - If both unit_size_range and holes_number_xy are None, the function falls back to a default calculation,
          where the grid unit size is set to max(2, image_dimension // 10) for both height and width.
        - The function prioritizes unit_size_range over holes_number_xy if both are provided.
        - When using holes_number_xy, the actual number of holes may be slightly different due to integer division.

    Examples:
        >>> image_shape = (100, 200)
        >>> calculate_grid_dimensions(image_shape, unit_size_range=(10, 20))
        (15, 15)  # Random value between 10 and 20

        >>> calculate_grid_dimensions(image_shape, holes_number_xy=(5, 10))
        (20, 20)  # 100 // 5 and 200 // 10

        >>> calculate_grid_dimensions(image_shape)
        (10, 20)  # Default calculation: max(2, dimension // 10)

    Nr0   r    z8Grid size limits must be within the shortest image edge.é
   )Úminr+   r'   Úmax)r£   Úunit_size_rangeÚholes_number_xyr-   ÚheightÚwidthÚ	unit_sizeÚholes_number_xÚholes_number_yÚ
unit_widthÚunit_heights              r   r   r   :  sµ   € ð\    �O�M€FˆEàÐ"Ø˜1Ñ¤ K°° OÓ 4Ò4ÜÐWÓXÐXØ-Ð$×-Ñ-¨Ð?ˆ	Ø˜)Ð#Ð#áØ)8Ñ&ˆ˜Ø˜nÑ,ˆ
Ø Ñ.ˆØ˜JÐ&Ð&ô �Q˜ ™Ó$€JÜ�a˜ 2™Ó&€KØ˜
Ð"Ð"r   c                ó0  — | dd \  }}t        | ||«      }|dd…df   |dd…df   z
  }	|dd…df   |dd…df   z
  }
t        j                  |	|z  d|	dz
  «      j                  t        «      }t        j                  |
|z  d|
dz
  «      j                  t        «      }|	|z
  }|
|z
  }|r+|j                  d|dz   «      }|j                  d|dz   «      }n2t        j                  ||d   «      }t        j                  ||d   «      }t        j                  |dd…df   |z   d||z
  «      }t        j                  |dd…df   |z   d||z
  «      }t        j                  ||z   |«      }t        j                  ||z   |«      }t        j                  ||||f«      S )a	  Generate a list of holes for GridDropout using a uniform grid.

    This function creates a grid of holes for use in the GridDropout augmentation technique.
    It allows for customization of the grid size, hole size ratio, and positioning of holes.

    Args:
        image_shape (tuple[int, int]): The shape of the image as (height, width).
        grid (tuple[int, int]): The grid size as (rows, columns). This determines the number of cells
            in the grid, where each cell may contain a hole.
        ratio (float): The ratio of the hole size to the grid cell size. Should be between 0 and 1.
            A ratio of 1 means the hole will fill the entire grid cell.
        random_offset (bool): If True, applies random offsets to each hole within its grid cell.
            If False, uses the global shift specified by shift_xy.
        shift_xy (tuple[int, int]): The global shift to apply to all holes as (shift_x, shift_y).
            Only used when random_offset is False.
        random_generator (np.random.Generator): The random generator for generating random offsets
            and shuffling. If None, a new Generator will be created.

    Returns:
        np.ndarray: An array of hole coordinates, where each hole is represented as
            [x1, y1, x2, y2]. The shape of the array is (n_holes, 4), where n_holes
            is determined by the grid size.

    Notes:
        - The function first creates a uniform grid based on the image shape and specified grid size.
        - Hole sizes are calculated based on the provided ratio and grid cell sizes.
        - If random_offset is True, each hole is randomly positioned within its grid cell.
        - If random_offset is False, all holes are shifted by the global shift_xy value.
        - The function ensures that all holes remain within the image boundaries.

    Examples:
        >>> image_shape = (100, 100)
        >>> grid = (5, 5)
        >>> ratio = 0.5
        >>> random_offset = True
        >>> random_state = np.random.RandomState(42)
        >>> shift_xy = (0, 0)
        >>> holes = generate_grid_holes(image_shape, grid, ratio, random_offset, random_state, shift_xy)
        >>> print(holes.shape)
        (25, 4)
        >>> print(holes[0])  # Example output: [x1, y1, x2, y2] of the first hole
        [ 1 21 11 31]

    Nr0   r   r4   r    )	r   r$   Úclipr*   rj   r'   Ú	full_likeÚminimumÚcolumn_stack)r£   ÚgridÚratioÚrandom_offsetÚshift_xyr-   rµ   r¶   ÚcellsÚcell_heightsÚcell_widthsÚhole_heightsÚhole_widthsÚmax_offset_yÚmax_offset_xÚoffset_yÚoffset_xrD   rE   rF   rG   s                        r   r   r   |  s¥  € ðh    �O�M€FˆEô ˜{¨DÐ2BÓC€Eð š˜A˜‘; ¢q¨! t¡Ñ,€LØš˜1˜‘+ ¢a¨ d¡Ñ+€KÜ—7‘7˜<¨%Ñ/°°LÀ1Ñ4DÓE×LÑLÌSÓQ€LÜ—'‘'˜+¨Ñ-¨q°+À±/ÓB×IÑIÌ#ÓN€Kð   ,Ñ.€LØ Ñ,€Láà#×,Ñ,¨Q°¸qÑ0@ÓAˆØ#×,Ñ,¨Q°¸qÑ0@ÓA‰ô —<‘< ¨h°q©kÓ:ˆÜ—<‘< ¨h°q©kÓ:ˆô �G‰G�Eš!˜Q˜$‘K (Ñ*¨A¨u°{Ñ/BÓC€EÜ�G‰G�Eš!˜Q˜$‘K (Ñ*¨A¨v¸Ñ/DÓE€EÜ�J‰J�u˜{Ñ*¨EÓ2€EÜ�J‰J�u˜|Ñ+¨VÓ4€Eä�?‰?˜E 5¨%°Ð7Ó8Ð8r   c                óˆ  — |\  }}|j                   dkD  re|j                  d   dk(  r|j                  d«      }nA|j                  d   dk  rt        j                  |d¬«      }nt        j                  |d¬«      }t        j
                  d|…d|…f   \  }}|ddd…f   | dd…dddf   k\  |ddd…f   | dd…dddf   k  z  |ddd…f   | dd…dddf   k\  z  |ddd…f   | dd…dddf   k  z  }	| dd…df   | dd…df   z
  | dd…df   | dd…df   z
  z  }
t        j                  |	| z  d	¬«      }||
z  }||k\  ||k\  z  }| |   S )
a  Filter and resize bounding boxes based on dropout mask.

    Args:
        bboxes (np.ndarray): Array of bounding boxes with shape (num_boxes, 4+)
        dropout_mask (np.ndarray): Binary mask indicating dropped areas
        image_shape (tuple[int, int]): Shape of the image (height, width)
        min_area (float): Minimum area of a bounding box to keep
        min_visibility (float): Minimum visibility ratio of a bounding box to keep

    Returns:
        np.ndarray: Filtered and resized bounding boxes

    r0   r   r    r†   r\   rx   Nr4   )r    r0   )r:   r,   r;   r$   r{   Úogridr¡   )r„   Údropout_maskr£   r¤   r¥   rµ   r¶   rª   r©   Ú	box_masksr¨   r—   Úvisibility_ratioÚ	keep_masks                 r   Úmask_dropout_bboxesrÔ   Ñ  sŸ  € ð*  �M€FˆEð ×Ñ˜1ÒØ×Ñ˜aÑ  AÒ%Ø'×/Ñ/°Ó2‰LØ×Ñ Ñ# qÒ(ÜŸ6™6 ,°RÔ8‰LäŸ6™6 ,°QÔ7ˆLô �8‰8�G�V�G˜V˜e˜V�OÑ$�D€A€qà	
ˆ4’ˆ7‰�vša  D¨$Ð.Ñ/Ñ	/ØˆT’1ˆW‰:˜¢ 1 d¨DÐ 0Ñ1Ñ1ñ	3àˆT’1ˆW‰:˜¢ 1 d¨DÐ 0Ñ1Ñ1ñ	3ð ˆT’1ˆW‰:˜¢ 1 d¨DÐ 0Ñ1Ñ1ñ	3ð ð š˜1˜‘ ¢q¨! t¡Ñ,°º¸1¸±ÀÂqÈ!ÀtÁÑ1LÑM€Iô —F‘F˜9¨ }Ñ4¸6ÔB€Mð % yÑ0Ðð  (Ñ*Ð/?À>Ñ/QÑR€Ià�)ÑÐr   c                ó0  — |j                   dkD  re|j                  d   dk(  r|j                  d«      }nA|j                  d   dk  rt        j                  |d¬«      }nt        j                  |d¬«      }| dd…dd…f   j                  t        «      }|dd…df   dk\  |dd…df   |j                  d   k  z  |dd…df   dk\  z  |dd…df   |j                  d   k  z  }t        j                  |«      r||   }||dd…df   |dd…df   f    ||<   | |   S )a  Filter keypoints based on dropout mask.

    Args:
        keypoints (np.ndarray): Array of keypoints with shape (num_keypoints, 2+)
        dropout_mask (np.ndarray): Binary mask indicating dropped areas

    Returns:
        np.ndarray: Filtered keypoints

    r0   r   r    r†   r\   rx   N)r:   r,   r;   r$   r{   r*   rj   )rv   rÐ   ÚcoordsÚ
valid_maskÚvalid_coordss        r   Úmask_dropout_keypointsrÙ   	  sD  € ð  ×Ñ˜1ÒØ×Ñ˜aÑ  AÒ%Ø'×/Ñ/°Ó2‰LØ×Ñ Ñ# qÒ(ÜŸ6™6 ,°RÔ8‰LäŸ6™6 ,°QÔ7ˆLð ’q˜"˜1˜"�uÑ×$Ñ$¤SÓ)€Fð 
’�1�‰˜Ñ	Ø’!�Q�$‰<˜,×,Ñ,¨QÑ/Ñ/ñ	1à’!�Q�$‰<˜1Ññ	ð ’!�Q�$‰<˜,×,Ñ,¨QÑ/Ñ/ñ	1ð ô 
‡v�vˆjÔØ˜jÑ)ˆØ".¨|ºA¸q¸DÑ/AÀ<ÒPQÐSTÐPTÑCUÐ/UÑ"VÐ!Vˆ
�:Ñà�ZÑ Ð r   c                ót  — t        j                  | t         j                  ¬«      }t        j                  | | dk7     «      }d}|D ]e  }| |k(  j	                  t         j
                  «      }|dk(  rdnd}t        j                  ||¬«      \  }	}
t        d|	«      D ]  }|||
|k(  <   |dz  }Œ Œg |dz
  }	|r||	fS |S )aÖ  Label connected regions of an integer array.

    This function uses OpenCV's connectedComponents under the hood but mimics
    the behavior of scikit-image's label function.

    Args:
        mask (np.ndarray): The array to label. Must be of integer type.
        return_num (bool): If True, return the number of labels (default: False).
        connectivity (int): Maximum number of orthogonal hops to consider a pixel/voxel
                            as a neighbor. Accepted values are 1 or 2. Default is 2.

    Returns:
        np.ndarray | tuple[np.ndarray, int]: Labeled array, where all connected regions are
        assigned the same integer value. If return_num is True, it also returns the number of labels.

    r1   r   r    r\   é   )Úconnectivity)	r$   Ú
zeros_likeÚint32Úuniquer*   r6   r7   ÚconnectedComponentsr‡   )rC   Ú
return_numrÜ   ÚlabeledÚunique_valuesÚ
next_labelÚvalueÚbinary_maskÚcv2_connectivityÚ
num_labelsÚlabelsr”   s               r   Úlabelrê   4  sÕ   € ô$ �m‰m˜D¬¯©Ô1€Gô —I‘I˜d 4¨1¡9™oÓ.€Mð €JØò ˆØ˜u‘}×,Ñ,¬R¯X©XÓ6ˆð !-°Ò 1™1°qÐô !×4Ñ4°[ÐO_Ô`Ñˆ
�Fô �q˜*Ó%ò 	ˆAØ#-ˆG�F˜a‘KÑ Ø˜!‰O‰Jñ	ðð ˜a‘€Já$.ˆG�ZÐ Ð;°GÐ;r   c                óÔ  — t        | «      }| dd…df   | dd…df   z
  }| dd…df   | dd…df   z
  }|j                  |d   |d   ||f¬«      |dd…df   z  j                  t        j                  «      }|j                  |d   |d   ||f¬«      |dd…df   z  j                  t        j                  «      }	|j                  dd||f¬«      |dd…df   |	z
  z  }
|j                  dd||f¬«      |dd…df   |z
  z  }| dd…ddf   |
z   }| dd…ddf   |z   }||	z   }||z   }t        j
                  ||||gd¬«      j                  t        j                  «      j                  dd	«      S )
z'Generate holes based on bounding boxes.Nr0   r   r4   r    r#   r†   rx   r\   )rˆ   r)   r*   r$   rÞ   Ústackrp   )Útarget_boxesÚnum_holes_per_boxÚhole_height_rangeÚhole_width_ranger-   Ú	num_boxesÚ
box_widthsÚbox_heightsrÈ   rÉ   Ú	x_offsetsÚ	y_offsetsrD   rE   rF   rG   s                   r   Úget_holes_from_boxesrö   `  sÖ  € ô �LÓ!€Ið ša ˜dÑ# l²1°a°4Ñ&8Ñ8€JØšq !˜tÑ$ |²A°q°DÑ'9Ñ9€Kð 	× Ñ Ø˜aÑ Ø˜aÑ ØÐ.Ð/ð 	!ó 	
ð
 ’a˜�gÑ
ñ	÷ �fŒR�X‰XÓð ð 	× Ñ Ø˜QÑØ˜QÑØÐ.Ð/ð 	!ó 	
ð
 ’Q˜�WÑ
ñ	÷ �fŒR�X‰XÓð ð !×(Ñ(¨¨A°YÐ@QÐ4RÐ(ÓSØ’1�d�7Ñ˜kÑ)ñ€Ið !×(Ñ(¨¨A°YÐ@QÐ4RÐ(ÓSØ’A�t�GÑ˜|Ñ+ñ€Ið
 š˜A˜t˜Ñ$ yÑ0€EØš˜A˜t˜Ñ$ yÑ0€EØ�KÑ€EØ�LÑ €Eä�8‰8�U˜E 5¨%Ð0°rÔ:×AÑAÄ"Ç(Á(ÓK×SÑSÐTVÐXYÓZÐZr   c                ó,  — t        j                  | j                  t        j                  «      «      \  }}|dk(  ryg }g }t        d|«      D ]™  }t        j                  ||k(  «      }t        |«      dk(  rŒ*t        j                  t        |«      «      }	|j                  t        |«      |d¬«      }
||
   }|j                  |dd…ddd…f   «       |j                  |	g|z  «       Œ› |r*t        j                  |«      t        j                  |«      fS dS )aj  Sample points from connected components in a mask.

    Args:
        mask (np.ndarray): Binary mask
        num_points (int): Number of points to sample
        random_generator (np.random.Generator): Random number generator

    Returns:
        tuple[np.ndarray, np.ndarray] | None: Tuple of (x_coordinates, y_coordinates) or None if no valid components

    r    Nr   T)r!   Úreplacer†   )r7   rà   r*   r$   r6   r‡   Úargwhererˆ   ÚsqrtÚchoiceÚextendrl   )rC   Ú
num_pointsr-   rè   ré   ÚcentersÚ	obj_sizesrê   ÚpointsÚobj_sizeÚindicesÚsampled_pointss               r   Úsample_points_from_componentsr  ’  s   € ô  ×0Ñ0°·±¼R¿X¹XÓ1FÓGÑ€J�à�Q‚Øà€GØ€IÜ�q˜*Ó%ò 2ˆÜ—‘˜V u™_Ó-ˆÜˆv‹;˜!ÒØô —7‘7œ3˜v›;Ó'ˆð #×)Ñ)¬#¨f«+¸JÐPTÐ)ÓUˆØ ™ˆà�‰�~¢a©¨2¨ gÑ.Ô/à×Ñ˜(˜ jÑ0Õ1ð2ñ  8?ŒB�H‰H�WÓœrŸx™x¨	Ó2Ð3ÐHÀDÐHr   c                óŒ  — t        j                  | t        j                  |«      «      }t        j                  |«      s4t        j                  g t         j                  ¬«      j                  d«      S t        |||«      }|€4t        j                  g t         j                  ¬«      j                  d«      S |\  }}	t        |«      }
| j                  dd \  }}|j                  |d   |d   |
¬«      |	z  }|j                  |d   |d   |
¬«      |	z  }|dz  }|dz  }t        j                  |dd…df   |z
  |dd…df   |z
  |dd…df   |z   |dd…df   |z   g«      j                  t         j                  «      }t        j                  |dd…df   d|dz
  «      |dd…df<   t        j                  |dd…df   d|dz
  «      |dd…df<   t        j                  |dd…df   d|«      |dd…df<   t        j                  |dd…df   d|«      |dd…df<   |dd…df   |dd…df   z
  dkD  |dd…df   |dd…df   z
  dkD  z  }||   S )	z*Generate holes based on segmentation mask.r1   )r   r\   Nr0   r   r    r#   r4   )r$   Úisinrl   r{   rÞ   rp   r  rˆ   r,   r)   rÀ   r*   r½   )rC   Únum_holes_per_objÚmask_indicesrï   rð   r-   ræ   rJ   rþ   rÿ   Únum_centersrµ   r¶   rÈ   rÉ   Úhalf_heightsÚhalf_widthsr@   Úvalid_holess                      r   Úget_holes_from_maskr  ¼  sl  € ô —'‘'˜$¤§¡¨Ó 6Ó7€KÜ�6‰6�+ÔÜ�x‰x˜¤"§(¡(Ô+×3Ñ3°FÓ;Ð;ä*¨;Ð8IÐK[Ó\€FØ€~Ü�x‰x˜¤"§(¡(Ô+×3Ñ3°FÓ;Ð;àÑ€GˆYÜ�g“,€KØ—J‘J˜r �N�M€FˆEð 	× Ñ Ø˜aÑ Ø˜aÑ Øð 	!ó 	
ð
 ñ	ð ð 	× Ñ Ø˜QÑØ˜QÑØð 	!ó 	
ð
 ñ	ð ð   1Ñ$€LØ Ñ"€Kä�O‰Oà’A�q�D‰M˜KÑ'Ø’A�q�D‰M˜LÑ(Ø’A�q�D‰M˜KÑ'Ø’A�q�D‰M˜LÑ(ð		
ó÷ �fŒR�X‰XÓð 
ô —'‘'˜%¢ 1 ™+ q¨%°!©)Ó4€EŠ!ˆQˆ$�KÜ—'‘'˜%¢ 1 ™+ q¨&°1©*Ó5€EŠ!ˆQˆ$�KÜ—'‘'˜%¢ 1 ™+ q¨%Ó0€EŠ!ˆQˆ$�KÜ—'‘'˜%¢ 1 ™+ q¨&Ó1€EŠ!ˆQˆ$�Kð š˜A˜‘; ¢q¨! t¡Ñ,¨qÑ0°Uº1¸a¸4±[À5ÊÈAÈÁ;Ñ5NÐQRÑ5RÑS€KØ�ÑÐr   )r   )r   ú
np.ndarrayr   z"int | tuple[int, ...] | np.ndarrayr   ztuple[float, ...] | floatÚreturnr  )r"   znp.dtyper,   ztuple[int, ...]r-   únp.random.Generatorr  r  )r   r  r@   r  rA   ra   r  r  )r   r  r@   r  r   r  r  r  )rP   r  r@   r  r   r  r  r  )rS   r  r@   r  r   r  r  r  )
r   r  r@   r  r-   r  r)   Úboolr  r  )
rP   r  r@   r  r-   r  r)   r  r  r  )
rS   r  r@   r  r-   r  r)   r  r  r  )
r   r  r@   r  r   ú^tuple[float, ...] | float | Literal['random', 'random_uniform', 'inpaint_telea', 'inpaint_ns']r-   r  r  r  )
rP   r  r@   r  r   r  r-   r  r  r  )
rS   r  r@   r  r   r  r-   r  r  r  )rv   r  r@   r  r  r  )r�   r  rŽ   r  r  r  )r„   r  r@   r  r£   útuple[int, int]r¤   rk   r¥   rk   r  r  )
r£   r  r³   útuple[int, int] | Noner´   r  r-   r  r  r  )r£   r  rÁ   r  rÂ   rk   rÃ   r  rÄ   r  r-   r  r  r  )r„   r  rÐ   r  r£   r  r¤   rk   r¥   rk   r  r  )rv   r  rÐ   r  r  r  )Fr0   )rC   r  rá   r  rÜ   rj   r  z#np.ndarray | tuple[np.ndarray, int])rí   r  rî   rj   rï   útuple[float, float]rð   r  r-   r  r  r  )rC   r  rý   rj   r-   r  r  z$tuple[np.ndarray, np.ndarray] | None)rC   r  r  rj   r  z	list[int]rï   r  rð   r  r-   r  r  r  ).Ú__doc__Ú
__future__r   Útypingr   r   r7   Únumpyr$   Úalbucorer   r   r   r	   r
   r   Ú1albumentations.augmentations.geometric.functionalr   Ú"albumentations.augmentations.utilsr   Ú$albumentations.core.type_definitionsr   Ú__all__r   r   rK   rN   rQ   rT   rW   rZ   r]   r   rr   ru   r   rŸ   r   r   r   rÔ   rÙ   rê   rö   r  r  rM   r   r   ú<module>r     sf  ðñõ #ç  ã 
Û ÷÷ õ QÝ AÝ Hò€ð ð '(ðØ	ðà8ðð $ðð ò	ó ðð6%4Øð%4àð%4ð *ð%4ð ó	%4ðP 
ò#5ó 
ð#5óLóóðØ	ðàðð *ðð ð	ð
 óð2Øðàðð *ðð ð	ð
 óð2Øðàðð *ðð ð	ð
 óð<59Ø	ð59àð59ð ið59ð *ð	59ð
 ó59ðp:CØð:Càð:Cð ið:Cð *ð	:Cð
 ó:Cðz<EØð<Eàð<Eð ið<Eð *ð	<Eð
 ó<Eñ~ �KÓ ò&ó !ð&ñ> �HÓð'bØð'bàð'bð ò'bó ð'bðT,@Øð,@àð,@ð !ð,@ð ð	,@ð
 ð,@ð ó,@ð^?#Ø ð?#à+ð?#ð ,ð?#ð *ð	?#ð
 ó?#ðDR9Ø ðR9à
ðR9ð ðR9ð ð	R9ð
 ðR9ð *ðR9ð óR9ñj �HÓð4Øð4àð4ð !ð4ð ð	4ð
 ð4ð ò4ó ð4ñn �KÓ ð'!Øð'!àð'!ð ò'!ó !ð'!ôT)<ðX/[Øð/[àð/[ð +ð/[ð *ð	/[ð
 *ð/[ð ó/[ðd'IØ
ð'Iàð'Ið *ð'Ið *ó	'IðT=Ø
ð=àð=ð ð=ð +ð	=ð
 *ð=ð *ð=ð ô=r   