Skip to content

Commit

Permalink
example script
Browse files Browse the repository at this point in the history
  • Loading branch information
scottshambaugh committed Jul 3, 2024
1 parent 334e9af commit 59c13b5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

## [Unreleased]
### Added
* `examples/` directory for example scripts
### Changed
### Removed

Expand Down
24 changes: 24 additions & 0 deletions examples/stereo_square_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import matplotlib as mpl
from pathlib import Path
from mpl_stereo import StereoSquare2D

curr_dir = Path(__file__).parent

## User inputs
# data_dir = curr_dir
data_dir = curr_dir / '..' / 'src' / 'mpl_stereo' / 'data'
image_left = data_dir / 'church_left.jpg'
image_right = data_dir / 'church_right.jpg'
output = curr_dir / 'output.gif'

## Plot the stereo square
data_left = mpl.image.imread(image_left)
data_right = mpl.image.imread(image_right)
stereosquare = StereoSquare2D()
stereosquare.imshow_stereo(data_left, data_right, crop=True)
stereosquare.fig.set_size_inches(8, 6)
stereosquare.fig.set_dpi(320)

## Save to file
stereosquare.wiggle(output)
print(f'Wrote {output}')

0 comments on commit 59c13b5

Please sign in to comment.