Chipping Services¶
geoembed.chipping.services
¶
Domain services for chipping logic — shared between all backends.
StrideService
¶
Shared domain logic for calculating chip overlaps.
Ensures chips cover the entire source image without gaps at the edges. Instead of padding (which adds fake data) or dropping edges (which loses data), this calculates the precise overlap so that the last chip aligns perfectly with the image edge.
calculate_optimal_overlap(image_dims, chip_dims)
staticmethod
¶
Calculate the minimal overlap required for full image coverage.
The algorithm determines the largest integer stride (step size) such that an integer number of steps exactly spans the remaining image dimension.
Formula: Overlap = Chip_Size - Stride
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_dims
|
tuple[int, int]
|
Dimensions of the source image (Width, Height). |
required |
chip_dims
|
tuple[int, int]
|
Dimensions of the desired chip (Width, Height). |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, int]
|
Tuple of (overlap_x, overlap_y) in pixels. |