-
Notifications
You must be signed in to change notification settings - Fork 1
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 #2 from ThreeDify/setup-opensfm
Setup OpenSfM
- Loading branch information
Showing
9 changed files
with
144 additions
and
19 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.vscode/ | ||
.venv/ | ||
|
||
dist/ | ||
build/ | ||
*.egg*/ | ||
*.py[cod] | ||
|
||
data/ | ||
|
||
.env | ||
**/*.pyc | ||
**/__pycache__ |
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,3 @@ | ||
API_BASE_URL=http://localhost:3000 | ||
|
||
SFM_IMPLEMENTATION=OPENSFM|THREEDIFY |
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,15 @@ | ||
FROM ghcr.io/threedify/opensfm:0.5.2 AS main | ||
|
||
WORKDIR /source/ThreeDify-SfM | ||
|
||
COPY . . | ||
|
||
RUN python3 setup.py install | ||
|
||
CMD python3 src/main.py | ||
|
||
FROM main AS lint | ||
|
||
RUN pip3 install -e .[dev] | ||
|
||
CMD pylint src && black --check . |
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
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,59 @@ | ||
import logging | ||
|
||
from opensfm import dataset | ||
from opensfm.actions import ( | ||
extract_metadata, | ||
detect_features, | ||
match_features, | ||
create_tracks, | ||
reconstruct, | ||
mesh, | ||
undistort, | ||
compute_depthmaps, | ||
) | ||
|
||
from threedify_sfm.DataSet import DataSet | ||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel(logging.DEBUG) | ||
|
||
|
||
class OpenSfM: | ||
""" | ||
Run structure from motion pipeline on given dataset. | ||
""" | ||
|
||
dataset: dataset.DataSet | ||
|
||
def __init__(self, data: DataSet): | ||
self.dataset = dataset.DataSet(data.data_path()) | ||
|
||
def run(self): | ||
""" | ||
Run the SFM pipeline | ||
""" | ||
logger.info("Running SFM pipeline.") | ||
|
||
logger.info("Extracting camera data from dataset.") | ||
extract_metadata.run_dataset(self.dataset) | ||
|
||
logger.info("Extracting features from dataset.") | ||
detect_features.run_dataset(self.dataset) | ||
|
||
logger.info("Matching features from the images in the dataset.") | ||
match_features.run_dataset(self.dataset) | ||
|
||
logger.info("Creating tracks from the matches.") | ||
create_tracks.run_dataset(self.dataset) | ||
|
||
logger.info("Running reconstruction.") | ||
reconstruct.run_dataset(self.dataset) | ||
|
||
logger.info("Generating mesh.") | ||
mesh.run_dataset(self.dataset) | ||
|
||
logger.info("Undistoring images.") | ||
undistort.run_dataset(self.dataset, None, 0, None, "undistored") | ||
|
||
logger.info("Computing depthmaps.") | ||
compute_depthmaps.run_dataset(self.dataset, "undistored", False) |