_ImageSchema

class pyspark.ml.image._ImageSchema[source]

Internal class for pyspark.ml.image.ImageSchema attribute. Meant to be private and not to be instantized. Use pyspark.ml.image.ImageSchema attribute to access the APIs of this class.

Methods

Attributes

Methods Documentation

toImage(array, origin='')[source]

Converts an array with metadata to a two-dimensional image.

Parameters
  • array (numpy.ndarray) – The array to convert to image.

  • origin (str) – Path to the image, optional.

Returns

a Row that is a two dimensional image.

New in version 2.3.0.

toNDArray(image)[source]

Converts an image to an array with metadata.

Parameters

image (Row) – A row that contains the image to be converted. It should have the attributes specified in ImageSchema.imageSchema.

Returns

a numpy.ndarray that is an image.

New in version 2.3.0.

Attributes Documentation

columnSchema

Returns the schema for the image column.

Returns

a StructType for image column, struct<origin:string, height:int, width:int, nChannels:int, mode:int, data:binary>.

New in version 2.4.0.

imageFields

Returns field names of image columns.

Returns

a list of field names.

New in version 2.3.0.

imageSchema

Returns the image schema.

Returns

a StructType with a single column of images named “image” (nullable) and having the same type returned by columnSchema().

New in version 2.3.0.

ocvTypes

Returns the OpenCV type mapping supported.

Returns

a dictionary containing the OpenCV type mapping supported.

New in version 2.3.0.

undefinedImageType

Returns the name of undefined image type for the invalid image.

New in version 2.3.0.