-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3cc30a5
commit b187a8f
Showing
7 changed files
with
207 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from . import arbiter_saturation as arbiter_saturation | ||
from . import default as default | ||
from . import hot_pixels as hot_pixels | ||
from . import refractory as refractory | ||
from . import transpose as transpose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import pathlib | ||
import typing | ||
|
||
import event_stream | ||
import numpy | ||
|
||
from .. import utilities | ||
|
||
|
||
def apply( | ||
input: pathlib.Path, | ||
output: pathlib.Path, | ||
begin: int, | ||
end: int, | ||
parameters: dict[str, typing.Any], | ||
) -> None: | ||
with event_stream.Decoder(input) as decoder: | ||
refractory = numpy.uint64(utilities.timecode(parameters["refractory"])) | ||
threshold_t = numpy.zeros((decoder.width, decoder.height), dtype=numpy.uint64) | ||
with event_stream.Encoder( | ||
output, | ||
"dvs", | ||
decoder.width, | ||
decoder.height, | ||
) as encoder: | ||
for packet in decoder: | ||
if packet["t"][-1] < begin: | ||
continue | ||
if packet["t"][0] >= end: | ||
break | ||
if packet["t"][0] < begin and packet["t"][-1] >= end: | ||
events = packet[ | ||
numpy.logical_and(packet["t"] >= begin, packet["t"] < end) | ||
] | ||
elif begin is not None and packet["t"][0] < begin: | ||
events = packet[packet["t"] >= begin] | ||
elif end is not None and packet["t"][-1] >= end: | ||
events = packet[packet["t"] < end] | ||
else: | ||
events = packet | ||
mask = numpy.full(len(events), False, dtype=bool) | ||
for index, (t, x, y, _) in enumerate(events): | ||
if t >= threshold_t[x, y]: | ||
mask[index] = True | ||
threshold_t[x, y] = t + refractory | ||
encoder.write(events[mask]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "1.1.1" | ||
__version__ = "1.2.0" |
Oops, something went wrong.