저는 Python opencv를 처음 사용합니다. 사람이 오류Python 프로그램에서 이미지를 캡처하는 중에 오류가 발생했습니다.
import cv
cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE)
camera_index = 1
capture = cv.CaptureFromCAM(camera_index)
def repeat():
global capture #declare as globals since we are assigning to them now global camera_index
frame = cv.QueryFrame(capture)
cv.ShowImage("w1", frame)
c = cv.WaitKey(100)
if(c=="n"): #in "n" key is pressed while the popup window is in focus
camera_index += 1 #try the next camera index
capture = cv.CaptureFromCAM(camera_index)
if not capture: #if the next camera index didn't work, reset to 0.
camera_index =1
capture = cv.CaptureFromCAM(camera_index)
while True:
repeat()
이 내가 무엇입니까 어떤 오류가 밖으로 정렬하는 데 도움 주실 래요 - 그것은 cv.CaptureFromCAM()
또는 cv.QueryFrame()
중 하나가 실패 것으로 보인다
OpenCV Error: Null pointer (NULL array pointer is passed) in cvGetMat, file /home/paraste/OpenCV-2.3.1/modules/core/src/array.cpp, line 2382
Traceback (most recent call last):
File "dualcamara.py", line 10, in <module>
img = cv.GetMat(cv.QueryFrame(capture), 500)
cv2.error: NULL array pointer is passed
안녕하세요. 회신 해 주셔서 감사합니다. CaptureFromCAM 함수는 16 진수 값을 반환하지만 QueryFrame 함수는 아무 것도 반환하지 않습니다. 카메라가 켜지지 않았다고 생각했는데, 나는 수동으로 치즈 명령을 사용하여 스위치를 켰지 만 리턴 값에는 변화가 없다. 내장 기능을 사용하여 카메라를 켜는 방법을 알려주십시오. 심지어 나는 함수를 사용하여 시도했다 cv2.VideoCapture.op 하지만 그것은 다음과 같은 오류로 끝납니다 : AttributeError : 'builtin_function_or_method'객체가 'open'속성이 없습니다. – parastenitk22f