def from_ndarray(img: np.ndarray, mode: str) -> Image:
    """
    Convert an image loaded by cv2 as ndarray into towhee.types.Image.

    Args:
        img (`np.ndarray`):
            A image loaed by cv2 as ndarray.
        mode (`str`):
            The mode of the image.

    Returns:
        (`towhee.types.Image`)
            The image wrapepd as towhee Image.
    """
    # img_bytes = ndarray_img.tobytes()
    # img_width = ndarray_img.shape[1]
    # img_height = ndarray_img.shape[0]
    # img_channel = len(cv2.split(ndarray_img))

    t_img= Image(img, mode)

    return t_img
Convert an image loaded by cv2 as ndarray into towhee.types.Image.

Args:
img (`np.ndarray`):
A image loaed by cv2 as ndarray.
mode (`str`):
The mode of the image.

Returns:
(`towhee.types.Image`)
The image wrapepd as towhee Image.
towhee/utils/ndarray_utils.py