### Install Theia with make install Source: http://theia-sfm.org/building.html Run this command after a successful build to install the library. It is executed from the build directory. ```bash make install ``` -------------------------------- ### Detecting Keypoints with KeypointDetector Source: http://theia-sfm.org/features.html Example workflow for initializing a detector and extracting keypoints from an image. The input vector for keypoints must be empty before calling DetectKeypoints. ```cpp // Assume var keypoint_detector was created with one of the constructors below. FloatImage input_image(input_image_filename); const bool initialization_success = keypoint_detector.Initialize(); // Container for the detected keypoints. std::vector detected_keypoint; const bool detection_success = keypoint_detector.DetectKeypoints(input_image, &detected_keypoints); ``` -------------------------------- ### Feature Extraction Workflow Source: http://theia-sfm.org/features.html Example demonstrating the workflow of loading an image, detecting keypoints with SiftDetector, and extracting descriptors using SiftDescriptorExtractor. ```cpp // Open image we want to extract features from. FloatImage input_image(input_image_filename); // Detect keypoints. SiftDetector sift_keypoint_detector; bool keypoint_detector_init = sift_keypoint_detector.Initialize(); const bool keypoint_init_success = sift_keypoint_detector.Initialize(); std::vector sift_keypoints; const bool detection_success = sift_keypoint_detector.DetectKeypoints(input_image, &sift_keypoints); // Initialize descriptor extractor. SiftDescriptorExtractor sift_extractor; const bool descriptor_init_succes = sift_extractor.Initialize(); // E.g., compute a single descriptor Eigen::VectorXf sift_descriptor; bool sift_success = sift_extractor.ComputeDescriptor(input_image, keypoint[0], &sift_descriptor); // E.g., compute many descriptors. std::vector sift_descriptors; const bool extraction_success = sift_extractor.ComputeDescriptors(image, &sift_keypoints, &sift_descriptors) ``` -------------------------------- ### Link Theia with CMake Source: http://theia-sfm.org/index.html Use these commands in your CMakeLists.txt to find and link the Theia library after running make install. ```cmake find_package(Theia REQUIRED) include_directories(${THEIA_INCLUDE_DIRS}) target_link_libraries(my_library ${THEIA_LIBRARIES}) ``` -------------------------------- ### Add view pairs to ViewGraph Source: http://theia-sfm.org/sfm.html Creates a ViewGraph and adds edges for view pairs with strong visual coherence, based on the number of matched features. The example shows how to iterate over view pair matches and add edges only when the match count exceeds a threshold. ```cpp std::vector views; // Match all views in the set. std::vector view_pair_matches; ViewGraph view_graph; for (const auto& view_pair : view_pair_matches) { const ViewIdPair& view_id_pair = view_pair.first; const TwoViewInfo& two_view_info = view_pair.second; // Only add view pairs to the view graph if they have strong visual coherence. if (two_view_info.num_matched_features > min_num_matched_features) { view_graph.AddEdge(views[view_id_pair.first], views[view_id_pair.second], two_view_info); } } // Process and/or manipulate the view graph. ``` -------------------------------- ### Using Ransac with LineEstimator in C++ Source: http://theia-sfm.org/ransac.html Shows how to use the Ransac class with a LineEstimator to fit a line to data containing inliers and outliers. It sets RansacParameters with error_thresh, creates a Ransac object, calls Initialize() (which must always be called), and then Estimate() to obtain the best line and a RansacSummary. The example logs the estimated line parameters m and b. ```cpp int main (int argc, char** argv) { // Generate your input data using your desired method. // We put pseudo-code here for simplicity. std::vector input_data; // Add 700 inliers. for (int i = 0; i < 700; i++) { input_data.push_back(inlier_point); } // Add 300 outliers. for (int i = 0; i < 300; i++) { input_data.push_back(outlier_point); } // Specify RANSAC parameters. double error_threshold = 0.3; int min_num_inliers = 600; int max_iters = 1000; // Estimate the line with RANSAC. LineEstimator line_estimator; Line best_line; // Set the ransac parameters. RansacParameters params; params.error_thresh = 0.1; // Create Ransac object, specifying the number of points to sample to // generate a model estimation. Ransac ransac_estimator(params, line_estimator); // Initialize must always be called! ransac_estimator.Initialize(); RansacSummary summary; ransac_estimator.Estimate(input_data, &best_line, &summary); LOG(INFO) << "Line m = " << best_line.m << "*x + " << best_line.b; return 0; } ``` -------------------------------- ### SiftDetector Constructor Source: http://theia-sfm.org/features.html Constructor for the SIFT keypoint detector, which uses VLFeat as the underlying engine. Parameters define the number of octaves, scale levels, and the starting octave. ```cpp SiftDetector::SiftDetector(int _num_octaves , int _num_scale_levels , int _first_octave) ``` -------------------------------- ### Line estimation example with RANSAC Source: http://theia-sfm.org/ransac.html Defines a Point data structure, a Line model, and a LineEstimator class that estimates a line from two points and calculates the error as the y distance. This is used to illustrate the RANSAC interface. ```cpp // Our "data". struct Point { double x; double y; }; // Our "model". struct Line { double m; double b; }; // Estimator class. class LineEstimator: public Estimator { // Number of points needed to estimate a line. double SampleSize() { return 2; } // Estimate a line from two points. bool EstimateModel(const std::vector& data, std::vector* models) const { Line model; model.m = (data[1].y - data[0].y)/(data[1].x - data[0].x); model.b = data[1].y - model.m*data[1].x; models->push_back(model); return true; } // Calculate the error as the y distance of the point to the line. double Error(const Point& point, const Line& line) const { return point.y - (line.m*point.x + line.b); } }; ``` -------------------------------- ### Install Gerrit commit-msg hook manually Source: http://theia-sfm.org/contributions.html Installs the Gerrit commit-msg hook manually on Windows or when the automatic download fails. This hook adds Change-Id lines to commits. ```bash curl -o .git/hooks/commit-msg http://www.theia-sfm.org/_static/commit-msg chmod +x .git/hooks/commit-msg ``` -------------------------------- ### Instantiate and use FeatureMatcher Source: http://theia-sfm.org/features.html Demonstrates how to configure matcher options, add images to the matcher, and perform matching with or without geometric verification. ```cpp FeatureMatcherOptions matcher_options; BruteForceFeatureMatcher matcher(matcher_options); // Or to instantiate the cascade hashing matcher: CascadeHashingFeatureMatcher matcher(matcher_options); // Add image features to the matcher. for (int i = 0; i < num_images_to_match; i++) { matcher.AddImage(image_name[i], keypoints[i], descriptors[i]); // Or, you could add the image with known intrinsics for use during // geometric verification. matcher.AddImage(image_name[i], keypoints[i], descriptors[i], intrinsics[i]); } std::vector matches; matcher.MatchImages(&matches); // Or, with geometric verification: VerifyTwoViewMatchesOptions geometric_verification_options; matcher.MatchImages(geometric_verification_options, &matches); ``` -------------------------------- ### Build a 3D reconstruction using a flagfile Source: http://theia-sfm.org/applications.html Create a 3D reconstruction from images or matches by pointing the `build_reconstruction` application at a flagfile. Recommended to copy and adjust `build_reconstruction_flags.txt` for your dataset. ```bash ./bin/build_reconstruction --flagfile=/path/to/build_reconstruction_flags.txt ``` -------------------------------- ### Run any application with a flagfile Source: http://theia-sfm.org/applications.html Provide a single .txt file of all command line flags for any Theia application. The `--flagfile` flag loads the flags from the file. ```bash ./bin/build_reconstruction --flagfile=build_reconstruction_flags.txt ``` -------------------------------- ### View reconstruction with view_reconstruction Source: http://theia-sfm.org/applications.html Runs the view_reconstruction binary to open a basic OpenGL point cloud viewer. The reconstruction file can be generated using the ReconstructionWriter. The viewer displays points in black and cameras according to their intrinsic parameters. Controls include mouse drag to move/rotate, scroll or z to zoom, f to resize cameras, p to resize points, c to toggle camera wireframes, and t/T to adjust the minimum number of views for displaying a 3D point. ```bash ./bin/view_reconstruction --reconstruction=/path/to/theia/reconstruction ``` -------------------------------- ### Compare reconstructions with compare_reconstructions Source: http://theia-sfm.org/applications.html Runs the compare_reconstructions binary to align a reconstruction to a reference (ground truth) reconstruction and output statistics such as rotation difference, position difference, and intrinsic parameter differences. The reference_reconstruction is treated as ground truth; the reconstruction_to_align is aligned via a similarity transformation using cameras with the same name. ```bash ./bin/compare_reconstructions --reference_reconstruction=ground_truth_reconstruction --reconstruction_to_align=your_reconstruction --logtostderr ``` -------------------------------- ### Reproject a 3D point using the Camera class Source: http://theia-sfm.org/cameras.html Demonstrates setting up a camera with rotation and position, then reprojecting a homogeneous 3D point to a pixel coordinate. ```cpp // Open an image and obtain camera parameters. FloatImage image("my_image.jpg"); const Eigen::Matrix3d rotation = value obtained elsewhere... const Eigen::Vector3d position = value obtained elsewhere... // Set up the camera. Camera camera; camera.SetOrientationFromRotationMatrix(rotation); camera.SetPosition(position); // Obtain a homogeneous 3D point const Eigen::Vector4d homogeneous_point3d = value obtained elsewhere... // Reproject the 3D point to a pixel. Eigen::Vector2d reprojection_pixel; const double depth = camera.ProjectPoint(homogeneous_point3d, &pixel); if (depth < 0) { LOG(INFO) << "Point was behind the camera!"; } LOG(INFO) << "Homogeneous 3D point: " << homogeneous_point3d << " reprojected to the pixel value of " << reprojection_pixel; ``` -------------------------------- ### Build Theia with CMake and make Source: http://theia-sfm.org/building.html Run these commands from the Theia source directory to configure, build, and test the library. The build directory is created as 'theia-build'. ```bash mkdir theia-build cd theia-build cmake .. make -j4 make test ``` -------------------------------- ### Create Calibration File From EXIF Source: http://theia-sfm.org/applications.html Generates a calibration file by extracting EXIF information from a set of images. ```bash ./bin/create_calibration_file_from_exif --images=/path/to/images/*.jpg --output_calibration_file=/path/to/output/calibration.txt ``` -------------------------------- ### Read, Convert, and Write FloatImage Source: http://theia-sfm.org/image.html Demonstrates loading an image from a file, converting it to grayscale, and writing both the original and converted images to disk. ```cpp FloatImage my_rgb_image(img_filename); // Convert to grayscale. FloatImage my_grayscale_image = my_rgb_image.AsGrayscaleImage(); // ... do some stuff ... // // Write the image back out. my_rgb_image.Write(out_filename); my_grayscale_image.Write(out_filename); ``` -------------------------------- ### InitializeFromProjectionMatrix Source: http://theia-sfm.org/cameras.html Initializes the camera intrinsic and extrinsic parameters from a given projection matrix by decomposing it with a RQ decomposition. ```APIDOC ## InitializeFromProjectionMatrix ### Description Initializes the camera intrinsic and extrinsic parameters from the projection matrix by decomposing the matrix with a RQ decomposition. ### Method bool ### Parameters #### Parameters - **image_width** (int) - Required - The width of the image. - **image_height** (int) - Required - The height of the image. - **projection_matrix** (Matrix3x4d) - Required - The projection matrix to decompose. ### Notes The projection matrix does not contain information about radial distortion, so those parameters will need to be set separately. ``` -------------------------------- ### Compute reconstruction statistics with compute_reconstruction_statistics Source: http://theia-sfm.org/applications.html Runs the compute_reconstruction_statistics binary to output basic information about a reconstruction, including reprojection error, number of cameras, number of 3D points, and average observations per 3D point. ```bash ./bin/compute_reconstruction_statistics --reconstruction=my_reconstruction --logtostderr ``` -------------------------------- ### KeypointDetector::Initialize Source: http://theia-sfm.org/features.html Initializes any internal parameters that must be generated, precalculated, or otherwise are independent of the image. Must be called before using the keypoint detector. ```APIDOC ## KeypointDetector::Initialize ### Description Initializes any internal parameters that must be generated, precalculated, or otherwise are independent of the image. Must be called before using the keypoint detector. ### Method Initialize ### Parameters None. ### Response #### Success Response - **bool** - True if initialization succeeded, false otherwise. ``` -------------------------------- ### Solve L1 minimization with L1Solver Source: http://theia-sfm.org/math.html Demonstrates using L1Solver to minimize ||Ax - b|| under the L1 norm. Requires an initial guess for x and works with both sparse and dense matrices. ```cpp Eigen::MatrixXd A; Eigen::VectorXd b, x; // Fill A and b with known values. L1Solver::Options option; L1Solver l1_solver(options, A); l1_solver.Solve(b, &x); // x now contains the solution that minimizes ||Ax - b|| under L1 norm. ``` -------------------------------- ### Clone Theia repository from GerritHub Source: http://theia-sfm.org/contributions.html Clones the Theia repository from GerritHub. This is the first step after setting up git and a GitHub account. ```bash git clone https://review.gerrithub.io/sweeneychris/TheiaSfM ``` -------------------------------- ### DescriptorExtractor Interface Methods Source: http://theia-sfm.org/features.html Core methods for the DescriptorExtractor interface, including initialization and various computation methods for single or multiple descriptors. ```cpp bool DescriptorExtractor::Initialize() ``` ```cpp bool DescriptorExtractor::ComputeDescriptor(const FloatImage &_input_image , const Keypoint &_keypoint , Eigen::VectorXf *_float_descriptor_) ``` ```cpp bool DescriptorExtractor::ComputeDescriptors(const FloatImage &_input_image , std::vector *_keypoints , std::vector *_float_descriptors_) ``` ```cpp bool DescriptorExtractor::DetectAndExtractDescriptors(const FloatImage &_input_image , std::vector *_keypoints , std::vector *_float_descriptors_) ``` -------------------------------- ### Include Theia Header Source: http://theia-sfm.org/index.html Add this line to your program after building and linking the library to access Theia functionality. ```cpp #include ``` -------------------------------- ### Sync to latest master with rebase Source: http://theia-sfm.org/contributions.html Syncs your local repository to the latest commit on master before submitting, without interfering with your current patch. ```bash git pull --rebase origin master ``` -------------------------------- ### Build a reconstruction on the 1DSfM dataset Source: http://theia-sfm.org/applications.html Run Theia's reconstruction pipeline directly on the 1DSfM dataset using `build_1dsfm_reconstruction` with a tailored flagfile copied from `build_1dsfm_reconstruction_flags.txt`. ```bash ./bin/build_1dsfm_reconstruction --flagfile=/path/to/build_1dsfm_reconstruction_flags.txt ``` -------------------------------- ### Compute matching relative pose errors with compute_matching_relative_pose_errors Source: http://theia-sfm.org/applications.html Runs the compute_matching_relative_pose_errors binary to evaluate the accuracy of two-view matches and geometry against a ground truth reconstruction. Useful for comparing matching strategies such as brute force vs cascade hashing or whether to perform two-view bundle adjustment. ```bash ./bin/compute_matching_relative_pose_errors --matches=matches_file --reconstruction=ground_truth_reconstruction --logtostderr ``` -------------------------------- ### Keypoint::Keypoint Source: http://theia-sfm.org/features.html Constructor for the Keypoint class. Initializes a keypoint with the given x and y coordinates and keypoint type. ```APIDOC ## Keypoint::Keypoint ### Description Constructor for the Keypoint class. Initializes a keypoint with the given x and y coordinates and keypoint type. ### Method Constructor ### Parameters - **x** (double) - Required - The x-coordinate of the keypoint. - **y** (double) - Required - The y-coordinate of the keypoint. - **type** (KeypointType) - Required - The type of the keypoint (e.g., SIFT, OTHER). ### Request Example ```cpp Keypoint keypoint(100.0, 200.0, Keypoint::SIFT); ``` ### Response #### Success Response No return value. ``` -------------------------------- ### PoseFromThreePoints Source: http://theia-sfm.org/pose.html Computes camera pose using the three point algorithm and returns all possible solutions (up to 4). The output rotation and translation define world-to-camera transformation. ```APIDOC ## PoseFromThreePoints ### Description Computes camera pose using the three point algorithm and returns all possible solutions (up to 4). The output rotation and translation define world-to-camera transformation. ### Method PoseFromThreePoints ### Parameters - **feature_position** (Eigen::Vector2d[3]) - Required - Image points corresponding to model points. These should be calibrated image points as opposed to pixel values. - **world_point** (Eigen::Vector3d[3]) - Required - 3D location of features. - **solution_rotations** (std::vector*) - Required - The rotation matrix of the candidate solutions. - **solution_translations** (std::vector*) - Required - The translation of the candidate solutions. ### Returns - **bool** - Whether the pose was computed successfully, along with the output parameters `rotation` and `translation` filled with the valid poses. ### Notes Follows steps from the paper "A Novel Parameterization of the Perspective-Three-Point Problem for a direct computation of Absolute Camera position and Orientation" by [Kneip]. This algorithm has been proven to be up to an order of magnitude faster than other methods. ``` -------------------------------- ### Keypoint::set_x Source: http://theia-sfm.org/features.html Sets the x-coordinate of the keypoint. ```APIDOC ## Keypoint::set_x ### Description Sets the x-coordinate of the keypoint. ### Method Setter ### Parameters - **x** (double) - Required - The new x-coordinate. ### Response #### Success Response No return value. ``` -------------------------------- ### Push changes to GerritHub for review Source: http://theia-sfm.org/contributions.html Pushes the current commit to the Theia GerritHub instance for review. You will need to enter your GerritHub username and password, and the console will display a review URL. ```bash git push HEAD:refs/for/master ``` -------------------------------- ### Extract features from images Source: http://theia-sfm.org/applications.html Run Theia's `extract_features` application to extract and save specified features. Use `--descriptor=SIFT` for SIFT features, add `--logtostderr` to enable logging, and specify input images and output directory. ```bash ./bin/extract_features --input_images=/path/to/images/*.jpg --features_output_director=/path/to/output --num_threads=4 --descriptor=SIFT --logtostderr ``` -------------------------------- ### PixelToUnitDepthRay Source: http://theia-sfm.org/cameras.html Converts a pixel point to a ray in 3D space with origin at the camera center and direction based on camera orientation. ```APIDOC ## PixelToUnitDepthRay ### Description Converts the pixel point to a ray in 3D space such that the origin of the ray is at the camera center and the direction is the pixel direction rotated according to the camera orientation in 3D space. The returned vector is not unit length. ### Method Eigen::Vector3d ### Parameters #### Parameters - **pixel** (Eigen::Vector2d) - The pixel coordinates. ``` -------------------------------- ### Keypoint::orientation Source: http://theia-sfm.org/features.html Returns the orientation of the keypoint. ```APIDOC ## Keypoint::orientation ### Description Returns the orientation of the keypoint. ### Method Getter ### Parameters None. ### Response #### Success Response - **double** - The orientation value. ``` -------------------------------- ### Ransac class template for new RANSAC methods Source: http://theia-sfm.org/ransac.html Use this class definition as a template for implementing a new RANSAC variant that only changes the sampling or quality measurement. It derives from SampleConsensusEstimator and overrides Initialize() to set up a RandomSampler and the inlier support measurement, while inheriting the Estimate() method from the base class. ```cpp // NOTE: ModelEstimator must be a subclass of the Estimator class. template class Ransac : public SampleConsensusEstimator { public: typedef typename ModelEstimator::Datum Datum; typedef typename ModelEstimator::Model Model; explicit Ransac(const RansacParams& params, const ModelEstimator& estimator) : SampleConsensusEstimator(params, estimator) {} virtual ~Ransac() {} // Initializes the random sampler and inlier support measurement. bool Initialize() { Sampler* random_sampler = new RandomSampler(this->estimator_.SampleSize()); return SampleConsensusEstimator::Initialize( random_sampler, inlier_support); } }; ``` -------------------------------- ### Keypoint::set_strength Source: http://theia-sfm.org/features.html Sets the strength of the keypoint. ```APIDOC ## Keypoint::set_strength ### Description Sets the strength of the keypoint. ### Method Setter ### Parameters - **strength** (double) - Required - The new strength value. ### Response #### Success Response No return value. ``` -------------------------------- ### Keypoint::x Source: http://theia-sfm.org/features.html Returns the x-coordinate of the keypoint. ```APIDOC ## Keypoint::x ### Description Returns the x-coordinate of the keypoint. ### Method Getter ### Parameters None. ### Response #### Success Response - **double** - The x-coordinate. ``` -------------------------------- ### Keypoint::set_orientation Source: http://theia-sfm.org/features.html Sets the orientation of the keypoint. ```APIDOC ## Keypoint::set_orientation ### Description Sets the orientation of the keypoint. ### Method Setter ### Parameters - **orientation** (double) - Required - The new orientation value. ### Response #### Success Response No return value. ``` -------------------------------- ### Access Pixel Values in FloatImage Source: http://theia-sfm.org/image.html Shows how to access pixel values using either xy coordinates or row and column indices, and verifying the results with CHECK_EQ. ```cpp // Load RGB and scale images. FloatImage my_img("test_img.jpg"); // Get the middle pixel location. int middle_x = my_img.Width()/2; int middle_y = my_img.Height()/2; // Grab the middle pixel. const Eigen::Vector3f middle_xy_pixel = my_img.GetXY(middle_x, middle_y); // Get the middle pixel location. int middle_row = my_img.Rows()/2; int middle_col = my_img.Cols()/2; // Grab the middle pixel. const Eigen::Vector3f middle_row_pixel = my_img.GetRowCol(middle_row, middle_col); // The rgb values should be the same for both pixels. CHECK_EQ(middle_xy_pixel(0), middle_row_pixel(0)); CHECK_EQ(middle_xy_pixel(1), middle_row_pixel(1)); CHECK_EQ(middle_xy_pixel(2), middle_row_pixel(2)); ``` -------------------------------- ### Keypoint::scale Source: http://theia-sfm.org/features.html Returns the scale of the keypoint. ```APIDOC ## Keypoint::scale ### Description Returns the scale of the keypoint. ### Method Getter ### Parameters None. ### Response #### Success Response - **double** - The scale value. ``` -------------------------------- ### Feature Matching API Source: http://theia-sfm.org/features.html Documentation for the SIFT descriptor extractor and the FeatureMatcher class, including its methods and options. ```APIDOC ## SiftDescriptorExtractor::SiftDescriptorExtractor(int _num_octaves_, int _num_scale_levels_, int _first_octave_) ### Description Constructor for the SIFT descriptor extractor. It uses the VLFeat engine and implements the standard 128-dimension descriptor. The parameters control the number of image octaves, scale levels per octave, and the starting octave. ### Method Constructor ### Parameters - **num_octaves** (int) - Optional - Number of image octaves. Default is -1 (as many as can be generated). - **num_scale_levels** (int) - Optional - Number of scale levels per octave. Default is 3. - **first_octave** (int) - Optional - The octave where the first octave should start. Default is 0 (source image). ### Notes This algorithm is patented and commercial use requires a license. ``` ```APIDOC ## FeatureMatcher::FeatureMatcher(const FeatureMatcherOptions &_options_) ### Description Initializes a feature matcher based on the provided options. ### Method Constructor ### Parameters - **options** (FeatureMatcherOptions) - Required - The options for feature matching. ``` ```APIDOC ## void FeatureMatcher::AddImage(const std::string &_image_name_, const std::vector &_keypoints_, const std::vector &_descriptors_) ### Description Adds an image to the matcher with no known intrinsics. The image name must be a unique identifier. ### Method AddImage ### Parameters - **image_name** (std::string) - Required - Unique identifier for the image. - **keypoints** (std::vector) - Required - Keypoints of the image. - **descriptors** (std::vector) - Required - Descriptors of the image. ``` ```APIDOC ## void FeatureMatcher::AddImage(const std::string &_image_name_, const std::vector &_keypoints_, const std::vector &_descriptors_, const CameraIntrinsics &_intrinsics_) ### Description Adds an image to the matcher with known camera intrinsics. The intrinsics are used for geometric verification. The image name must be a unique identifier. ### Method AddImage ### Parameters - **image_name** (std::string) - Required - Unique identifier for the image. - **keypoints** (std::vector) - Required - Keypoints of the image. - **descriptors** (std::vector) - Required - Descriptors of the image. - **intrinsics** (CameraIntrinsics) - Required - Camera intrinsics for the image. ``` ```APIDOC ## void FeatureMatcher::MatchImages(std::vector *_matches_) ### Description Matches features between all images. No geometric verification is performed. Only successful image matches will be returned. ### Method MatchImages ### Parameters - **matches** (std::vector*) - Required - Output parameter that will contain the matched image pairs. ``` ```APIDOC ## void FeatureMatcher::MatchImagesWithGeometricVerification(const VerifyTwoViewMatchesOptions &_verification_options_, std::vector *_matches_) ### Description Matches features between all images. Only the matches that pass geometric verification are returned. Camera intrinsics are used for geometric verification if the image was added with known intrinsics. ### Method MatchImagesWithGeometricVerification ### Parameters - **verification_options** (VerifyTwoViewMatchesOptions) - Required - Options for geometric verification. - **matches** (std::vector*) - Required - Output parameter that will contain the matched image pairs. ``` ```APIDOC ## void FeatureMatcher::SetImagePairsToMatch(const std::vector> &_pairs_to_match_) ### Description Sets the image pairs that will be matched when MatchImages or MatchImagesWithGeometricVerification is called. This is optional; if not called, all possible image-to-image pairs will be matched. ### Method SetImagePairsToMatch ### Parameters - **pairs_to_match** (std::vector>) - Required - Unique pairs of image names to match. ``` ```APIDOC ## FeatureMatcherOptions ### Description Options for feature matching. Adjusting these options will change the number of matched features and the quality of matching. ### Fields - **num_threads** (int) - Optional - Default: 1. Number of threads to use for image-to-image matching. - **match_out_of_core** (bool) - Optional - Default: false. If true, matching is performed out-of-core. - **keypoints_and_descriptors_output_dir** (std::string) - Optional - Default: "". Directory where features are written/read when out-of-core matching is enabled. - **cache_capacity** (int) - Optional - Default: 128. Maximum number of images to store in the cache when out-of-core matching is enabled. ``` -------------------------------- ### Keypoint::set_scale Source: http://theia-sfm.org/features.html Sets the scale of the keypoint. ```APIDOC ## Keypoint::set_scale ### Description Sets the scale of the keypoint. ### Method Setter ### Parameters - **scale** (double) - Required - The new scale value. ### Response #### Success Response No return value. ``` -------------------------------- ### Cite Theia Manual Source: http://theia-sfm.org/index.html Use this BibTeX entry to cite the Theia Multiview Geometry Library in academic publications. ```bibtex @misc{theia-manual, author = {Chris Sweeney}, title = {Theia Multiview Geometry Library: Tutorial & Reference}, howpublished = "\url{http://theia-sfm.org}", } ``` -------------------------------- ### Keypoint::strength Source: http://theia-sfm.org/features.html Returns the strength of the keypoint. ```APIDOC ## Keypoint::strength ### Description Returns the strength of the keypoint. ### Method Getter ### Parameters None. ### Response #### Success Response - **double** - The strength value. ``` -------------------------------- ### KeypointDetector::DetectKeypoints Source: http://theia-sfm.org/features.html Detects keypoints in the given input image and outputs them to the provided vector. ```APIDOC ## KeypointDetector::DetectKeypoints ### Description Detects keypoints in the given input image and outputs them to the provided vector. ### Method DetectKeypoints ### Parameters - **input_image** (const FloatImage&) - Required - The image on which to detect keypoints. - **output_keypoints** (std::vector*) - Required - A pointer to a vector that will hold the detected keypoints. The vector should be empty when passed to this function. ### Request Example ```cpp FloatImage input_image(input_image_filename); std::vector detected_keypoints; bool success = keypoint_detector.DetectKeypoints(input_image, &detected_keypoints); ``` ### Response #### Success Response - **bool** - True if detection succeeded, false otherwise. ``` -------------------------------- ### GetCalibrationMatrix Source: http://theia-sfm.org/cameras.html Returns the calibration matrix of the camera in the form specified above. ```APIDOC ## GetCalibrationMatrix ### Description Returns the calibration matrix of the camera in the form specified above. ### Method void ### Parameters #### Parameters - **kmatrix** (Eigen::Matrix3d*) - Pointer to the output matrix where the calibration matrix will be stored. ``` -------------------------------- ### Keypoint::set_keypoint_type Source: http://theia-sfm.org/features.html Sets the type of the keypoint. ```APIDOC ## Keypoint::set_keypoint_type ### Description Sets the type of the keypoint. ### Method Setter ### Parameters - **type** (KeypointType) - Required - The new keypoint type. ### Response #### Success Response No return value. ``` -------------------------------- ### BibTeX citation for Theia manual Source: http://theia-sfm.org/license.html Use this BibTeX entry to cite the Theia manual in academic publications. The entry is named theia-manual and includes the author, title, and URL. ```bibtex @misc{theia-manual, author = {Chris Sweeney}, title = {Theia Multiview Geometry Library: Tutorial \& Reference}, howpublished = "\url{http://theia-sfm.org}", } ``` -------------------------------- ### Keypoint::keypoint_type Source: http://theia-sfm.org/features.html Returns the type of the keypoint (e.g., SIFT, OTHER). ```APIDOC ## Keypoint::keypoint_type ### Description Returns the type of the keypoint (e.g., SIFT, OTHER). ### Method Getter ### Parameters None. ### Response #### Success Response - **KeypointType** - The keypoint type. ``` -------------------------------- ### Estimator class template Source: http://theia-sfm.org/ransac.html Base class for RANSAC estimators. Must implement EstimateModel(), SampleSize(), and Error(); other methods are optional and enhance output. ```cpp template class Estimator { public: Estimator() {} virtual ~Estimator() {} virtual double SampleSize() const = 0; virtual bool EstimateModel(const std::vector& data, std::vector* model) const = 0; virtual double Error(const Datum& data, const Model& model) const = 0; // Functions to optionally implement. virtual bool EstimateModelNonminimal(const std::vector& data, std::vector* model) const; virtual bool RefineModel(const std::vector& data, Model* model) const; virtual bool ValidModel(const Model& model) const; // Helper methods implemented in base class. virtual std::vector Residuals(const std::vector& data, const Model& model) const; std::vector GetInliers(const std::vector& data, const Model& model, double error_threshold) const; int GetNumInliers(const std::vector& data, const Model& model, double error_threshold) const; }; ``` -------------------------------- ### Keypoint::has_orientation Source: http://theia-sfm.org/features.html Checks if the orientation attribute is set. ```APIDOC ## Keypoint::has_orientation ### Description Checks if the orientation attribute is set. ### Method Getter ### Parameters None. ### Response #### Success Response - **bool** - True if orientation is set, false otherwise. ``` -------------------------------- ### Keypoint Class Definition Source: http://theia-sfm.org/features.html The Keypoint class is a structure for storing keypoint information such as position, strength, scale, and orientation. ```cpp class Keypoint { public: enum KeypointType { INVALID = -1, OTHER = 0, SIFT, }; Keypoint(double x, double y, KeypointType type); ~Keypoint() {} // Required Keypoint type. inline KeypointType keypoint_type() const; inline void set_keypoint_type(KeypointType type); // Required Variable x. inline double x() const; inline void set_x(double x); // Required Variable y. inline double y() const; inline void set_y(double y); // Optional variable strength. inline bool has_strength() const; inline double strength() const; inline void set_strength(double strength); // Optional variable scale. inline bool has_scale() const; inline double scale() const; inline void set_scale(double scale); // Optional variable orientation. inline bool has_orientation() const; inline double orientation() const; inline void set_orientation(double orientation); }; ``` -------------------------------- ### TwoViewInfo struct definition Source: http://theia-sfm.org/sfm.html Defines the TwoViewInfo struct that stores focal lengths, relative position and rotation, and the number of verified matches between two images. This struct serves as the edge value in the ViewGraph. ```cpp struct TwoViewInfo { double focal_length_1; double focal_length_2; Eigen::Vector3d position_2; Eigen::Vector3d rotation_2; // Number of features that were matched and geometrically verified betwen the // images. int num_verified_matches; }; ``` -------------------------------- ### GetProjectionMatrix Source: http://theia-sfm.org/cameras.html Returns the projection matrix of the camera. Does not include radial distortion. ```APIDOC ## GetProjectionMatrix ### Description Returns the projection matrix of the camera. Does not include radial distortion. ### Method void ### Parameters #### Parameters - **pmatrix** (Matrix3x4d*) - Required - Pointer to the output matrix where the projection matrix will be stored. ``` -------------------------------- ### Keypoint::has_strength Source: http://theia-sfm.org/features.html Checks if the strength attribute is set. ```APIDOC ## Keypoint::has_strength ### Description Checks if the strength attribute is set. ### Method Getter ### Parameters None. ### Response #### Success Response - **bool** - True if strength is set, false otherwise. ``` -------------------------------- ### SetFromCameraIntrinsicsPriors Source: http://theia-sfm.org/cameras.html Sets the camera intrinsics parameters from a CameraIntrinsicsPrior object, including the camera model. ```APIDOC ## SetFromCameraIntrinsicsPriors ### Description Sets the camera intrinsics parameters from the priors, including the camera model. ### Method void ### Parameters #### Parameters - **prior** (CameraIntrinsicsPrior) - Required - The prior containing the camera intrinsics parameters. ``` -------------------------------- ### Keypoint::y Source: http://theia-sfm.org/features.html Returns the y-coordinate of the keypoint. ```APIDOC ## Keypoint::y ### Description Returns the y-coordinate of the keypoint. ### Method Getter ### Parameters None. ### Response #### Success Response - **double** - The y-coordinate. ``` -------------------------------- ### Keypoint::set_y Source: http://theia-sfm.org/features.html Sets the y-coordinate of the keypoint. ```APIDOC ## Keypoint::set_y ### Description Sets the y-coordinate of the keypoint. ### Method Setter ### Parameters - **y** (double) - Required - The new y-coordinate. ### Response #### Success Response No return value. ``` -------------------------------- ### Keypoint::has_scale Source: http://theia-sfm.org/features.html Checks if the scale attribute is set. ```APIDOC ## Keypoint::has_scale ### Description Checks if the scale attribute is set. ### Method Getter ### Parameters None. ### Response #### Success Response - **bool** - True if scale is set, false otherwise. ``` -------------------------------- ### Amend last commit after review Source: http://theia-sfm.org/contributions.html Updates the last commit after addressing review comments, combining the original patch and updates into a single commit. You can edit the commit message, and Gerrit uses the Change-Id to match the new commit with the previous one. ```bash git commit --amend -a ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.