-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from meyerls/meyerls
Meyerls
- Loading branch information
Showing
16 changed files
with
241 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
name: Python package | ||
|
||
on: [push] | ||
name: Test COLMAP Wrapper | ||
|
||
on: [ push ] | ||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.6", "3.7", "3.8", "3.9"] | ||
python-version: [ "3.8", "3.9" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
- run: git checkout ${{ github.ref_name }} | ||
- name: 'Install dependencies' | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
pip install . | ||
- name: 'Install ExifTools' | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test aruco estimator | ||
wget https://exiftool.org/Image-ExifTool-12.51.tar.gz | ||
gzip -dc Image-ExifTool-12.51.tar.gz | tar -xf - | ||
cd Image-ExifTool-12.51 | ||
perl Makefile.PL | ||
make test | ||
sudo make install | ||
- name: 'Test COLMAP wrapper' | ||
run: | | ||
echo 1 | ||
#python scale_estimator.py --test_data | ||
exiftool -ver | ||
python colmap_wrapper/test.py |
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
|
||
from colmap_wrapper.colmap import * | ||
from colmap_wrapper.visualization import * | ||
from colmap_wrapper.data import * |
1 change: 0 additions & 1 deletion
1
colmap_wrapper/cache/24ad7c7e916d84fb99d59002a9822bc6d135b6ae.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
colmap_wrapper/cache/7e4ad885f29950d15294f2e5b827682fea726068.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
colmap_wrapper/cache/ba82974dc647fb397e469f2e83682bf13a88281b.json
This file was deleted.
Oops, something went wrong.
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,8 +1,13 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Copyright (c) 2022 Lukas Meyer | ||
Licensed under the MIT License. | ||
See LICENSE file for more information. | ||
""" | ||
|
||
from colmap_wrapper.colmap.utils import * | ||
from colmap_wrapper.colmap.bin import * | ||
from colmap_wrapper.colmap.camera import * | ||
from colmap_wrapper.colmap.colmap import * | ||
from colmap_wrapper.colmap.colmap_project import * | ||
from colmap_wrapper.colmap.colmap_project import * |
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
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,4 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
from colmap_wrapper.data.download import * |
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,104 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Copyright (c) 2022 Lukas Meyer | ||
Licensed under the MIT License. | ||
See LICENSE file for more information. | ||
""" | ||
|
||
# Built-in/Generic Imports | ||
# ... | ||
|
||
# Libs | ||
import os | ||
from zipfile import ZipFile | ||
from tqdm import tqdm | ||
import urllib.request | ||
|
||
# Own modules | ||
# ... | ||
|
||
EXISTS = True | ||
NON_EXIST = False | ||
|
||
|
||
class DownloadProgressBar(tqdm): | ||
def update_to(self, b=1, bsize=1, tsize=None): | ||
if tsize is not None: | ||
self.total = tsize | ||
self.update(b * bsize - self.n) | ||
|
||
|
||
def download(url: str, output_dir: str, overwrite: bool = False): | ||
filename = os.path.join(output_dir, url.split('/')[-1]) | ||
|
||
if os.path.exists(filename) and not overwrite: | ||
print('{} already exists in {}'.format(url.split('/')[-1], output_dir)) | ||
else: | ||
with DownloadProgressBar(unit='B', | ||
unit_scale=True, | ||
miniters=1, | ||
desc=url.split('/')[-1]) as t: | ||
urllib.request.urlretrieve(url, filename=filename, reporthook=t.update_to) | ||
|
||
return filename | ||
|
||
|
||
def extract(filename: str, output_dir: str): | ||
# opening the zip_file file in READ mode | ||
with ZipFile(filename, 'r') as zip_file: | ||
# printing all the contents of the zip_file file | ||
# zip_file.printdir() | ||
|
||
# extracting all the files | ||
print('Extracting all the files now...') | ||
zip_file.extractall(path=output_dir) | ||
print('Done!') | ||
|
||
|
||
class Dataset: | ||
def __init__(self): | ||
self.dataset_name = None | ||
self.dataset_path = None | ||
self.filename = None | ||
self.url = None | ||
self.data_path = None | ||
self.scale = None # in cm | ||
|
||
def __check_existence(self, output_directory, dataset_name): | ||
if output_directory == os.path.abspath(__file__): | ||
self.data_path = os.path.abspath(os.path.join(output_directory, '..', '..', 'data')) | ||
else: | ||
self.data_path = os.path.join(output_directory, 'data') | ||
|
||
os.makedirs(self.data_path, exist_ok=True) | ||
|
||
if os.path.exists(os.path.join(self.data_path, dataset_name)): | ||
return EXISTS | ||
else: | ||
return NON_EXIST | ||
|
||
def download_bunny_dataset(self, output_path: str = os.path.abspath(__file__), overwrite: bool = False): | ||
|
||
self.url = 'https://faubox.rrze.uni-erlangen.de/dl/fiN75KeHkAB78x3MTexFMu/bunny_reco.zip' | ||
|
||
self.dataset_name ='bunny' | ||
|
||
existence = self.__check_existence(output_directory=output_path, dataset_name=self.dataset_name) | ||
|
||
if existence == NON_EXIST: | ||
self.filename = download(url=self.url, output_dir=self.data_path, overwrite=overwrite) | ||
extract(filename=self.filename, output_dir=self.data_path) | ||
else: | ||
print('Dataset {} already exists at location {}'.format(self.dataset_name, self.data_path)) | ||
|
||
self.file_path = os.path.abspath( | ||
os.path.join(self.data_path, self.url.split('/')[-1].split('.zip')[0])) | ||
return self.file_path | ||
|
||
|
||
if __name__ == '__main__': | ||
downloader = Dataset() | ||
downloader.download_bunny_dataset() | ||
|
||
print('Saved at {}'.format(downloader.dataset_path)) |
Oops, something went wrong.