aws.osml.photogrammetry.transforms module
- class aws.osml.photogrammetry.transforms.ProjectiveTransform(matrix_parameters: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])[source]
Bases:
object
This is a simple standalone projective transform class with an implementation that only depends on NumPy. There are equivalent classes in Open CV and Scikit Imaging but this class can be used when we don’t want to include those dependencies.
- forward(src_coords: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])[source]
Compute the forward src -> dst transformation for an array of source coordinates [[x, y], …]
- Parameters:
src_coords – the source coordinates
- Returns:
the array of transformed coordinates [[x’,y’], …]
- inverse(dst_coords: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])[source]
Compute the inverse, dst -> src, transformation for an array of destination coordinates [[x’, y’], …]
- Parameters:
dst_coords – the destination coordinates
- Returns:
the array of transformed coordinates [[x,y], …]
- classmethod estimate(src: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], dst: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) ProjectiveTransform [source]
This method takes a list of source and destination points [x, y] and then applies the least squares fit to estimate the projective transform matrix relating them. It then creates the ProjectiveTransform object using that matrices. Each list needs to contain at least 4 points.
- Parameters:
src – the source points
dst – the destination points
- Returns:
the projective transform