Skip to content

Commit

Permalink
Merge pull request #175 from UBC-MDS/docs-readme-tutorial
Browse files Browse the repository at this point in the history
fix: Feedback addressed by Archer - Updated image loading instruction to use Pillow
  • Loading branch information
Arc-Celt authored Feb 3, 2025
2 parents 4117b57 + 9cd1fd0 commit e656d88
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 12 deletions.
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,15 @@ To harness the image processing magic of SharpEdge, follow these steps:
from sharpedge import seam_carve
```

2. (Optional) Load your image as a NumPy array.
2. (Optional) Load your image as a NumPy array (if it isn't already).

```python
# Ensure that you have matplotlib and numpy installed in your environment
import matplotlib.pyplot as plt
# Ensure that you have Pillow and numpy installed in your environment
from PIL import Image
import numpy as np

# Load the image from the given path
img = plt.imread(PATH_TO_IMAGE)

# Only execute this conversion for functions other than seam_carve
# Convert the loaded image to the range [0, 255] and cast it to np.uint8
# This is necessary for processing images with most functions, but 'seam_carve' handles float inputs directly
img = np.round(np.clip(img * 255, 0, 255)).astype(np.uint8)
img = np.array(Image.open(PATH_TO_IMAGE))
```

3. Process your images using the available functions:
Expand Down
Loading

0 comments on commit e656d88

Please sign in to comment.