【发布时间】:2020-01-15 23:01:17
【问题描述】:
我已经关注this tutorial 并设法进行了面部检测,年龄+性别就像this video 一样
现在我面临的问题是应用程序的窗口大小非常小,我不知道也找不到调整大小的方法(in this image 右下角你可以看到窗口)。
申请代码可以是found here
【问题讨论】:
标签: opencv resize window raspbian face-detection
我已经关注this tutorial 并设法进行了面部检测,年龄+性别就像this video 一样
现在我面临的问题是应用程序的窗口大小非常小,我不知道也找不到调整大小的方法(in this image 右下角你可以看到窗口)。
申请代码可以是found here
【问题讨论】:
标签: opencv resize window raspbian face-detection
解决方案无论您为实时摄像头设置大小、、、opencv 调整窗口大小
import cv2
def main():
windowName = "Main"
cv2.namedWindow(windowName)
cap = cv2.VideoCapture(0)
print('Width :' + str(cap.get(3)))
print('Height :' + str(cap.get(4)))
cap.set(3, 620)
cap.set(4, 720)
if cap.isOpened():
ret, frame = cap.read()
else:
ret = False
while ret:
ret, frame = cap.read()
output = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow(windowName, frame)
if cv2.waitKey(1) == 27:
break
cv2.destroyAllWindow()
cap.release()
if __name__== "__main__":
main()
【讨论】:
import cv2
def main():
windowName = "Main"
cv2.namedWindow(windowName)
cap = cv2.VideoCapture(0)
print('Width :' + str(cap.get(3)))
print('Height :' + str(cap.get(4)))
cap.set(3, 620)
cap.set(4, 720)
if cap.isOpened():
ret, frame = cap.read()
else:
ret = False
while ret:
ret, frame = cap.read()
output = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow(windowName, frame)
if cv2.waitKey(1) == 27:
break
cv2.destroyAllWindow()
cap.release()
if __name__== "__main__":
main()
【讨论】: