machinevisiontoolbox.Image.view1d

Image.view1d()

Convert image to a column view

Returns:

column view

Return type:

ndarray(N,) or ndarray(N, np)

A greyscale image is converted to a 1D array in row-major (C) order, ie. row 0, row 1 etc.

A color image is converted to a 2D array in row-major (C) order, with one row per pixel, and each row is the pixel value, the values of its planes.

Example:

>>> from machinevisiontoolbox import Image
>>> Image.Read('street.png').view1d().shape
(1089280,)
>>> Image.Read('monalisa.png').view1d().shape
(473900, 3)
Note:

This creates a view of the original image, so operations on the column will affect the original image.