Author: Howse, Joseph

  • loc 666 - imread() and imwrite() functions that support various file formats for still images. The supported formats vary by system but should always include the BMP format.

  • loc 677 - specify the mode of imread() to be CV_LOAD_IMAGE_COLOR (BGR), CV_LOAD_IMAGE_GRAYSCALE (grayscale), or CV_LOAD_IMAGE_UNCHANGED (either BGR or grayscale, depending on the file’s color space).

  • loc 680 - grayImage = cv2.imread(‘MyPic.png’, cv2.CV_LOAD_IMAGE_GRAYSCALE) cv2.imwrite(‘MyPicGray.png’, grayImage)

  • loc 694 - alternative to using an expression like image[0, 0] or image[0, 0] = 128, we may use an expression like image.item((0, 0)) or image.setitem((0, 0), 128).

  • loc 698 - Provided that an image has 8 bits per channel, we can cast it to a standard Python bytearray, which is one-dimensional: byteArray = bytearray(image)