pysdic.Image.from_array#
- classmethod Image.from_array(image_data)[source]#
Create an
Imageobject from raw image data.Note
The image will be automatically converted to a floating point format
numpy.float64for 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
Imageobject initialized with the provided image data.- Return type:
Examples
Create an
Imageobject 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)