This commit is contained in:
yair-mantis 2023-12-26 15:34:22 +02:00
parent eaf7294d06
commit e7ab3b6c80

View File

@ -6,9 +6,7 @@ from tqdm import tqdm
import pandas as pd import pandas as pd
import pcapng import pcapng
from struct import unpack from struct import unpack
import matplotlib.pyplot as plt
from PIL import Image from PIL import Image
from PIL import Image, ImageDraw
import cv2 import cv2
@ -40,6 +38,7 @@ def parse(data):
ret['data'] = data[hdr:] ret['data'] = data[hdr:]
return ret return ret
df = pd.DataFrame([parse(d) for d in raw]) df = pd.DataFrame([parse(d) for d in raw])
df2 = df[[c for c in df.columns if c != 'data']] df2 = df[[c for c in df.columns if c != 'data']]
@ -60,7 +59,10 @@ def getframes(df):
def image16(frame, width, height, pixelformat='>H'): def image16(frame, width, height, pixelformat='>H'):
return [Image.fromarray(np.frombuffer(frame, dtype=pixelformat).reshape(width, height)) for frame in frames if len(frame) == 2 * width * height] return [
Image.fromarray(np.frombuffer(frame, dtype=pixelformat).reshape(width, height)) for frame in frames
if len(frame) == 2 * width * height
]
def showvideo(images): def showvideo(images):