opencv python版-lesson 07

零碎知识点

import cv2
import numpy as np
img=cv2.imread('opencv.jpg')
b,g,r=cv2.split(img)
img=cv2.merge(b,g,r)   #有问题
px=img[100,100]
px=[255.255,255]
print(px)
blue=img[100,100,0]
print(blue)
print(img.item(10,10,2))
img.itemset((10,10,2),100)
print(img.item(10,10,2))
print(img.shape)
print(img.size)
print(img.dtype)
ball = img[300:340,330:390]
img[273:333,100:160]=ball


while(1):
    cv2.imshow('image',img)
    k=cv2.waitKey(1)&0xFF
    if k==ord('m'):
        mode=not mode
    elif k==27:
        break

你可能感兴趣的:(opencv python版-lesson 07)