Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 1_convert_videos/video_mp4_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def main():
args = parser.parse_args()

if not os.path.exists(args.input):
print("Input directory does not exist.")
print(f"Warning: The specified input directory '{args.input}' does not exist. Please check the path and try again.")
return
if not os.path.exists(args.output):
os.makedirs(args.output)
Expand Down
4 changes: 2 additions & 2 deletions 1_convert_videos/video_mp4_converter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ input:
repo: raw_videos_and_images
glob: "/*"
transform:
image: lbliii/video_mp4_converter:1.0.14
image: lbliii/video_mp4_converter:1.0.16
cmd:
- python3
- /video_mp4_converter.py
Expand All @@ -17,4 +17,4 @@ transform:
autoscaling: true


# docker buildx build --platform linux/amd64 -t lbliii/video_mp4_converter:1.0.14 --push .
# docker buildx build --platform linux/amd64 -t lbliii/video_mp4_converter:1.0.16 --push .
2 changes: 1 addition & 1 deletion 2_flatten_images/image_flattener.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def main():
args = parser.parse_args()

if not os.path.exists(args.input):
print("Input directory does not exist.")
print(f"Warning: The specified input directory '{args.input}' does not exist. Please check the path and try again.")
return
if not os.path.exists(args.output):
os.makedirs(args.output)
Expand Down
15 changes: 11 additions & 4 deletions 3_trace_images/image_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ def make_edges(image, input_path, output_path):

tail = os.path.split(image)[1]
subdirectory = os.path.relpath(os.path.dirname(image), input_path)
output_subdir = os.path.join(output_path, subdirectory)

# Check if the file is in the top-level directory
if subdirectory == '.':
output_subdir = output_path
output_filename = os.path.splitext(tail)[0] + '_edges.png'
else:
output_subdir = os.path.join(output_path, subdirectory + "_edges")
output_filename = os.path.splitext(tail)[0] + '.png'

os.makedirs(output_subdir, exist_ok=True)

edges = cv2.Canny(img, 100, 200)
output_filename = os.path.splitext(tail)[0] + '_edges.png'
output_filepath = os.path.join(output_subdir, output_filename)
plt.imsave(output_filepath, edges, cmap='gray')
print(f"Processed: {image} -> {output_filepath}")
Expand All @@ -30,7 +37,7 @@ def process_image_files(input_path, output_path):
for dirpath, dirs, files in os.walk(input_path):
total = len(files)
current = 0
for file in files:
for file in files:
current += 1
print(f"Processing {file}, #{current} of {total}")
make_edges(os.path.join(dirpath, file), input_path, output_path)
Expand All @@ -50,7 +57,7 @@ def main():

for input_path in args.input:
if not os.path.exists(input_path):
print(f"Input directory does not exist: {input_path}")
print(f"Warning: The specified input directory '{input_path}' does not exist. Please check the path and try again.")
else:
print(f"Processing images in: {input_path}")
process_image_files(input_path, args.output)
Expand Down
9 changes: 5 additions & 4 deletions 3_trace_images/image_tracer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ input:
union:
- pfs:
repo: raw_videos_and_images
name: tracer
glob: "/*.{png,jpg,jpeg}"
- pfs:
repo: image_flattener
name: tracer
glob: "/*"
transform:
image: lbliii/image_tracer:1.0.8
image: lbliii/image_tracer:1.0.9
cmd:
- python3
- /image_tracer.py
- --input
- /pfs/raw_videos_and_images
- /pfs/image_flattener
- /pfs/tracer
- --output
- /pfs/out/
autoscaling: true


# docker buildx build --platform linux/amd64 -t lbliii/image_tracer:1.0.8 --push .
# docker buildx build --platform linux/amd64 -t lbliii/image_tracer:1.0.9 --push .
2 changes: 1 addition & 1 deletion 4_gif_images/movie_gifer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def main():

for input_path in args.input:
if not os.path.exists(input_path):
print(f"Input directory does not exist: {input_path}")
print(f"Warning: The specified input directory '{input_path}' does not exist. Please check the path and try again.")
else:
print(f"Processing images in: {input_path}")
process_image_directories(input_path, args.output)
Expand Down
9 changes: 5 additions & 4 deletions 4_gif_images/movie_gifer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ input:
union:
- pfs:
repo: image_flattener
name: gifer
glob: "/*/"
- pfs:
repo: image_tracer
name: gifer
glob: "/*/"
transform:
image: lbliii/movie_gifer:1.0.5
image: lbliii/movie_gifer:1.0.6
cmd:
- python3
- /movie_gifer.py
- --input
- /pfs/image_flattener
- /pfs/image_tracer
- /pfs/gifer
- --output
- /pfs/out/
autoscaling: true


# docker buildx build --platform linux/amd64 -t lbliii/movie_gifer:1.0.5 --push .
# docker buildx build --platform linux/amd64 -t lbliii/movie_gifer:1.0.6 --push .
11 changes: 6 additions & 5 deletions 5_shuffle_content/content_shuffler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@ input:
union:
- pfs:
glob: "/"
name: shuffler
repo: movie_gifer
- pfs:
glob: "/*.{png,jpg,jpeg}"
name: shuffler
repo: raw_videos_and_images
- pfs:
glob: "/*.{png,jpg,jpeg}"
name: shuffler
repo: image_tracer

transform:
image: lbliii/content_shuffler:1.0.0
image: lbliii/content_shuffler:1.0.1
cmd:
- python3
- /content_shuffler.py
- --input
- /pfs/movie_gifer
- /pfs/raw_videos_and_images
- /pfs/image_tracer
- /pfs/shuffler
- --output
- /pfs/out/
autoscaling: true


# docker buildx build --platform linux/amd64 -t lbliii/content_shuffler:1.0.0 --push .
# docker buildx build --platform linux/amd64 -t lbliii/content_shuffler:1.0.1 --push .