
    h~                       S r SSKJr  SSKrSSKJr  SSKJrJrJ	r	J
r
  SSKJr  SSKrSSKrSSKJs  Js  Jr  SSKJr  SSKJrJr  SS	KJrJrJr  SS
KJr  SSK J!r!  SSK"J#r#J$r$   " S S\	5      r%          SS jr&            SS jr'          S S jr(        S!S jr)        S"S jr*        S#S jr+        S$S jr,        S%S jr-        S&S jr.                    S'S jr/      S(S jr0            S)S jr1                    S*S jr2      S+S jr3      S,S jr4g)-zFunctional implementations for image mixing operations.

This module provides utility functions for blending and combining images,
such as copy-and-paste operations with masking.
    )annotationsN)Sequence)AnyLiteral	TypedDictcast)warn)Crop)LongestMaxSizeSmallestMaxSize)BboxProcessordenormalize_bboxesnormalize_bboxes)Compose)KeypointsProcessor)$NUM_BBOXES_COLUMNS_IN_ALBUMENTATIONS'NUM_KEYPOINTS_COLUMNS_IN_ALBUMENTATIONSc                  B    \ rS rSr% SrS\S'   S\S'   S\S'   S\S'   S	rg
)ProcessedMosaicItem   zRepresents a single data item (primary or additional) after preprocessing.

Includes the original image/mask and the *preprocessed* annotations.

np.ndarrayimagenp.ndarray | Nonemaskbboxes	keypoints N)__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__r       h/var/www/fran/franai/venv/lib/python3.13/site-packages/albumentations/augmentations/mixing/functional.pyr   r      s!    
 
  r%   r   c                    Uu  pEU R                  5       n[        R                  " US:  5      nUUS   US   4   XgS   U-   US   U-   4'   U$ )a*  Blend images by copying pixels from an overlay image to a base image using a mask.

This function copies pixels from the overlay image to the base image only where
the mask has non-zero values. The overlay is placed at the specified offset
from the top-left corner of the base image.

Args:
    base_image (np.ndarray): The destination image that will be modified.
    overlay_image (np.ndarray): The source image containing pixels to copy.
    overlay_mask (np.ndarray): Binary mask indicating which pixels to copy from the overlay.
        Pixels are copied where mask > 0.
    offset (tuple[int, int]): The (y, x) offset specifying where to place the
        top-left corner of the overlay relative to the base image.

Returns:
    np.ndarray: The blended image with the overlay applied to the base image.

r      )copynpwhere)
base_imageoverlay_imageoverlay_maskoffsety_offsetx_offsetblended_imagemask_indicess           r&   copy_and_paste_blendr4   *   sk    0  HOO%M88L1,-LLYQQ	MMq/H,l1o.HHI r%   c                d   U u  pVUu  pxUu  pXW-  nXh-  nU
S-  nXS-   S-  -
  nU	S-  nXS-   S-  -
  nX-
  S-   nUU-
  S-   nUR                   " U6 nUR                   " U6 nU[        UU-  5      -   nU[        UU-  5      -   n[        U[        UU5      5      n[        U[        UU5      5      nUU4$ )aX  Calculates the center point for the mosaic crop using proportional sampling within the valid zone.

Ensures the center point allows a crop of target_size to overlap
all grid cells, applying randomness based on center_range proportionally
within the valid region where the center can lie.

Args:
    grid_yx (tuple[int, int]): The (rows, cols) of the mosaic grid.
    cell_shape (tuple[int, int]): Shape of each cell in the mosaic grid.
    target_size (tuple[int, int]): The final output (height, width).
    center_range (tuple[float, float]): Range [0.0-1.0] for sampling center proportionally
                                        within the valid zone.
    py_random (random.Random): Random state instance.

Returns:
    tuple[int, int]: The calculated (x, y) center point relative to the
                     top-left of the conceptual large grid.

   r(   )uniformintmaxmin)grid_yx
cell_shapetarget_sizecenter_range	py_randomrowscolscell_hcell_wtarget_htarget_wlarge_grid_hlarge_grid_wmin_cxmax_cxmin_cymax_cyvalid_wvalid_hrel_xrel_ycenter_xcenter_ys                          r&   calculate_mosaic_center_pointrR   M   s    4 JDNF$H=L=L ]F\a//F]F\a//F o!Gvo!G |,E|,E GeO,,HGeO,,H 63x01H63x01HXr%   c           
        U u  pEUu  pgUu  pUu  p[         R                  " US-   5      U-  n[         R                  " US-   5      U-  nXS-  -
  nXS-  -
  nX-   nX-   nSS jnU" XU5      nU" XU5      n[        U5      S-
  n[        U5      S-
  n/ n[        U5       Hh  nUU   nUUS-      n[        U5       HI  nUU   nUUS-      nUR	                  [        U5      [        U5      [        U5      [        U5      45        MK     Mj     U$ )a  Calculates placements by clipping arange-defined grid lines to the crop window.

Args:
    grid_yx (tuple[int, int]): The (rows, cols) of the mosaic grid.
    cell_shape (tuple[int, int]): Shape of each cell in the mosaic grid.
    target_size (tuple[int, int]): The final output (height, width).
    center_xy (tuple[int, int]): The calculated (x, y) center of the final crop window,
                                    relative to the top-left of the conceptual large grid.

Returns:
    list[tuple[int, int, int, int]]:
        A list containing placement coordinates `(x_min, y_min, x_max, y_max)`
        for each resulting cell part on the final output canvas.

r(   r6   c                b    [         R                  " XU5      n[         R                  " U5      U-
  $ )N)r*   clipunique)coordsmin_valmax_valclipped_coordss       r&   _clip_coords/calculate_cell_placements.<locals>._clip_coords   s(    ': yy(722r%   )rW   r   rX   r8   rY   r8   returnr   )r*   arangelenrangeappendr8   )r;   r<   r=   	center_xyr@   rA   rB   rC   rD   rE   rP   rQ   y_coords_largex_coords_large
crop_x_min
crop_y_min
crop_x_max
crop_y_maxr[   y_coords_clippedx_coords_clippednum_x_intervalsnum_y_intervalsresulty_idxy_miny_maxx_idxx_minx_maxs                                 r&   calculate_cell_placementsrt      s>   * JDNF$H"H YYtax(61NYYtax(61N M)JM)J&J&J3 $N
K#N
K *+a/O*+a/OF' ' +?+E$U+E$UQY/EMM3u:s5z3u:s5zJK , ( Mr%   c                J   Uc  US:X  a  ggU c  gU R                   nUR                   nX4:w  a'  SSU SU SU SU R                   S	UR                   3
4$ US
:X  aJ  U R                  S   nUR                  S   nXV:w  a'  SSU SU SU SU R                   S	UR                   3
4$ g)zFChecks if the dimensions and channels of item_data match primary_data.r   )Fz$Item is missing required key 'image')TNFzItem 'z' has z dimensions, but primary has z. Primary shape: z, Item shape:    z channels, but primary has )ndimshape)primary_data	item_datadata_keyprimary_ndim	item_ndimprimary_channelsitem_channelss          r&   _check_data_compatibilityr      s     w@   $$LI XJfYK/L\N [*001	?PR
 	

 q'--b1!+,
&7RScRd e""."4"4!5^IOOCTV  r%   c           
     "   [        U [        5      (       d  [        SU S3[        SS9  / $ / nUR	                  S5      nUR	                  S5      n[        U 5       H  u  pg[        U[        5      (       d  [        SU SU S	3[        S
S9  M2  SnSU4SU44 HW  u  pUR	                  U	5      n[        U
U[        SU	5      5      u  pU(       a  M8  SU SU SU	 SU 3n[        U[        S
S9  Sn  O   U(       d  M  UR                  U5        M     U$ )zVFilters a list of metadata dicts, keeping only valid ones based on data compatibility.zMetadata under key 'zU' is not a Sequence (e.g., list or tuple). Returning empty list for additional items.rv   )
stacklevelr   r   zItem at index z in 'z$' is not a dict and will be skipped.   TLiteral['image', 'mask']z%' skipped due to incompatibility in 'z': F)

isinstancer   r	   UserWarningget	enumeratedictr   r   ra   )metadata_inputmetadata_key_namedatavalid_itemsprimary_imageprimary_maskiitemitem_is_valid
target_keyprimary_target_dataitem_target_datais_compatible	error_msgmsgs                  r&   filter_valid_metadatar      sZ    nh//"#4"5 69 :		
 	KHHW%M88F#L^,$%% 5):(;;_`
 m$\"0
+J  $xx
3'@# /<($M !=$QCu->,? @..8\YKI  S+!4 %'0
* =t$A -D r%   c                0   U(       d  0 $ [        US S9nUS0nU Vs/ s H  oUU:w  d  M
  UPM     nn[        [        SU 5      5      nUR                  U5        [	        [        U5      [        U5      5      n[        U5       H  n	Xy   XFU	   '   M     U$ s  snf )a  Assigns item indices to placement coordinate tuples.

Assigns the primary item (index 0) to the placement with the largest area,
and assigns the remaining items (indices 1 to num_items-1) randomly to the
remaining placements.

Args:
    num_items (int): The total number of items to assign (primary + additional + replicas).
    cell_placements (list[tuple[int, int, int, int]]): List of placement
                            coords (x1, y1, x2, y2) for cells to be filled.
    py_random (random.Random): Random state instance.

Returns:
    dict[tuple[int, int, int, int], int]: Dict mapping placement coords (x1, y1, x2, y2)
                                        to assigned item index.

c                0    U S   U S   -
  U S   U S   -
  -  $ )Nr6   r   rv   r(   r   )rW   s    r&   <lambda>,assign_items_to_grid_cells.<locals>.<lambda>C  s#    F1Iq	1fQi&)6KLr%   )keyr   r(   )r9   listr`   shuffler:   r_   )
	num_itemscell_placementsr?   primary_placementplacement_to_item_indexrW   remaining_placementsremaining_item_indicesnum_to_assignr   s
             r&   assign_items_to_grid_cellsr   '  s    , 	 L 	1E
 2A`vN_D_F` "%9"56,-0137M3NOM=!;Q;TQ 78 " #" as
   	BBc                   U R                  U5      nU(       a  X ;   a  U R                  U5      b  UR                  R                  nU(       aT  U Vs/ s H  oUU ;  d  M
  UPM     sn(       a5  [        SU S[	        UR                  5      R
                   SU SU S3	5      eSU S   X U   0nU(       a  U H  nXP;   d  M
  X   Xe'   M     UR                  U5        UR                  U5      $ U$ s  snf )zIHelper to preprocess annotations (bboxes or keypoints) for a single item.zItem contains 'z' but is missing required label fields: {[field for field in required_labels if field not in item]}. Ensure all label fields declared in z (z+) are present in the item dictionary when 'z' is present.r   )r   paramslabel_fields
ValueErrortyper   
preprocess)r   	processorr|   original_datarequired_labelsfield	temp_datas          r&   _preprocess_item_annotationsr   X  s    HHX&M X%$((8*<*H#**77?X?%SWFW?X!( ,77;I<L<L7M7V7V6W X#$$OPXzYfh  T']8n
	 (='+{I$ ) 	Y'}}X&& 9  Ys   	C-C-c                    U (       d  / $ / nU  HE  n[        XAS5      n[        XBS5      nUS   UR                  S5      UUS.nUR                  U5        MG     U$ )a  Preprocesses bboxes/keypoints for selected raw additional items.

Iterates through items, preprocesses annotations individually using processors
(updating label encoders), and returns a list of dicts with original image/mask
and the corresponding preprocessed bboxes/keypoints.
r   r   r   r   r   r   r   r   )r   r   ra   )selected_raw_itemsbbox_processorkeypoint_processorresult_data_itemsr   processed_bboxesprocessed_keypointsprocessed_item_dicts           r&    preprocess_selected_mosaic_itemsr     ss     	35"7hW:4U`a ']HHV$&,	4
 	  !45 # r%   c                   U u  p4Uu  pVXS:  d  Xd:  a  [        SU SU  35      eUS:X  a	  XF-
  nX5-
  nOHUS:X  a  SnX5-
  nO;US:X  a  XF-
  nSnO.US:X  a  SnSnO#US:X  a  XF-
  S	-  nX5-
  S	-  nO[        S
U 35      eXv-   n	X-   n
XxX4$ )ap  Calculates crop coordinates positioned opposite to the specified cell_position.

Given a cell of `cell_size`, this function determines the top-left (x_min, y_min)
and bottom-right (x_max, y_max) coordinates for a crop of `crop_size`, such
that the crop is located in the corner or center opposite to `cell_position`.

For example, if `cell_position` is "top_left", the crop coordinates will
correspond to the bottom-right region of the cell.

Args:
    cell_size: The (height, width) of the cell from which to crop.
    crop_size: The (height, width) of the desired crop.
    cell_position: The reference position within the cell. The crop will be
        taken from the opposite position.

Returns:
    tuple[int, int, int, int]: (x_min, y_min, x_max, y_max) representing the crop coordinates.

Raises:
    ValueError: If crop_size is larger than cell_size in either dimension.

z
Crop size z! cannot be larger than cell size top_left	top_rightr   bottom_leftbottom_rightcenterr6   zInvalid cell_position: )r   )	cell_size	crop_sizecell_positionrB   rC   crop_hcrop_wrr   ro   rs   rp   s              r&   get_opposite_crop_coordsr     s    6 NFNF&/:i[0QR[Q\]^^ 
"	+	%	-	'	.	(	(	"Q&Q& 2=/BCC NENE%%r%   c	                   SS0n	UR                  S5      b  SS0U	S'   UR                  S5      b  SS0U	S'   [        XU5      n
US	:X  a/  [        [        U UUSS
9[	        U
S   U
S   U
S   U
S   S9/40 U	D6nOHUS:X  a3  [        [        U UUSS
9[	        U
S   U
S   U
S   U
S   SUUSS9/40 U	D6nO[        SU S35      eSUS   0nUR                  S5      b  US   US'   UR                  S5      b  US   US'   UR                  S5      b  US   US'   U" S0 UD6nUS   UR                  S5      UR                  S5      UR                  S5      S.$ )a  Applies geometric transformations (padding and/or cropping) to a single mosaic item.

Uses a Compose pipeline with PadIfNeeded and Crop to ensure the output
matches the target cell dimensions exactly, handling both padding and cropping cases.

Args:
    cell_shape: (tuple[int, int]): Shape of the cell.
    item: (ProcessedMosaicItem): The preprocessed mosaic item dictionary.
    target_shape: (tuple[int, int]): Target shape of the cell.
    fill: (float | tuple[float, ...]): Fill value for image padding.
    fill_mask: (float | tuple[float, ...]): Fill value for mask padding.
    fit_mode: (Literal["cover", "contain"]): Fit mode for the mosaic.
    interpolation: (int): Interpolation method for image.
    mask_interpolation: (int): Interpolation method for mask.
    cell_position: (Literal["top_left", "top_right", "center", "bottom_left", "bottom_right"]): Position
        of the cell.

Returns: (ProcessedMosaicItem): Dictionary containing the geometrically processed image,
    mask, bboxes, and keypoints, fitting the target dimensions.

pg      ?r   formatalbumentationsbbox_paramsr   keypoint_paramscover)max_size_hwinterpolationmask_interpolationr   r   r(   r6   rv   )rr   ro   rs   rp   containT)rr   ro   rs   rp   pad_if_neededfill	fill_maskr   zInvalid fit_mode: z. Must be 'cover' or 'contain'.r   r   r   r   )r   r   r   r   r
   r   r   )r<   r   target_shaper   r   fit_moder   r   r   compose_kwargscrop_coordsgeom_pipeline
geom_inputprocessed_items                 r&   process_cell_geometryr     s   B '*3ZNxx%)13C(D}%xx(-57G,H()*:]SK7 *"/'9	 %a.%a.%a.%a.	
 
" 
Y	 *"/'9	 %a.%a.%a.%a."&'	
& '
, -hZ7VWXX 4=)Jxx#!&\
6xx%  $H~
8xx("&{"3
; #0Z0N
  (""6* $$X.#''4	 r%   c                d   Uu  p#  nSnSnU R                  S5      nUbu  [        R                  " U5      R                  S:  aQ  [        R                  " U5      n[        R                  " X#X#/[        R
                  S9n	[        R                  " X5      nU R                  S5      n
U
bq  [        R                  " U
5      R                  S:  aM  [        R                  " U
5      n[        R                  " X#S/UR                  S9n[        R                  " X5      nUUU S   U R                  S5      S.$ )	a  Shifts the coordinates of geometrically processed bboxes and keypoints.

Args:
    processed_item_geom: (ProcessedMosaicItem): The output from process_cell_geometry.
    placement_coords: (tuple[int, int, int, int]): The (x1, y1, x2, y2) placement on the final canvas.

Returns: (ProcessedMosaicItem): A dictionary with keys 'bboxes' and 'keypoints', containing the shifted
    numpy arrays (potentially empty).

Nr   r   dtyper   r   r   )r   r   r   r   )
r   r*   asarraysizearrayint32
fgeometricshift_bboxesr   shift_keypoints)processed_item_geomplacement_coordstgt_x1tgt_y1_shifted_bboxesshifted_keypointsbboxes_geombboxes_geom_arrbbox_shift_vectorkeypoints_geomkeypoints_geom_arrkp_shift_vectors                r&   shift_cell_coordinatesr   L  s    ,FAqN%))(3K2::k#:#?#?!#C**[1HHff%ERXXV#00T(,,[9N!bjj&@&E&E&IZZ7((FA#6>P>V>VW&667I[ !&$W-#''/	 r%   c                    Ub  UOSn[         R                  " XRS9n[         R                  " XUS9nU R                  5        H(  u  pU	R	                  U5      n
U
c  M  Uu  ppXX2X24'   M*     U$ )a  Assembles the final mosaic image or mask from processed cell data onto a canvas.

Initializes the canvas with the fill value and overwrites with processed segments.
Handles potentially multi-channel masks.
Addresses potential broadcasting errors if mask segments have unexpected dimensions.
Assumes input data is valid and correctly sized.

Args:
    processed_cells (dict[tuple[int, int, int, int], dict[str, Any]]): Dictionary mapping
        placement coords to processed cell data.
    target_shape (tuple[int, ...]): The target shape of the output canvas (e.g., (H, W) or (H, W, C)).
    dtype (np.dtype): NumPy dtype for the canvas.
    data_key (Literal["image", "mask"]): Specifies whether to assemble 'image' or 'mask'.
    fill (float | tuple[float, ...] | None): Value used to initialize the canvas (image fill or mask fill).
          Should be a float/int or a tuple matching the number of channels.
          If None, defaults to 0.

Returns:
    np.ndarray: The assembled mosaic canvas.

r   r   )
fill_valuer   )r*   r   fullitemsr   )processed_cellsr   r   r|   r   actual_fillr   canvasr   	cell_datasegmentr   r   tgt_x2tgt_y2s                  r&   $assemble_mosaic_from_processed_cellsr  s  s    : *$K +3J WW\FF (7'<'<'>#--) -=*FF3:6=&-/0 (? Mr%   c	                    0 n	UR                  5        H8  u  pX;   nU
u  pnnUU-
  nX-
  n[        X5      n[        UUUU4UUUUUUS9	X'   M:     U	$ )a  Processes the geometry (cropping/padding) for all assigned mosaic cells.

Iterates through assigned placements, applies geometric transforms via process_cell_geometry,
and returns a dictionary mapping final placement coordinates to the processed item data.
The bbox/keypoint coordinates in the returned dict are *not* shifted yet.

Args:
    canvas_shape (tuple[int, int]): The shape of the canvas.
    cell_shape (tuple[int, int]): Shape of each cell in the mosaic grid.
    placement_to_item_index (dict[tuple[int, int, int, int], int]): Mapping from placement
        coordinates (x1, y1, x2, y2) to assigned item index.
    final_items_for_grid (list[ProcessedMosaicItem]): List of all preprocessed items available.
    fill (float | tuple[float, ...]): Fill value for image padding.
    fill_mask (float | tuple[float, ...]): Fill value for mask padding.
    fit_mode (Literal["cover", "contain"]): Fit mode for the mosaic.
    interpolation (int): Interpolation method for image.
    mask_interpolation (int): Interpolation method for mask.

Returns:
    dict[tuple[int, int, int, int], ProcessedMosaicItem]: Dictionary mapping final placement
    coordinates (x1, y1, x2, y2) to the geometrically processed item data (image, mask, un-shifted bboxes/kps).

)	r<   r   r   r   r   r   r   r   r   )r   get_cell_relative_positionr   )canvas_shaper<   r   final_items_for_gridr   r   r   r   r   processed_cells_geomr   item_idxr   r   r   r  r  rD   rE   r   s                       r&   process_all_mosaic_geometriesr    s    d RT '>&C&C&E"#-)9&F??23CR 2G!"H-'1'
2
. 'F*  r%   c                    Uu  p#U u  pEpgUS-  nUS-  n	XF-   S-  n
XW-   S-  nX:  a  SnO
X:  a  SnOSnX:  a  SnO
X:  a  SnOSnSSS	S
S.n[        SUR                  X4S5      5      $ )aK  Determines the position of a cell relative to the center of the target canvas.

Compares the cell center to the canvas center and returns its quadrant
or "center" if it lies on or very close to a central axis.

Args:
    placement_coords (tuple[int, int, int, int]): The (x_min, y_min, x_max, y_max) coordinates
        of the cell.
    target_shape (tuple[int, int]): The (height, width) of the overall target canvas.

Returns:
    Literal["top_left", "top_right", "center", "bottom_left", "bottom_right"]:
        The position of the cell relative to the center of the target canvas.

g       @topbottomr   leftrightr   r   r   r   ))r  r  )r  r  )r  r  )r  r  ILiteral['top_left', 'top_right', 'center', 'bottom_left', 'bottom_right'])r   r   )r   r   rD   rE   x1y1x2y2canvas_center_xcanvas_center_ycell_center_xcell_center_yv_posh_posposition_maps                  r&   r  r    s    & &H%NBBnOnOWOMWOM &		( &		( $%)+	L S%2 r%   c                h   0 nUu  p4U R                  5        GH  u  pVUSS u  pxUS   US   -
  n	US   US   -
  n
UR                  S5      nUR                  S5      nUS   UR                  S	5      S
.nUb  UR                  S:  at  [        R                  " U5      n[        XU	S.5      n[        R                  " XxXx/[        R                  S9n[        R                  " UU5      n[        UX4S.5      nUUS'   O[        R                  " S[        45      US'   Ubd  UR                  S:  aT  [        R                  " U5      n[        R                  " XxS/UR                  S9n[        R                  " UU5      nUUS'   O[        R                  " S[        45      US'   [!        SU5      X%'   GM     U$ )a  Shifts coordinates for all geometrically processed cells.

Iterates through the processed cells (keyed by placement coords), applies coordinate
shifting to bboxes/keypoints, and returns a new dictionary with the same keys
but updated ProcessedMosaicItem values containing the *shifted* coordinates.

Args:
    processed_cells_geom (dict[tuple[int, int, int, int], ProcessedMosaicItem]):
         Output from process_all_mosaic_geometries (keyed by placement coords).
    canvas_shape (tuple[int, int]): The shape of the canvas.

Returns:
    dict[tuple[int, int, int, int], ProcessedMosaicItem]: Final dictionary mapping
    placement coords (x1, y1, x2, y2) to processed cell data with shifted coordinates.

Nr6   r   rv   r(   r   r   r   r   )r   r   )heightwidthr   r   )r   r   r   r*   r   r   r   float32r   r   r   emptyr   r   r   r   r   )r
  r  final_processed_cellscanvas_hcanvas_wr   cell_data_geomr   r   
cell_widthcell_heightr   r   final_cell_datar   bbox_denoramlizedr   shifted_bboxes_denormalizedr   r   r   r   s                         r&   shift_all_coordinatesr,  .  s   ( SU%H,@,F,F,H()"1-%a(+;A+>>
&q),<Q,?? %((2'++K8 $G,"&&v.
 "{'7'7!'; jj5O 2?eoDp q "&&)IQSQ[Q[ \*4*A*ABSUf*g'-.IV^KrsN(6OH%(*!5Y1Z([OH%%.*=*=*A!#N!; !hh':BTBZBZ[O * : :;M _+<OK(+-88Q8_4`+aOK(267Lo2^/O -IR ! r%   )
r,   r   r-   r   r.   r   r/   tuple[int, int]r]   r   )r;   r-  r<   r-  r=   r-  r>   ztuple[float, float]r?   random.Randomr]   r-  )
r;   r-  r<   r-  r=   r-  rb   r-  r]   list[tuple[int, int, int, int]])rz   r   r{   r   r|   r   r]   ztuple[bool, str | None])r   zSequence[dict[str, Any]] | Noner   strr   dict[str, Any]r]   list[dict[str, Any]])r   r8   r   r/  r?   r.  r]   $dict[tuple[int, int, int, int], int])r   r1  r   z)BboxProcessor | KeypointsProcessor | Noner|   zLiteral['bboxes', 'keypoints']r]   r   )r   r2  r   zBboxProcessor | Noner   zKeypointsProcessor | Noner]   list[ProcessedMosaicItem])r   r-  r   r-  r   r  r]   tuple[int, int, int, int])r<   r-  r   r   r   r-  r   float | tuple[float, ...]r   r6  r   Literal['cover', 'contain']r   r8   r   r8   r   r  r]   r   )r   r   r   r5  r]   r   )r   z/dict[tuple[int, int, int, int], dict[str, Any]]r   ztuple[int, ...]r   znp.dtyper|   r   r   z float | tuple[float, ...] | Noner]   r   )r  r-  r<   r-  r   r3  r	  r4  r   r6  r   r6  r   r7  r   Literal[cv2.INTER_NEAREST, cv2.INTER_NEAREST_EXACT, cv2.INTER_LINEAR, cv2.INTER_CUBIC, cv2.INTER_AREA, cv2.INTER_LANCZOS4, cv2.INTER_LINEAR_EXACT]r   r8  r]   4dict[tuple[int, int, int, int], ProcessedMosaicItem])r   r5  r   r-  r]   r  )r
  r9  r  r-  r]   r9  )5r"   
__future__r   randomcollections.abcr   typingr   r   r   r   warningsr	   cv2numpyr*   1albumentations.augmentations.geometric.functionalaugmentations	geometric
functionalr   -albumentations.augmentations.crops.transformsr
   -albumentations.augmentations.geometric.resizer   r   albumentations.core.bbox_utilsr   r   r   albumentations.core.compositionr   #albumentations.core.keypoints_utilsr   $albumentations.core.type_definitionsr   r   r   r4   rR   rt   r   r   r   r   r   r   r   r   r  r  r  r,  r   r%   r&   <module>rK     sv   #  $ 0 0  
  F F > Y ^ ^ 3 B	!) 	!      	 
  F::: !: &	:
 : :z::: !: 	:
 %:z%#% % '% 	%P5355 5 	5p.#.#4.# .# *	.#b)
)8) -) 	)X,( 2 	@9&9&9& ]9& 	9&xii
i "i $	i
 )i *i i i ]i iX$,$/$ $N/D/!/ / '	/
 +/ /dJ !J J  BJ  4	J 
 $J  )J  *J J "#J 4 :5J Z9/9!9 O9x@!N@!!@! :@!r%   