使用PIL,我从实时帧Feed中抓取图像,如下所示,
frame = np.array(ImageGrab.grab(bbox=(0, 40, 1820, 1240)))
然后将其转换为blob,如下所示:
(h, w) = frame.shape[:2]
blob = cv2.dnn.blobFromImage(cv2.resize(frame, (300, 300)),
0.007843, (300, 300), 127.5)
# pass the blob through the network and obtain the detections and
# predictions
net.setInput(blob)
detections = net.forward()
我的问题是,在“ np.array(ImageGrab.grab(bbox =(0,40,1820,1240)))”之外,如何排除下面发布的区域,以便我的预测界面不会甚至浪费时间在这个地区?
startX > 1 & startX < 700 & startY > 1 & startY < 500 & endX > 1 & endX < 500 & endY > 1 & endY < 650:
我相信格式为(startX,startY,endX,endY)为(x,y,l,w)。