小编Rah*_*Rao的帖子

cv2.waitkey(1)未在opencv python中运行

我需要使用cv2了解python中的cv2.waitkey()

faceCascade = cv2.CascadeClassifier(cascPath)

video_capture = cv2.VideoCapture(0)

while True:
    # Capture frame-by-frame
ret, frame = video_capture.read()

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

faces = faceCascade.detectMultiScale(
    gray,
    scaleFactor=1.1,
    minNeighbors=8,
    minSize=(40, 40),
    #flags=cv2.cv.CV_HAAR_SCALE_IMAGE
    flags = 0
)   

# Draw a rectangle around the faces
for (x, y, w, h) in faces:
    cv2.rectangle(gray, (x, y), (x+w, y+h), (0, 255, 0), 2)

# Display the resulting frame
cv2.imshow('Video', gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
    break
if cv2.waitKey(1) & 0xFF == ord('b'):
    cv2.imwrite('example.png',gray)
Run Code Online (Sandbox Code Playgroud)

cv2.waitKey()当我按b时不保存图片,但按q可以。请帮忙!

python opencv opencv3.0

4
推荐指数
1
解决办法
1940
查看次数

click()在硒中不起作用

我目前正在将selenium与python一起使用,并且我的webdriver是Firefox,我尝试了click事件,但是它不起作用

网站= www.cloudsightapi.com/api

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
import time
from selenium.webdriver.common.action_chains import ActionChains

import os
driver = webdriver.Firefox()
driver.get("http://cloudsightapi.com/api")

wait = WebDriverWait(driver, 10)
element = wait.until(EC.element_to_be_clickable((By.ID, "dropzoneTarget")))
element.click()
Run Code Online (Sandbox Code Playgroud)

请帮忙 !!

python selenium

1
推荐指数
1
解决办法
4014
查看次数

标签 统计

python ×2

opencv ×1

opencv3.0 ×1

selenium ×1