2022-03-05 16:20:37 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, cmake
|
|
|
|
, opencv4
|
|
|
|
, ceres-solver
|
|
|
|
, suitesparse
|
|
|
|
, metis
|
|
|
|
, eigen
|
|
|
|
, pkg-config
|
|
|
|
, pybind11
|
|
|
|
, numpy
|
|
|
|
, pyyaml
|
|
|
|
, lapack
|
|
|
|
, gtest
|
|
|
|
, gflags
|
|
|
|
, glog
|
|
|
|
, pytestCheckHook
|
|
|
|
, networkx
|
|
|
|
, pillow
|
|
|
|
, exifread
|
|
|
|
, gpxpy
|
|
|
|
, pyproj
|
|
|
|
, python-dateutil
|
|
|
|
, joblib
|
2024-01-13 08:15:51 +00:00
|
|
|
, repoze-lru
|
2022-03-05 16:20:37 +00:00
|
|
|
, xmltodict
|
|
|
|
, cloudpickle
|
|
|
|
, scipy
|
|
|
|
, sphinx
|
|
|
|
, matplotlib
|
|
|
|
, fpdf
|
|
|
|
,
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
ceresSplit = (builtins.length ceres-solver.outputs) > 1;
|
|
|
|
ceres' =
|
|
|
|
if ceresSplit
|
|
|
|
then ceres-solver.dev
|
|
|
|
else ceres-solver;
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "OpenSfM";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "unstable-2023-12-09";
|
2022-03-05 16:20:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mapillary";
|
|
|
|
repo = pname;
|
2024-01-02 11:29:13 +00:00
|
|
|
rev = "7f170d0dc352340295ff480378e3ac37d0179f8e";
|
|
|
|
sha256 = "sha256-l/HTVenC+L+GpMNnDgnSGZ7+Qd2j8b8cuTs3SmORqrg=";
|
2022-03-05 16:20:37 +00:00
|
|
|
};
|
|
|
|
patches = [
|
|
|
|
./0002-cmake-find-system-distributed-gtest.patch
|
|
|
|
./0003-cmake-use-system-pybind11.patch
|
|
|
|
./0004-pybind_utils.h-conflicts-with-nixpkgs-pybind.patch
|
|
|
|
./fix-scripts.patch
|
|
|
|
];
|
|
|
|
postPatch = ''
|
|
|
|
rm opensfm/src/cmake/FindGlog.cmake
|
|
|
|
rm opensfm/src/cmake/FindGflags.cmake
|
|
|
|
|
|
|
|
# HAHOG is the default descriptor.
|
|
|
|
# We'll test both HAHOG and SIFT because this is
|
|
|
|
# where segfaults might be introduced in future
|
|
|
|
echo 'feature_type: SIFT' >> data/berlin/config.yaml
|
|
|
|
echo 'feature_type: HAHOG' >> data/lund/config.yaml
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
sed -i -e 's/^.*BuildDoc.*$//' setup.py
|
2022-03-05 16:20:37 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake pkg-config sphinx ];
|
|
|
|
buildInputs = [
|
|
|
|
ceres'
|
|
|
|
suitesparse
|
|
|
|
metis
|
|
|
|
eigen
|
|
|
|
lapack
|
|
|
|
gflags
|
|
|
|
gtest
|
|
|
|
glog
|
|
|
|
pybind11
|
|
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
scipy
|
|
|
|
pyyaml
|
2024-01-02 11:29:13 +00:00
|
|
|
opencv4.cxxdev
|
2022-03-05 16:20:37 +00:00
|
|
|
networkx
|
|
|
|
pillow
|
|
|
|
matplotlib
|
|
|
|
fpdf
|
|
|
|
exifread
|
|
|
|
gpxpy
|
|
|
|
pyproj
|
|
|
|
python-dateutil
|
|
|
|
joblib
|
2024-01-13 08:15:51 +00:00
|
|
|
repoze-lru
|
2022-03-05 16:20:37 +00:00
|
|
|
xmltodict
|
|
|
|
cloudpickle
|
|
|
|
];
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2022-03-05 16:20:37 +00:00
|
|
|
|
|
|
|
dontUseCmakeBuildDir = true;
|
|
|
|
cmakeFlags = [
|
|
|
|
"-Bcmake_build"
|
|
|
|
"-Sopensfm/src"
|
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
disabledTests = [
|
|
|
|
"test_run_all" # Matplotlib issues. Broken integration is less useless than a broken build
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2022-03-05 16:20:37 +00:00
|
|
|
"test_reconstruction_incremental"
|
|
|
|
"test_reconstruction_triangulation"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "opensfm" ];
|
|
|
|
|
|
|
|
meta = {
|
2022-06-16 17:23:12 +00:00
|
|
|
broken = stdenv.isDarwin;
|
2022-03-05 16:20:37 +00:00
|
|
|
maintainers = [ lib.maintainers.SomeoneSerge ];
|
|
|
|
license = lib.licenses.bsd2;
|
2022-03-30 09:31:56 +00:00
|
|
|
changelog = "https://github.com/mapillary/OpenSfM/blob/${src.rev}/CHANGELOG.md";
|
2022-03-05 16:20:37 +00:00
|
|
|
description = "Open source Structure-from-Motion pipeline from Mapillary";
|
|
|
|
homepage = "https://opensfm.org/";
|
|
|
|
};
|
|
|
|
}
|