image-stitcher
Python library for general mass image stitching.
Setup
pip install image-stitcher
Usage
An example can be found in tests/.
Arbitrary stitching
Relations in an arbitrarily arranged set of images are automatically determined. Each related collection found is stitched together.
import os
from image_stitcher.stitcher import ArbitraryStitcher
dir_path = "path/to/dir"
filepaths = [os.path.join(dir_path, f) for f in os.listdir(dir_path)]
arbs = ArbitraryStitcher(
log_level = 2,
output_dir = "stitches/",
min_match_count = 5,
lowes_ratio_threshold = 0.65,
algorithm = 0,
matcher = 0,
type = 0,
resize = None,
consecutive_range = None,
blend_processor = lambda x: x,
blender = 1,
ref_image_contrib = 0.2,
images = None,
filepaths = dir_path,
with_tqdm = True
)
collections = arbs.get_collections()
stitched = arbs.stitch_collections(collections)
Consecutive stitching
- Images are sequentially stitched without pre-determining relations in the large set.
- Optimizations coded in allow this to stitch HD images at 5Hz and SD images at up to 10Hz. Suitable for applications such as live aerial drone mapping.
import os
from image_stitcher.stitcher import ConsecutiveStitcher
dir_path = "path/to/dir"
filepaths = [os.path.join(dir_path, f) for f in os.listdir(dir_path)]
def load_image(filepath, to_resize = None):
image = cv2.imread(filepath)
return resize_image(image, to_resize)
cons = ConsecutiveStitcher(
log_level = 2,
output_dir = "stitches/",
min_match_count = 5,
lowes_ratio_threshold = 0.65,
algorithm = 0,
matcher = 0,
type = 0,
resize = None,
consecutive_range = None,
blend_processor = lambda x: x,
blender = 1,
ref_image_contrib = 0.2,
consecutive_range = 1,
backup_interval = False,
consecutive_volatility_threshold = 4,
)
for filepath in filepaths:
cons.stitch_consecutive(load_image(filepath))
Synchronous stitching
Consecutively stitches a second set of images using the same transformations calculated when stitching the first set. Can be used to stitch depth images from corresponding RGB images.
from image_stitcher.stitcher import ConsecutiveStitcher
class SynchronizedStitcher:
def __init__(self, rgb_args=None, depth_args=None, points=None):
self.rgb_stitcher = ConsecutiveStitcher(**rgb_args)
self.depth_stitcher = ConsecutiveStitcher(**depth_args)
def stitch(self, rgb_image, depth_image = None):
first_stitch = self.rgb_stitcher.stitch_count == 0
tf = self.rgb_stitcher.stitch_consecutive(rgb_image)
if not (depth_image is None):
if not first_stitch:
if self.rgb_stitcher.stitch_count > self.depth_stitcher.stitch_count:
self.depth_stitcher.save_and_reset()
self.depth_stitcher.stitch_consecutive(depth_image, tf)
return tf
sync_st = SynchronizedStitcher(
rgb_args={
"output_dir": "path/to/rgbdir",
"matcher": 1,
"algorithm": 1,
"backup_interval": 50,
"consecutive_range": 2,
"blender": 1,
"log_level": 2
},
depth_args={
"output_dir": "path/to/depthdir",
# "blend_processor": lambda x: utils.color_map(x),
"backup_interval": 50,
"blender": 0,
"ref_image_contrib": 0.5,
"log_level": 2
}
)
Metadata
Release files for image-stitcher 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| image_stitcher-0.9.1.tar.gz | 13.3 kB | Without provenance | Details for image_stitcher-0.9.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| image_stitcher-0.9.1-py3-none-any.whl | Python 3 | none | any | Details for image_stitcher-0.9.1-py3-none-any.whl |
Total release size: 25.7 kB
Release files / image_stitcher-0.9.1.tar.gz
| Download URL | image_stitcher-0.9.1.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a63ff6c3615b624c2a698fbd5cea0fe6b7d80aa943dc066f7b39971f34c334be
|
|
BLAKE2b-256 checksum How to use checksums |
76ea7f33784ce9e89048e1bac3ac1046b04bc54062192bfe0e6a4312cfc71c76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Release files / image_stitcher-0.9.1-py3-none-any.whl
| Download URL | image_stitcher-0.9.1-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e92a0da0953ba284dddb49befbf1d354a0d521cba754c9ec954bcb4dfcfcf10a
|
|
BLAKE2b-256 checksum How to use checksums |
ef9533bd86801715158a343b2881038dfc4de16696e64e1528807acfbe5c2813
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Security for image-stitcher 0.9.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.