Skip to content

cva

CVA

Bases: MetaAlgo

Calculate change vectors

Builds a change map by calculating the amplitude map of the change vectors

Source code in changedet/algos/cva.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
@AlgoCatalog.register("cva")
class CVA(MetaAlgo):
    """
    Calculate change vectors

    Builds a change map by calculating the amplitude map of the change vectors
    """

    @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
        """
        distance = flags.get("distance", "euclidean")
        logger = flags["logger"]

        assert distance in ["euclidean", "manhattan"]

        # Calculate change vectors
        logger.info("Calculating change vectors")
        mag, theta = calc_cvs(im1, im2, distance)
        bcm = appy_threshold(mag)

        return bcm

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/cva.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
@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
    """
    distance = flags.get("distance", "euclidean")
    logger = flags["logger"]

    assert distance in ["euclidean", "manhattan"]

    # Calculate change vectors
    logger.info("Calculating change vectors")
    mag, theta = calc_cvs(im1, im2, distance)
    bcm = appy_threshold(mag)

    return bcm