pysdic.Image.from_array#

classmethod Image.from_array(image_data)[source]#

Create an Image object from raw image data.

Note

The image will be automatically converted to a floating point format numpy.float64 for interpolation but it stores as unsigned integer internally to save memory.

Parameters:

image_data (ArrayLike) – The raw image data as a numpy array. The image must have a shape of (height, width) for grayscale images or (height, width, channels) for color images.

Returns:

An Image object initialized with the provided image data.

Return type:

Image

Examples

Create an Image object from a numpy array of image data.

1import numpy
2import cv2
3from pysdic import Image
4
5# Load an image using OpenCV
6image_data = cv2.imread("path_to_image.jpg")
7# Create an Image object from the raw data
8image = Image.from_array(image_data)