// Copyright (c) 2018, ETH Zurich and UNC Chapel Hill. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // * Neither the name of ETH Zurich and UNC Chapel Hill nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de) #ifndef COLMAP_SRC_UTIL_TYPES_H_ #define COLMAP_SRC_UTIL_TYPES_H_ #include "util/alignment.h" #ifdef _MSC_VER #if _MSC_VER >= 1600 #include #else typedef __int8 int8_t; typedef __int16 int16_t; typedef __int32 int32_t; typedef __int64 int64_t; typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; #endif #elif __GNUC__ >= 3 #include #endif // Define non-copyable or non-movable classes. #define NON_COPYABLE(class_name) \ class_name(class_name const&) = delete; \ void operator=(class_name const& obj) = delete; #define NON_MOVABLE(class_name) class_name(class_name&&) = delete; #include namespace Eigen { typedef Eigen::Matrix Matrix3x4f; typedef Eigen::Matrix Matrix3x4d; typedef Eigen::Matrix Vector3ub; typedef Eigen::Matrix Vector4ub; typedef Eigen::Matrix Vector6d; } // namespace Eigen namespace colmap { //////////////////////////////////////////////////////////////////////////////// // Index types, determines the maximum number of objects. //////////////////////////////////////////////////////////////////////////////// // Unique identifier for cameras. typedef uint32_t camera_t; // Unique identifier for images. typedef uint32_t image_t; // Each image pair gets a unique ID, see `Database::ImagePairToPairId`. typedef uint64_t image_pair_t; // Index per image, i.e. determines maximum number of 2D points per image. typedef uint32_t point2D_t; // Unique identifier per added 3D point. Since we add many 3D points, // delete them, and possibly re-add them again, the maximum number of allowed // unique indices should be large. typedef uint64_t point3D_t; // Values for invalid identifiers or indices. const camera_t kInvalidCameraId = std::numeric_limits::max(); const image_t kInvalidImageId = std::numeric_limits::max(); const image_pair_t kInvalidImagePairId = std::numeric_limits::max(); const point2D_t kInvalidPoint2DIdx = std::numeric_limits::max(); const point3D_t kInvalidPoint3DId = std::numeric_limits::max(); } // namespace colmap // This file provides specializations of the templated hash function for // custom types. These are used for comparison in unordered sets/maps. namespace std { // Hash function specialization for uint32_t pairs, e.g., image_t or camera_t. template <> struct hash> { std::size_t operator()(const std::pair& p) const { const uint64_t s = (static_cast(p.first) << 32) + static_cast(p.second); return std::hash()(s); } }; } // namespace std #endif // COLMAP_SRC_UTIL_TYPES_H_