Skip to content

Commit

Permalink
Introduce pathname patterns to CLI (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
junxiant authored Jun 17, 2022
1 parent 02b3ab5 commit 42b09a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ pip install stitching

## Usage

The command line interface ([cli](https://github.com/lukasalexanderweber/stitching/tree/main/stitching/cli/stitch.py)) is available after installation

`stitch -h` show the help

`stitch *` stitches all files in the actual dir

`stitch img_dir/IMG*.jpg` stitches all files in the img_dir directory starting with "IMG" and ending with ".jpg"

`stitch img1.jpg img2.jpg img3.jpg`
stitches the 3 explicit files of the current dir

Or use the Stitcher class in your script

```python
import stitching

Expand All @@ -30,13 +43,6 @@ panorama = stitcher.stitch(["img1.jpg", "img2.jpg", "img3.jpg"])

```

or using the command line interface ([cli](https://github.com/lukasalexanderweber/stitching/tree/main/stitching/cli/stitch.py)) which is available after installation

```bash
stitch -h
stitch img1.jpg img2.jpg img3.jpg
```

## Tutorial

This package provides utility functions to deeply analyse what's
Expand Down
6 changes: 5 additions & 1 deletion stitching/cli/stitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"""

import argparse
import glob

import cv2 as cv
import numpy as np
import numpy as

from stitching import Stitcher
from stitching.blender import Blender
Expand All @@ -24,6 +25,7 @@

parser = argparse.ArgumentParser(prog="stitch.py")
parser.add_argument("img_names", nargs="+", help="Files to stitch", type=str)

parser.add_argument(
"--medium_megapix",
action="store",
Expand Down Expand Up @@ -252,6 +254,8 @@ def main():

# Extract In- and Output
img_names = args_dict.pop("img_names")
if len(img_names) == 1:
img_names = glob.glob(img_names[0])
img_names = [cv.samples.findFile(img_name) for img_name in img_names]
preview = args_dict.pop("preview")
output = args_dict.pop("output")
Expand Down

0 comments on commit 42b09a0

Please sign in to comment.