Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update vid2xlsx.py #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions vid2xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
from loguru import logger
from sklearn.cluster import MiniBatchKMeans

import argparse
import cv2
import imutils
import numpy as np
import sys
import xlsxwriter
import argparse, cv2, imutils, numpy as np, sys, xlsxwriter

ap = argparse.ArgumentParser()
ap.add_argument("-i", "--input", required = True, help = "path to input video file")
Expand All @@ -32,10 +27,7 @@

workbook = xlsxwriter.Workbook(args["output"], {'constant_memory': True})

palette = {}
clt = None
labels = None
quant = None
palette, clt, labels, quant = {}, None, None, None

while cap.more():
frame = cap.read()
Expand Down Expand Up @@ -67,7 +59,7 @@
palette[color] = workbook.add_format({'bg_color': f'#{color}'})
cell_format = palette[color]
current.write_blank(row, col, None, cell_format)
count = count + 1
count += 1

if len(palette) > 64000: logger.warning("""
Palette size ({}) exceeds the maximum permitted under the XLSX specification (64000).
Expand Down