cv2.imread()、cv2.imshow()、cv2.imwrite()

1. read an image

cv2.imread()

cv2.IMREAD_COLOR                1
cv2.IMREAD_GRAYSCALE            0
cv2.IMREAD.UNCHANGED            -1

2. code

# coding:utf-8
# coding:cp936
import numpy as py
import cv2
# windows 路径表示
photo = r'E:\python workspace\oschina\OpenCV-Python\Opencv-Python Tutorials\general.jpg'
# Load an color image in grayscale

# img = cv2.imread(photo)
img = cv2.imread(photo, 0)
print img

你可能感兴趣的:(OpenCV-Python,tutorials)