Python & OpenCV 图像基本操作
#! /usr/bin/env python
import cv
# some definitions
win_name = "Edge"
if __name__ == '__main__':
im = cv.LoadImage( "c:\\2maa.jpg", cv.CV_LOAD_IMAGE_COLOR)
gray = cv.CreateImage((im.width, im.height), 8, 1)
cv.CvtColor(im, gray, cv.CV_BGR2GRAY)
binary = cv.CreateImage((im.width, im.height), 8, 1)
cv.Threshold(gray, binary, 210, 255, cv.CV_THRESH_BINARY)
import cv
# some definitions
win_name = "Edge"
if __name__ == '__main__':
im = cv.LoadImage( "c:\\2maa.jpg", cv.CV_LOAD_IMAGE_COLOR)
gray = cv.CreateImage((im.width, im.height), 8, 1)
cv.CvtColor(im, gray, cv.CV_BGR2GRAY)
binary = cv.CreateImage((im.width, im.height), 8, 1)
cv.Threshold(gray, binary, 210, 255, cv.CV_THRESH_BINARY)