코스포 x 데이콘 자동차 충돌 분석 AI경진대회 채용

파이썬

2023.03.09 22:04 794 조회 language

def get_frames(path):
    cap = cv2.VideoCapture(path)
    frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
    imgs = []        
    for fidx in range(frames):
        _, img = cap.read()            
        img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
        imgs.append(img)
    
    return np.array(imgs)

path = train.loc[train["weather"]==3, "video_path"].values

@interact(frame=(0, 50-1), path=path)
def show_frame(frame=0, path=None):
    frames = np.zeros((1, 20, 20, 3))
    if path:
        frames = get_frames(path)
    plt.imshow(frames[frame,:,:,:])

PDF
로그인이 필요합니다
0 / 1000
용용죽겠지
2023.03.10 09:55

img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

이 작업을 넣어주는게 정확도에 좀 더 좋은 작용을 하나요?