def loadmovies(path):
    os.chdir(path)
    for file in glob.glob("*.mp4"):
        vidcap = cv2.VideoCapture(file)
        count = 0;
        values = []
        while success:
            success,image = vidcap.read()
            cv2.imshow('Direct Video', image)
            frame_color = Filter.select_method(args.method)(frame)[:3] 
            values.append(frame_color)
            count += 1
            print (count)
        # head, tail = os.path.split("/tmp/d/a.dat")
        videopackage = (file,values)
        json.dumps(videopackage)
        json.dump(videopackage,f)
    return
Beispiel #2
0
# For each Frame
for i in tqdm(range(final_width)):
    # Let's warp
    cap.set(cv2.CAP_PROP_POS_FRAMES, (i+args.timestamp)*warp)
    ret, frame = cap.read()

    # If this is an empty frame aka. last one
    if not ret:
        break

    # Crop the frame
    frame = frame[y1:y2, x1:x2]

    cv2.imshow('Direct Video', frame)

    # Get color
    frame_color = Filter.select_method(args.method)(frame)[:3]
    sample_image[:, :] = frame_color
    cv2.imshow('Current Dominant Color', sample_image)

    # Fill final image
    final_image[:, i] = frame_color

    # Force quit
    if cv2.waitKey(10) & 0xFF == ord('q'):
        break

cv2.imwrite('color_img.jpg', final_image)

cap.release()