| 
 | 
 
 
首先打開youtube影片 
 
 
 
 
 
視窗化並縮小到右側 
我的桌面解析度是1600 * 900 
在jupyter notebook輸入代碼 
- from PIL import ImageGrab
 
 - import numpy as np
 
 - import cv2
 
  
- img = ImageGrab.grab(bbox=(1200,100,1600,700)) #bbox specifies specific region (bbox= x,y,width,height *starts top-left)
 
 - img_np = np.array(img) #this is the array obtained from conversion
 
 - frame = cv2.cvtColor(img_np, cv2.COLOR_BGR2GRAY) #擷取寬度 1200-1600 高度 100-700的灰階圖片
 
 - cv2.imshow("test", frame) #秀出擷取圖片並顯示框架標題
 
 - cv2.waitKey(0)
 
 - cv2.destroyAllWindows()
 
  複製代碼 
 
 
結果圖 
 
 
 
網頁設計,網站架設 ,網路行銷,網頁優化,SEO - NetYea 網頁設計 
 
 |   
 
 
 
 |