実際のところ
import pyrealsense2 as rs import numpy as np import cv2 conf = rs.config() width = 1280 height = 720 # 普通の描画 conf.enable_stream(rs.stream.infrared, 2, width, height, rs.format.y8, 30) pipe = rs.pipeline() profile = pipe.start(conf) backSub = cv2.createBackgroundSubtractorKNN() while True: frames = pipe.wait_for_frames() #IR IR_frame = frames.get_infrared_frame() IR_image = np.asanyarray(ir_frame2.get_data()) fgMask = backSub.apply(IR_image) cv2.imshow('RS',fgMask) #ESC keyS if cv2.waitKey(1) & 0xff == 27: cv2.destroyAllWindows() break
画面起動後、少しまって背景画像が確定した後、素早くラバーダックを置いた状態が以下