Image Processing with NumPy (2)

NumPy is Numerical Python.

  • NumPy reads an image as ndarray whose shape is (row (height), column (width), color (channel)).
  • convert('L') converts an image to grayscale whose shape is (row (height), column (width)).
  • Passing ndarray to Image.fromarray() returns PIL.Image.
  • A negative-positive inverted image can be generated by subtracting the pixel value from the max value (255 for uint8).
  • np.hsplit() splits ndarray horizontally.

Posted on July 15, 2021 Tags: