나는 열 화상 카메라에서 나오는 데이터를 내보내려고하지만 난라는 오류 메시지가파이썬 OpenCV의 cv2.VideoWriter 오류
error: /build/opencv-ISmtkH/opencv-2.4.9.1+dfsg/modules/highgui/src/cap_ffmpeg.cpp:238: error: (-215) image->depth == 8 in function writeFrame
사람이 내가 뭘하는지보고 나에게 무엇을 말할 수 내가 잘못하고있어? 나는이 오류가 무엇을 의미하는지, 왜 그런지 이해하지 못한다.
o = camera.add_overlay(np.getbuffer(a), size=(320,240), layer=3, alpha=int(alpha), crop=(0,0,80,60), vflip=flip_v)
filename = time.strftime("%Y.%m.%d %H.%M.%S", time.localtime()) + ".avi"
fourcc = cv2.cv.CV_FOURCC('I','4','2','0')
out = cv2.VideoWriter(filename, fourcc, fps, (width, height))
try:
time.sleep(0.2) # give the overlay buffers a chance to initialize
with Lepton(device) as l:
last_nr = 0
while True:
_,nr = l.capture(lepton_buf)
out.write(lepton_buf)
if nr == last_nr:
# no need to redo this frame
continue
last_nr = nr
cv2.normalize(lepton_buf, lepton_buf, 0, 65535, cv2.NORM_MINMAX)
np.right_shift(lepton_buf, 8, lepton_buf)
a[:lepton_buf.shape[0], :lepton_buf.shape[1], :] = lepton_buf
o.update(np.getbuffer(a))
except Exception:
traceback.print_exc()
finally:
camera.remove_overlay(o)
오류는 없지만 출력되는 파일은 항상 손상되었습니다. 왜 그런가? –
부패한다는 것은 무엇을 의미합니까? – jlarsch
또한 버퍼가 비어 있지 않도록'out.release()'문이 누락되었습니다. –