Skip to content

Commit

Permalink
V2.2.0 (#3)
Browse files Browse the repository at this point in the history
* improves: video improves

* improves: video improves

* improves: video improves
  • Loading branch information
jlsneto authored Jul 16, 2022
1 parent 8cf9fc9 commit c5fc0ac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion calango/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
from .devices import Mouse
from .media import Image, VideoWriter, Video

VERSION = "2.1.9.final.0"
VERSION = "2.2.0.final.0"
__version__ = get_version_pep440_compliant(VERSION)
16 changes: 16 additions & 0 deletions calango/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,11 @@ def next_frame(self):
def is_opened(self):
return self._cap.is_opened

@property
def current_time(self):
"""returns timesec for"""
return round((1 / self._cap.fps) * self.current_number_frame, 2)

def set_start_on_time(self, _time='00:00:00'):
h, m, s = time.strptime(_time, '%H:%M:%S')[-6:-3]
h *= 3600
Expand All @@ -889,6 +894,8 @@ def set_start_on_time(self, _time='00:00:00'):
self._cap.set(cv2.CAP_PROP_POS_MSEC, seconds * 1000)
self._current_number_frame = int(round(seconds * self.fps))
self._count_frames = self._current_number_frame
self._fps_time = 0
self._t0 = None

def get_batch_frames(self, kernel_size, strides=1, take_number_frame=False):
batch_frames = []
Expand Down Expand Up @@ -1054,6 +1061,15 @@ def set_speed(self, speed=1):
def stop(self):
self._cap.stop()

def __getitem__(self, item):
if isinstance(item, int):
start, end, step = item, item+1, 1
elif isinstance(item, slice):
start, end, step = item.start, item.stop, item.step or 1
else:
raise IndexError("Value is not valid")
return self.cut(start, end, step)


class VideoMagnification:
def __init__(self, *args, batch_size=20, levels=3, low=2.33, high=2.67, amplification=30, frame_preprocess=None,
Expand Down

0 comments on commit c5fc0ac

Please sign in to comment.