1. 图片的读取和显示
#!/usr/bin/python # -*-coding:utf-8-*- """ @author: yugengde @contact: [email protected] @file : image.py @time: 2018/2/9 13:38 """ import cv2import sys if __name__ == ‘__main__‘: if len(sys.argv) > 1: image = cv2.imread(sys.argv[1], cv2.IMREAD_GRAYSCALE) # 灰度图片 # image = cv2.imread(sys.argv[1], cv2.IMREAD_ANYCOLOR) # image = cv2.imread(sys.argv[1], cv2.IMREAD_UNCHANGED) else: print(‘Usage: pthon first opencv2.py imageFile‘) cv2.imshow(‘image‘, image) cv2.waitKey(0) cv2.destroyAllWindows()