Skip to content

imgdiff

ImageDiff

Bases: MetaAlgo

Calculate difference map

Builds a change map by calculating the difference between image 1 & image 2

Source code in changedet/algos/imgdiff.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@AlgoCatalog.register("imgdiff")
class ImageDiff(MetaAlgo):
    """
    Calculate difference map

    Builds a change map by calculating the difference between image 1 & image 2
    """

    @classmethod
    def run(cls, im1: np.ndarray, im2: np.ndarray, **flags: Any) -> np.ndarray:
        """Run Image Differencing algorithm

        Args:
            im1 (np.ndarray): Image 1 array
            im2 (np.ndarray): Image 2 array
            **flags (dict): Flags for the algorithm
        """
        logger = flags["logger"]

        # Calculate difference map
        logger.info("Calculating difference map")
        diff = im1 - im2

        return diff

run(im1, im2, **flags) classmethod

Run Image Differencing algorithm

Parameters:

Name Type Description Default
im1 ndarray

Image 1 array

required
im2 ndarray

Image 2 array

required
**flags dict

Flags for the algorithm

{}
Source code in changedet/algos/imgdiff.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@classmethod
def run(cls, im1: np.ndarray, im2: np.ndarray, **flags: Any) -> np.ndarray:
    """Run Image Differencing algorithm

    Args:
        im1 (np.ndarray): Image 1 array
        im2 (np.ndarray): Image 2 array
        **flags (dict): Flags for the algorithm
    """
    logger = flags["logger"]

    # Calculate difference map
    logger.info("Calculating difference map")
    diff = im1 - im2

    return diff