Some indexes and modify the image pixel point data and other operations, can print the observation of the running results.
#-*-Coding:utf-8-*-"" "Created on Wed Sep-00:11:07 2016@author:administrator" "" Import cv2import NumPy as np# length , 588;width,468img = Cv2.imread (' cute.jpg ') px = Img[100,100]print (px) # Accessing only blue pixel# remember b,g,rblue = img[ 100,100,0]print (blue) # Modify the pixelimg[100,100] = [255,255,255]# accesing RED valuep_item = Img.item (10,10,2) # Modyfy ing RED valuepp_item = img.itemset ((10,10,2), (+) # length width 3p_shape = img.shape# length*width*3p_size = img.size# dat A typep_dtype = img.dtype# Image roi# copy one area to another area ball = img[280:340,330:390]img[273:333,100:160] = ballcv2.imshow (' Image ', img) k = cv2.waitkey (0) If k = = 27:cv2.destroyallwindows () # Splitting and merging Image channelsb,g,r = Cv2.split (img # costlyimg = Cv2.merge ((b,g,r)) b = img[:,:,0] # blue# make all the red pixels to zeroimg[:,:,0] = 0
Python opencv--modifying