第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Picamera 無法使用 Raspberry Pi 進(jìn)行人臉識(shí)別

Picamera 無法使用 Raspberry Pi 進(jìn)行人臉識(shí)別

繁星淼淼 2023-07-18 15:12:01
我的 picamera 通常工作正常,但是當(dāng)按照上面的帖子操作時(shí),我的 picamera 無法工作。這是我的源代碼:from imutils.video import VideoStreamimport argparseimport imutilsimport timeimport cv2import osap = argparse.ArgumentParser()ap.add_argument("-c", "--cascade", required=True,? ? help = "path to where the face cascade resides")ap.add_argument("-o", "--output", required=True,? ? help="path to output directory")args = vars(ap.parse_args())detector = cv2.CascadeClassifier(args["cascade"])print("[INFO] starting video stream...")#vs = VideoStream(src=0).start()?vs = VideoStream(usePiCamera=True).start()time.sleep(2.0)total = 0while True:? ? frame = vs.read()? ? orig = frame.copy()? ? frame = imutils.resize(frame, width=400)? ? rects = detector.detectMultiScale(? ? ? ? cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY), scaleFactor=1.1,?? ? ? ? minNeighbors=5, minSize=(30, 30))? ? for (x, y, w, h) in rects:? ? ? ? cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)? ? cv2.imshow("Frame", frame)? ? key = cv2.waitKey(1) & 0xFF?? ? if key == ord("k"):? ? ? ? p = os.path.sep.join([args["output"], "{}.png".format(? ? ? ? ? ? str(total).zfill(5))])? ? ? ? cv2.imwrite(p, orig)? ? ? ? total += 1? ? elif key == ord("q"):? ? ? ? breakprint("[INFO] {} face images stored".format(total))print("[INFO] cleaning up...")cv2.destroyAllWindows()vs.stop()當(dāng)我運(yùn)行這段代碼時(shí),[INFO] starting video stream...出現(xiàn)但攝像頭未出現(xiàn)在 Raspberry Pi 上;而且,當(dāng)我面對(duì)鏡頭時(shí),[INFO] {} face images stored?[INFO] cleaning up...出現(xiàn)。
查看完整描述

1 回答

?
繁星coding

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超4個(gè)贊

你能試試這個(gè)嗎?


import numpy as np

import cv2


cap = cv2.VideoCapture(0)


while(True):

    # Capture frame-by-frame

    ret, frame = cap.read()


    # Our operations on the frame come here

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)


    # Display the resulting frame

    cv2.imshow('frame',gray)

    if cv2.waitKey(1) & 0xFF == ord('q'):

        break


# When everything done, release the capture

cap.release()

cv2.destroyAllWindows()


查看完整回答
反對(duì) 回復(fù) 2023-07-18
  • 1 回答
  • 0 關(guān)注
  • 103 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)