Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add utility functions for image loading and display in sharpedge.py #24

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading