U
    ?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|| }n|dkrRd||  }n|dkr|j \}}t||fd}	t||d  }
t||d  }tt|d t|d D ]D\}}|| d	 dkrd
|	||
 |d |
 || |d | f< qt	|}||	 ||	< ||	  ||	 < ntd|S )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      ?ZcheckerboardFr   r      TzKWrong value for `method`. Must be either "diff", "blend" or "checkerboard".)
shape
ValueErrorr   npabsfullintr   rangeZ
zeros_like)Zimage1Zimage2methodr   Zimg1Zimg2Z
comparisonZshapexZshapeymaskZstepxZstepyij r   F/var/www/html/venv/lib/python3.8/site-packages/skimage/util/compare.pycompare_images   s*    

".
r   )r   )numpyr   Zdtyper   	itertoolsr   r   r   r   r   r   <module>   s   