o
    ðËhã  ã                   @   s4   d dl ZddlmZ d dlmZ d
ddœdd	„ZdS )é    Né   )Úimg_as_float)ÚproductÚdiff)é   r   )Ún_tilesc                C   s*  | j |j kr
tdƒ‚t| ƒ}t|ƒ}|dkrt || ¡}|S |dkr+d||  }|S |dkr‘|j \}}t ||fd¡}	t||d  ƒ}
t||d  ƒ}tt|d ƒt|d ƒƒD ]"\}}|| d	 dkr{d
|	||
 |d |
 …|| |d | …f< qYt 	|¡}||	 ||	< ||	  ||	 < |S tdƒ‚)a{  
    Return an image showing the differences between two images.

    .. versionadded:: 0.16

    Parameters
    ----------
    image1, image2 : 2-D array
        Images to process, must be of the same shape.
    method : string, optional
        Method used for the comparison.
        Valid values are {'diff', 'blend', 'checkerboard'}.
        Details are provided in the note section.
    n_tiles : tuple, optional
        Used only for the `checkerboard` method. Specifies the number
        of tiles (row, column) to divide the image.

    Returns
    -------
    comparison : 2-D array
        Image showing the differences.

    Notes
    -----
    ``'diff'`` computes the absolute difference between the two images.
    ``'blend'`` computes the mean value.
    ``'checkerboard'`` makes tiles of dimension `n_tiles` that display
    alternatively the first and the second image.
    z Images must have the same shape.r   Úblendg      à?ÚcheckerboardFr   r   é   TzKWrong value for `method`. Must be either "diff", "blend" or "checkerboard".)
ÚshapeÚ
ValueErrorr   ÚnpÚabsÚfullÚintr   ÚrangeÚ
zeros_like)Úimage1Úimage2Úmethodr   Úimg1Úimg2Ú
comparisonÚshapexÚshapeyÚmaskÚstepxÚstepyÚiÚj© r    úO/var/www/html/scripts/venv/lib/python3.10/site-packages/skimage/util/compare.pyÚcompare_images   s0   ðò
",€
þr"   )r   )Únumpyr   Údtyper   Ú	itertoolsr   r"   r    r    r    r!   Ú<module>   s    