|
@@ -128,7 +128,7 @@ def extract_lsbs(data):
|
|
|
|
|
|
data = [k for k, _ in groupby(data)]
|
|
data = [k for k, _ in groupby(data)]
|
|
data = chunks(data, 8)
|
|
data = chunks(data, 8)
|
|
-
|
|
|
|
|
|
+
|
|
for chunk in data:
|
|
for chunk in data:
|
|
if len(chunk) != 8:
|
|
if len(chunk) != 8:
|
|
break
|
|
break
|
|
@@ -242,16 +242,15 @@ def sample(source, source_type, multiplier=1):
|
|
|
|
|
|
def video2_sampler(q, source):
|
|
def video2_sampler(q, source):
|
|
with Device.from_id(abs(int(source))) as device:
|
|
with Device.from_id(abs(int(source))) as device:
|
|
- capture = VideoCapture(device)
|
|
|
|
- capture.set_format(
|
|
|
|
- device.info.frame_sizes[0].width, device.info.frame_sizes[0].height, "YUYV"
|
|
|
|
|
|
+ device.set_format(
|
|
|
|
+ 1, device.info.frame_sizes[0].width, device.info.frame_sizes[0].height, pixel_format="YUYV"
|
|
)
|
|
)
|
|
|
|
|
|
last = 0
|
|
last = 0
|
|
- for frame in capture:
|
|
|
|
|
|
+ for frame in device:
|
|
new = time.monotonic()
|
|
new = time.monotonic()
|
|
|
|
|
|
- if new - last > 5:
|
|
|
|
|
|
+ if new - last > 1.5:
|
|
data = extract_lsbs(bytes(frame))
|
|
data = extract_lsbs(bytes(frame))
|
|
data = whiten(data)
|
|
data = whiten(data)
|
|
|
|
|