From 6a819d62d0a0447d09f58c1649333f0130182bf8 Mon Sep 17 00:00:00 2001 From: Daeho Ro Date: Fri, 29 Nov 2024 00:34:49 +0900 Subject: [PATCH 1/4] poselib 2.0.4 (new formula) Signed-off-by: Rui Chen autobump: add poselib Signed-off-by: Rui Chen --- .github/autobump.txt | 1 + Formula/p/poselib.rb | 71 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 Formula/p/poselib.rb diff --git a/.github/autobump.txt b/.github/autobump.txt index d8daac46ffede..03df02a222af8 100644 --- a/.github/autobump.txt +++ b/.github/autobump.txt @@ -2369,6 +2369,7 @@ ponyc popeye portablegl porter +poselib postgis postgresql@13 postgresql@14 diff --git a/Formula/p/poselib.rb b/Formula/p/poselib.rb new file mode 100644 index 0000000000000..329fdddc0f1ca --- /dev/null +++ b/Formula/p/poselib.rb @@ -0,0 +1,71 @@ +class Poselib < Formula + desc "Minimal solvers for calibrated camera pose estimation" + homepage "https://github.com/PoseLib/PoseLib/" + url "https://github.com/PoseLib/PoseLib/archive/refs/tags/v2.0.4.tar.gz" + sha256 "caa0c1c9b882f6e36b5ced6f781406ed97d4c1f0f61aa31345ebe54633d67c16" + license "BSD-3-Clause" + + depends_on "cmake" => :build + depends_on "eigen" + + def install + system "cmake", "-S", ".", "-B", "build", "-DBUILD_SHARED_LIBS=ON", *std_cmake_args + system "cmake", "--build", "build" + system "cmake", "--install", "build" + + system "cmake", "-S", ".", "-B", "static", "-DBUILD_SHARED_LIBS=OFF", *std_cmake_args + system "cmake", "--build", "static" + lib.install Dir["static/PoseLib/*.a"] + end + + test do + (testpath/"test.cpp").write <<~CPP + #include "PoseLib/poselib.h" + #include + + int main(int argc, char *argv[]) + { + Eigen::Vector2d imgA(315, 217); + Eigen::Vector2d imgB(361, 295); + Eigen::Vector2d imgC(392, 660); + Eigen::Vector2d imgD(146, 220); + + Eigen::Vector2d pp(280, 420); + + std::vector points2D = { imgA - pp, imgB - pp, imgC - pp, imgD - pp}; + + Eigen::Vector3d a(-20.96, 3.54, 13.86); + Eigen::Vector3d b(-20.96, 3.57, 13.24); + Eigen::Vector3d c(-20.95, 2.01, 13.25); + Eigen::Vector3d d(-21.66, 3.74, 13.86); + + std::vector points3D = { a, b, c, d }; + + std::vector output; + std::vector output_fx, output_fy; + + int result = poselib::p4pf(points2D, points3D, &output, &output_fx, &output_fy, true); + + for(int k = 0; k < output.size(); ++k) { + poselib::CameraPose pose = output[k]; + double fx = output_fx[k]; + double fy = output_fy[k]; + + std::cout << pose.R() << std::endl; + } + + return 0; + } + CPP + system ENV.cxx, "test.cpp", "-std=c++17", + "-I#{Formula["eigen"].opt_include}/eigen3", + "-L#{lib}", "-lPoseLib", "-o", "test" + + expected_output = <<~EOS + \s 0.934064 -0.0235118 -0.356331 + \s-0.165184 -0.91311 -0.372753 + \s-0.316605 0.407035 -0.856787 + EOS + assert_equal expected_output, shell_output("./test") + end +end From a2a1b76865f388c4b98d363487e219639eaf903f Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Thu, 28 Nov 2024 13:53:49 +0000 Subject: [PATCH 2/4] colmap 3.11.0 colmap: depends_on poselib Signed-off-by: Rui Chen colmap: build against system poselib Signed-off-by: Rui Chen --- Formula/c/colmap.rb | 49 +++++++++++++-------------------------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/Formula/c/colmap.rb b/Formula/c/colmap.rb index abc871fe4ec3d..f1db0ca3c2b59 100644 --- a/Formula/c/colmap.rb +++ b/Formula/c/colmap.rb @@ -1,10 +1,9 @@ class Colmap < Formula desc "Structure-from-Motion and Multi-View Stereo" homepage "https://colmap.github.io/" - url "https://github.com/colmap/colmap/archive/refs/tags/3.10.tar.gz" - sha256 "61850f323e201ab6a1abbfb0e4a8b3ba1c4cedbf55e0a5716bdea1df8ae1813a" + url "https://github.com/colmap/colmap/archive/refs/tags/3.11.0.tar.gz" + sha256 "8da471b0f5baa3bdd940f1778ffe338738eb47b90b4d03dcd8da6b9810014844" license "BSD-3-Clause" - revision 1 bottle do sha256 cellar: :any, arm64_sequoia: "46c7b82e649ec870d6d3cc2c0afa10e6440415a106c7125b5e32c4f0fddd9ce1" @@ -30,6 +29,7 @@ class Colmap < Formula depends_on "gmp" depends_on "lz4" depends_on "metis" + depends_on "poselib" depends_on "qt@5" depends_on "suite-sparse" @@ -45,14 +45,21 @@ class Colmap < Formula depends_on "mesa" end - # Remove this patch after https://github.com/colmap/colmap/pull/2338 is included in - # a future release - patch :DATA + # patch to build against system PoseLib, upstream pr ref, https://github.com/colmap/colmap/pull/2971 + patch do + url "https://github.com/colmap/colmap/commit/a2c44a012742b37ce2ddd163942d3b625cf301c0.patch?full_index=1" + sha256 "8960a6715ef301108d583646944202d898a043c6fb1f7d09489ebf7fbc9a01f7" + end def install ENV.append_path "CMAKE_PREFIX_PATH", Formula["qt@5"].prefix - system "cmake", "-S", ".", "-B", "build", "-DCUDA_ENABLED=OFF", *std_cmake_args + args = %w[ + -DCUDA_ENABLED=OFF + -DFETCH_POSELIB=OFF + ] + + system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args system "cmake", "--build", "build" system "cmake", "--install", "build" end @@ -62,31 +69,3 @@ def install assert_path_exists (testpath / "db") end end - -__END__ -diff --git a/src/colmap/image/line.cc b/src/colmap/image/line.cc -index 3637c3dc..33fff7da 100644 ---- a/src/colmap/image/line.cc -+++ b/src/colmap/image/line.cc -@@ -27,6 +27,8 @@ - // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - // POSSIBILITY OF SUCH DAMAGE. - -+#include -+ - #include "colmap/image/line.h" - - #include "colmap/util/logging.h" -diff --git a/src/colmap/mvs/workspace.h b/src/colmap/mvs/workspace.h -index 73d21b78..6d2c862c 100644 ---- a/src/colmap/mvs/workspace.h -+++ b/src/colmap/mvs/workspace.h -@@ -29,6 +29,8 @@ - - #pragma once - -+#include -+ - #include "colmap/mvs/consistency_graph.h" - #include "colmap/mvs/depth_map.h" - #include "colmap/mvs/model.h" From 6376eb3f4ead2a52029bdcb0d4465b2026c98e59 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Thu, 5 Dec 2024 02:08:50 +0000 Subject: [PATCH 3/4] colmap: update 3.11.0 bottle. --- Formula/c/colmap.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Formula/c/colmap.rb b/Formula/c/colmap.rb index f1db0ca3c2b59..59d4446de8bf4 100644 --- a/Formula/c/colmap.rb +++ b/Formula/c/colmap.rb @@ -6,14 +6,12 @@ class Colmap < Formula license "BSD-3-Clause" bottle do - sha256 cellar: :any, arm64_sequoia: "46c7b82e649ec870d6d3cc2c0afa10e6440415a106c7125b5e32c4f0fddd9ce1" - sha256 cellar: :any, arm64_sonoma: "e81fa40995450b6f13fb3675bac57aeca83380faa146bed41304de45e3938bda" - sha256 cellar: :any, arm64_ventura: "fd260454a7b9caca630278659b1e7398a63d36ee2abfacaabf0bf5c15d032915" - sha256 cellar: :any, arm64_monterey: "0741dc2a9c7f9228764e05de9bcb407ef3c063ac0a224b2732f40bf4b4631c99" - sha256 cellar: :any, sonoma: "7cd8b4df89b8563f087459d460cb93845bc897376a520fe4efe0c4ad2fd9bb43" - sha256 cellar: :any, ventura: "76d2391ad2721e30a94002a04a7bb66bebff4ecdf2319e0083fffbc06749cb7d" - sha256 cellar: :any, monterey: "6fee96fd5d7bbe0a860fa4ac80c7548af1785a18746eef4636e8ea1a1156c7ca" - sha256 cellar: :any_skip_relocation, x86_64_linux: "8d67735677d48bb53f47c636ba0a34c3440235ca394d68767e88caeb709ed99c" + sha256 cellar: :any, arm64_sequoia: "9d34ec14f9932bfc52bc469a759ccd21531fba6b1262df8c2f1567e85f749f00" + sha256 cellar: :any, arm64_sonoma: "2aab52a0ae8b9fc11056abc7aaeb0486f748e49def64fc076124d952b769a3a4" + sha256 cellar: :any, arm64_ventura: "3ae0841581685adfaac22717aa78ba1ddae8b65fd34a66cc1419bf9fac3269ed" + sha256 cellar: :any, sonoma: "08736f3bc9b234940b0ea18c84420193300aefa4c4865987bd31de32f8a48b70" + sha256 cellar: :any, ventura: "85a5f70b854ea3deaa7ed41aab83ee28a4e19e2518006549943763e58cbc7147" + sha256 cellar: :any_skip_relocation, x86_64_linux: "6683e33ff087200853478ccce447ee4dee3324bdc9dad23d2f97c2a745768b3c" end depends_on "cmake" => :build From 3c207e705347888fd1c315037b32a10a410becba Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Thu, 5 Dec 2024 02:08:51 +0000 Subject: [PATCH 4/4] poselib: add 2.0.4 bottle. --- Formula/p/poselib.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Formula/p/poselib.rb b/Formula/p/poselib.rb index 329fdddc0f1ca..bdc9bcca5c6c5 100644 --- a/Formula/p/poselib.rb +++ b/Formula/p/poselib.rb @@ -5,6 +5,15 @@ class Poselib < Formula sha256 "caa0c1c9b882f6e36b5ced6f781406ed97d4c1f0f61aa31345ebe54633d67c16" license "BSD-3-Clause" + bottle do + sha256 cellar: :any, arm64_sequoia: "62ba1d9d73288e53a7fa31462a0aeef5eb5d32305d77c5207bf626d0c8d52711" + sha256 cellar: :any, arm64_sonoma: "0c58c6ca1d520956f808e52273fdd32ea132021906e629325272272dacb90c7b" + sha256 cellar: :any, arm64_ventura: "7b6e8c4abb3b2e00c8dfa0aa600599c9d930724e09d1dcf45339c903121fa8f1" + sha256 cellar: :any, sonoma: "e520e1731c729e1ee2dc91a3d6e3d5773bc6f5414098b6b0d61aa7984a3d7467" + sha256 cellar: :any, ventura: "3e3d39c0763a6efacdc2f9154851ee80174ac64ad3aa0518fa9e35871e42cb53" + sha256 cellar: :any_skip_relocation, x86_64_linux: "598ee718057f572aebb473a515f4201391808f59563811eaa8809a5dcc7bbacf" + end + depends_on "cmake" => :build depends_on "eigen"