Skip to content

Commit

Permalink
Ignore non-image files in ns-process-data (#1040)
Browse files Browse the repository at this point in the history
* Ignore non-image files in ns-process-data

* Update reqs

* bump ipython
  • Loading branch information
tancik authored Nov 28, 2022
1 parent a578ac8 commit 0a57c7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ dev = [

# Documentation related packages
docs = [
"furo==2022.4.7",
"furo==2022.09.29",
# Specifying ipython for https://github.com/ipython/ipython/issues/13845
"ipython==8.6.0",
"readthedocs-sphinx-search==0.1.2",
"myst-nb==0.16.0",
"nbconvert==7.2.5",
"nbformat==5.5.0",
"sphinx==4.5.0",
"sphinx==5.2.1",
"sphinxemoji==0.2.0",
"sphinx-argparse==0.3.1",
"sphinx-copybutton==0.5.0",
Expand Down
9 changes: 6 additions & 3 deletions scripts/process_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ def main(self) -> None:
record3d_image_filenames = []
for f in record3d_image_dir.iterdir():
if f.stem.isdigit(): # removes possible duplicate images (for example, 123(3).jpg)
record3d_image_filenames.append(f)
if f.suffix.lower() in [".jpg", ".jpeg", ".png", ".tif", ".tiff"]:
record3d_image_filenames.append(f)

record3d_image_filenames = sorted(record3d_image_filenames, key=lambda fn: int(fn.stem))
num_images = len(record3d_image_filenames)
Expand Down Expand Up @@ -436,7 +437,8 @@ def main(self) -> None:

polycam_image_filenames = []
for f in polycam_image_dir.iterdir():
polycam_image_filenames.append(f)
if f.suffix.lower() in [".jpg", ".jpeg", ".png", ".tif", ".tiff"]:
polycam_image_filenames.append(f)
polycam_image_filenames = sorted(polycam_image_filenames, key=lambda fn: int(fn.stem))
num_images = len(polycam_image_filenames)
idx = np.arange(num_images)
Expand Down Expand Up @@ -528,7 +530,8 @@ def main(self) -> None:
# Copy images to output directory
image_filenames = []
for f in self.data.iterdir():
image_filenames.append(f)
if f.suffix.lower() in [".jpg", ".jpeg", ".png", ".tif", ".tiff"]:
image_filenames.append(f)
image_filenames = sorted(image_filenames, key=lambda fn: fn.stem)
num_images = len(image_filenames)
idx = np.arange(num_images)
Expand Down

0 comments on commit 0a57c7c

Please sign in to comment.