Skip to content

Commit

Permalink
allow endless file input
Browse files Browse the repository at this point in the history
  • Loading branch information
t-sasatani committed Dec 11, 2024
1 parent 87e8a44 commit 9cd2bc3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mio/data/config/process/denoise_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ noise_patch:
output_diff: false
frequency_masking:
enable: true
spatial_LPF_cutoff_radius: 20
spatial_LPF_cutoff_radius: 15
vertical_BEF_cutoff: 2
horizontal_BEF_cutoff: 0
display_mask: false
output_mask: true
output_result: true
output_freq_domain: false
end_frame: 140
end_frame: -1 #-1 means all frames
output_result: true
output_dir: user_dir/output
14 changes: 11 additions & 3 deletions mio/process/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def denoise(
# index for frame number in original video
try:
for index, frame in reader.read_frames():
if config.end_frame and index > config.end_frame:
if config.end_frame and config.end_frame != -1 and index > config.end_frame:
break

raw_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
Expand Down Expand Up @@ -316,17 +316,25 @@ def denoise(
fps=20,
)
if config.noise_patch.output_diff:
"""
diff_video = NamedFrame(
name=f"diff_{config.noise_patch.diff_multiply}x", video_frame=diff_frames
)
"""
diff_video.export(
output_dir / f"{pathstem}",
suffix=True,
fps=20,
)
if config.noise_patch.output_noise_patch:
noise_patch = NamedFrame(name="noise_patch", video_frame=noise_patchs)
if config.frequency_masking.output_mask:
freq_mask_frame = NamedFrame(
name="freq_mask", static_frame=freq_mask * np.iinfo(np.uint8).max
)
freq_mask_frame.export(
output_dir / f"{pathstem}",
suffix=True,
fps=20,
)

if config.frequency_masking.enable:
freq_domain_video = NamedFrame(name="freq_domain", video_frame=freq_domain_frames)
Expand Down

0 comments on commit 9cd2bc3

Please sign in to comment.