Skip to content

Commit

Permalink
feat: add utility functions for image loading and display in sharpedg…
Browse files Browse the repository at this point in the history
…e.py
  • Loading branch information
Arc-Celt committed Jan 10, 2025
1 parent c3bfa10 commit b4a39fc
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/sharpedge/sharpedge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
def load_image(path):
"""
Load an image from a specific path
and convert it to a numpy array.
Parameters
----------
path : str
The file path to the image.
Returns
-------
numpy.ndarray
The image data as a numpy array
with shape (height, width, channels).
Raises
------
FileNotFoundError
If the file path does not exist.
ValueError
If the file is not a valid image format.
Examples
--------
>>> img = load_image('image.jpg')
>>> print(img.shape)
(1280, 800, 3)
"""
pass


def display_image(img):
"""
Display the numpy array as an image.
Parameters
----------
img : numpy.ndarray
The image data as a numpy array
with shape (height, width, channels).
Raises
------
ValueError
If the file is not a valid numpy array.
Examples
--------
>>> img = load_image('image.jpg')
>>> display_image(img)
"""
pass

0 comments on commit b4a39fc

Please sign in to comment.