logo

编译

环境:Ubuntu20.04

版本

  1. 如果系统中预先有一些旧依赖。首先会碰到 cmake 的 include 目录正确,但是 lib 寻找目录错误的问题。详见这个 issue。根据这篇文章,通过设置 CMake 搜索的优先级,可以解决路径查询问题。解决方案

  2. 编译 aliceVision,为了省时,可以将项目分为两部分编译。

    1. 使用 CMakeLists 里面的内置方法对依赖进行编译。

    2. 在 CMakeLists 中关闭依赖编译后,再对项目进行单独编译。

  3. Ubuntu20.04 默认版本为 3.16 尝试使用代理失败。但是换成官网源码编译的 3.22 后代理能正常工作了。

  4. 不确定问题:将 CMAKE_PREFIX_PATH 设置成依赖安装目录后,CMake 会出现以下 warning:

    CMake Warning (dev) in src/CMakeLists.txt:
    Policy CMP0111 is not set: An imported target missing its location property
    fails during generation.  Run "cmake --help-policy CMP0111" for policy
    details.  Use the cmake_policy command to set the policy and suppress this
    warning.
    
    IMPORTED_LOCATION not set for imported target "assimp::assimp"
    configuration "Debug".
    

    进而导致 make 的规则中找不到 assimp 的依赖。

    Linux-x86_64/libaliceVision_mesh.so.2.4: assimp::assimp-NOTFOUND
    

    build.make

    解决办法:按照 warning 提示添加 IMPORTED_LOCATION

    # /home/chunibyo/workspace/AliceVision/src/aliceVision/mesh/CMakeLists.txt
    set_target_properties(assimp::assimp PROPERTIES IMPORTED_LOCATION "${ASSIMP_LIBRARY_DIRS}/${ASSIMP_LIBRARIES}")

    build.make

调试

aliceVision 分为前端后端两个部分。

后端编译得到一系列可执行二进制文件,可以通过命令行调用,默认生成在 /home/chunibyo/workspace/AliceVision/build/Linux-x86_64 路径下。 前端通过 subprocess.Popen 对后端的二进制文件进行调用。

因为对 c++ 的调用方式子进程,所以很难直接 gdb 进 python 进程后对 c++ 进行 debug。解决办法是设法使后端的进程停住,然后在 CLion 中直接 attach 进去。

attach to process

debug

aliceVision_cameraInit

处理照片的元信息。

命令:

aliceVision_cameraInit  --sensorDatabase "/home/chunibyo/workspace/AliceVision/src/aliceVision/sensorDB/cameraSensors.db" --defaultFieldOfView 45.0 --groupCameraFallback folder --allowedCameraModels pinhole,radial1,radial3,brown,fisheye4,fisheye1,3deanamorphic4,3deradial4,3declassicld --useInternalWhiteBalance True --viewIdMethod metadata --verboseLevel info --output "/home/chunibyo/workspace/meshroom_cache/tmp/MeshroomCache/CameraInit/db58d443c068acdfe5245d3670f4ba016ff52160/cameraInit.sfm" --allowSingleView 1 --input "/home/chunibyo/workspace/meshroom_cache/tmp/MeshroomCache/CameraInit/db58d443c068acdfe5245d3670f4ba016ff52160/viewpoints.sfm"

参数:

  1. sensorDatabase:拍摄设备的先验硬件信息 txt 数据库。

  2. groupCameraFallback:

    1. global

    2. folder

    3. image

rig:https://github.com/alicevision/meshroom/wiki/Multi-Camera-Rig

同时支持输入初始位姿。

aliceVision_featureExtraction

主要计算代码

The SIFT detector is controlled mainly by two parameters: the peak threshold and the (non) edge threshold.

The peak threshold filters peaks of the DoG scale space that are too small (in absolute value). Peak_thresh 越大,特征点越少。

image-20220608142628146

The edge threshold eliminates peaks of the DoG scale space whose curvature is too small (such peaks yield badly localized frames). edge_thresh 越大,特征越多。

image-20220608143038666

  1. 可选特征点
std::string EImageDescriberType_informations()
{
  return  "Describer types used to describe an image:\n"
          "* sift: Scale-invariant feature transform.\n"
          "* sift_float: SIFT stored as float.\n"
          "* sift_upright: SIFT with upright feature.\n"
          "* akaze: A-KAZE with floating point descriptors.\n"
          "* akaze_liop: A-KAZE with Local Intensity Order Pattern descriptors.\n"
          "* akaze_mldb: A-KAZE with Modified-Local Difference Binary descriptors.\n"
#if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_CCTAG)
          "* cctag3: Concentric circles markers with 3 crowns.\n"
          "* cctag4: Concentric circles markers with 4 crowns.\n"
#endif
#if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_APRILTAG)
          "* tag16h5: AprilTag family tag16h5.\n"
#endif
#if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_OPENCV)
#if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_OCVSIFT)
          "* sift_ocv: OpenCV implementation of SIFT describer.\n"
#endif
          "* akaze_ocv: OpenCV implementation of A-KAZE describer.\n"
#endif
          "";
}
  1. ConfigurationPreset: 特征点预设,默认 NORMAL
/**
* @brief The preset to control the number of detected regions
*/
enum class EImageDescriberPreset
{
  LOW = 0
  , MEDIUM
  , NORMAL
  , HIGH
  , ULTRA
};
  1. maxNbFeatures:手动设置特征点数目的方法

  2. describerQuality: 手动设置特征点的质量。提高质量后会增加scale层数。It’s a trade-off between performance and precision.

  3. contrastFiltering: 默认是 static,根据某种标准对关键点进行权重排序

    /**
    * @brief The method used to filter out features with too low constrast (that can be considered as noise).
    */
    enum class EFeatureConstrastFiltering
    {
        /// Use a fixed threshold for all the pixels
        Static = 0,
        /// Use a threshold for each image based on image statistics
        AdaptiveToMedianVariance,
        /// Disable contrast filtering
        NoFiltering,
        /// Grid sort by peak value per octave and by scale at the end
        GridSortOctaves,
        /// Grid sort by scale*peakValue per octave and at the end
        GridSort,
        /// Grid sort per scale steps and at the end (scale and then peak value)
        GridSortScaleSteps,
        /// Grid sort per octaves and at the end (scale and then peak value)
        GridSortOctaveSteps,
        /// Filter non-extrema peak values
        NonExtremaFiltering
    };
  1. relativePeakThreshold: dynPeakTreshold = relativePeakThreshold * medianOfGradiants

  2. gridFiltering: 指的是尽量不使得某个格子内的特征点过于密集。首先会根据 scale 或者 peak 等进行排序。分为留下的和舍弃两部分特征点。