Skip to content

Commit

Permalink
cleaned up debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
seanshahkarami committed Nov 19, 2021
1 parent 68bd516 commit 775bb29
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions waggle/data/vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@
from pathlib import Path
import numpy
from typing import Union
from contextlib import contextmanager
import time
import os
from os import PathLike
import random
import json
import re
from .timestamp import get_timestamp
import logging


logger = logging.getLogger("waggle.data.vision")


class BGR:
Expand Down Expand Up @@ -125,7 +119,6 @@ def __init__(self, device, format):

def __enter__(self):
if self.context_depth == 0:
logger.debug("opening video capture")
self.capture = cv2.VideoCapture(self.device)
if not self.capture.isOpened():
raise RuntimeError(f"unable to open video capture for device {self.device!r}")
Expand All @@ -135,19 +128,16 @@ def __enter__(self):
def __exit__(self, exc_type, exc_val, exc_tb):
self.context_depth -= 1
if self.context_depth == 0:
logger.debug("closing video capture")
self.capture.release()

def snapshot(self):
logger.debug("snapshot")
timestamp = get_timestamp()
ok, data = self.capture.read()
if not ok:
raise RuntimeError("failed to take snapshot")
return ImageSample(data=data, timestamp=timestamp, format=self.format)

def stream(self):
logger.debug("stream")
while True:
timestamp = get_timestamp()
ok, data = self.capture.read()
Expand Down

0 comments on commit 775bb29

Please sign in to comment.