diff --git a/CMakeLists.txt b/CMakeLists.txt index e6277b4..a906007 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,16 @@ cmake_minimum_required(VERSION 3.4) +if(WIN32) + set(BUILD_WIN32_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build_win32) + if( NOT DEFINED VCPKG_BUILT ) + include(${BUILD_WIN32_DIR}/automate-vcpkg-tks.cmake) + include(${BUILD_WIN32_DIR}/vcpkg_list.cmake) + vcpkg_install_packages(${VCPACKAGES}) + set(VCPKG_BUILT TRUE CACHE BOOL "vcpkg_install_packages has run") + endif() +endif(WIN32) + project(Facebook360_DEP CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -30,31 +40,36 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -m64 -O3 -funroll-loops -pipe") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mmmx -mavx -msse -msse3") - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wsign-compare") +if(UNIX) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -m64 -O3 -funroll-loops -pipe") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mmmx -mavx -msse -msse3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wsign-compare") +elseif(WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX=1 -DUNICODE") +endif() if(BUILD_LINE_COVERAGE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping") endif() -if(NOT APPLE) +if(UNIX AND NOT APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") endif() -# Add extra directories that may not have been added by default -set(OPT_LOCAL_DIR "/opt/local") -if(EXISTS "${OPT_LOCAL_DIR}/lib") - link_directories("${OPT_LOCAL_DIR}/lib") - include_directories(SYSTEM "${OPT_LOCAL_DIR}/include") -endif() - -set(USR_LOCAL_DIR "/usr/local") -if(EXISTS "${USR_LOCAL_DIR}/lib") - link_directories("${USR_LOCAL_DIR}/lib") - include_directories(SYSTEM "${USR_LOCAL_DIR}/include") -endif() +if(UNIX) + # Add extra directories that may not have been added by default + set(OPT_LOCAL_DIR "/opt/local") + if(EXISTS "${OPT_LOCAL_DIR}/lib") + link_directories("${OPT_LOCAL_DIR}/lib") + include_directories(SYSTEM "${OPT_LOCAL_DIR}/include") + endif() + + set(USR_LOCAL_DIR "/usr/local") + if(EXISTS "${USR_LOCAL_DIR}/lib") + link_directories("${USR_LOCAL_DIR}/lib") + include_directories(SYSTEM "${USR_LOCAL_DIR}/include") + endif() +endif(UNIX) # Add custom targets to show all source and header files in Xcode file(GLOB SRC "${CMAKE_CURRENT_SOURCE_DIR}/source/*") @@ -71,9 +86,11 @@ set(OPENCV_COMPONENTS # When adding Boost::chrono to target_link_libraries make sure it is listed after Boost::timer # because Boost::timer depends on Boost::chrono -find_package(Boost REQUIRED COMPONENTS chrono filesystem system program_options regex timer) +find_package(Boost REQUIRED COMPONENTS chrono filesystem system program_options regex timer locale) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") +if(UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") +endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(Ceres 1.14 REQUIRED) @@ -83,13 +100,18 @@ find_package(Eigen3 3.3 REQUIRED) find_package(double-conversion 3.0) include_directories(${EIGEN3_INCLUDE_DIR}) +if(WIN32) + find_package(zlib REQUIRED) + find_package(gtest REQUIRED) +endif() + if(APPLE) set(FOLLY_LIB folly) else() find_package(Folly REQUIRED) set(FOLLY_LIB Folly::folly) endif() -set(FOLLY_TARGET ${FOLLY_LIB} double-conversion) +set(FOLLY_TARGET ${FOLLY_LIB}) ###### Targets ###### @@ -166,7 +188,6 @@ target_link_libraries( ) ### TARGET DepUnitTest ### - add_executable( DepUnitTest source/test/DepUnitTest.cpp @@ -197,8 +218,12 @@ target_link_libraries( ) ### TARGET ConvertToBinary ### +if(UNIX) + include("${CMAKE_CURRENT_SOURCE_DIR}/ISPC.cmake") +elseif(WIN32) + include("${BUILD_WIN32_DIR}/ISPC-win32.cmake") +endif() -include("${CMAKE_CURRENT_SOURCE_DIR}/ISPC.cmake") add_executable( ConvertToBinary source/mesh_stream/ConvertToBinary.cpp @@ -428,6 +453,7 @@ target_link_libraries( Boost::program_options Boost::timer Boost::chrono + Boost::locale Eigen3::Eigen glog::glog ${OPENCV_COMPONENTS} diff --git a/build_win32/ISPC-win32.cmake b/build_win32/ISPC-win32.cmake new file mode 100644 index 0000000..aa38df0 --- /dev/null +++ b/build_win32/ISPC-win32.cmake @@ -0,0 +1,23 @@ +# ISPC-win32.cmake -- for Windows port of facebook360-dep +# created 12 Oct 2019 TKSharpless@gmail.com +# ISPC source at https://sourceforge.net/projects/ispcmirror/ was last updated in 2015 +# Only one component of facebook360-dep -- convertToBinary -- uses ispc +# Building ispc from source is complex and hard to automate but the result is a simple dll +# So I have chosen to ship prebuilt dlls, import libraries and header with fb360-dep. +# This script makes them visible to generated projects + +if(NOT DEFINED BUILD_WIN32_DIR) + set(BUILD_WIN32_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build_win32) +endif() + +set(TEXCOMP_DIR ${BUILD_WIN32_DIR}/ispc_texcomp) + +add_library( + ispc_texcomp SHARED IMPORTED GLOBAL + ${TEXCOMP_DIR}/ispc_texcomp.h +) + +set_target_properties(ispc_texcomp PROPERTIES IMPORTED_LOCATION_DEBUG ${TEXCOMP_DIR}/debug/ispc_texcomp.dll) +set_target_properties(ispc_texcomp PROPERTIES IMPORTED_IMPLIB_DEBUG ${TEXCOMP_DIR}/debug/ispc_texcomp.lib) +set_target_properties(ispc_texcomp PROPERTIES IMPORTED_LOCATION_RELEASE ${TEXCOMP_DIR}/release/ispc_texcomp.dll) +set_target_properties(ispc_texcomp PROPERTIES IMPORTED_IMPLIB_RELEASE ${TEXCOMP_DIR}/release/ispc_texcomp.lib) diff --git a/build_win32/automate-vcpkg-tks.cmake b/build_win32/automate-vcpkg-tks.cmake new file mode 100644 index 0000000..7ea27fd --- /dev/null +++ b/build_win32/automate-vcpkg-tks.cmake @@ -0,0 +1,191 @@ +#------------------------------------------------------------------------------------------------------------ +# +# Automate-VCPKG by Andre Taulien modified by T K Sharpless +# =============================== +# +# Project Repository: https://github.com/REGoth-project/Automate-VCPKG +# License ..........: MIT, see end of file. +# +# Based on: https://github.com/sutambe/cpptruths/blob/vcpkg_cmake_blog/cpp0x/vcpkg_test/CMakeLists.txt +# +# +# While [Vcpkg](https://github.com/microsoft/vcpkg) on it's own is awesome, it does add +# a little bit of complexity to getting a project to build. Even more if the one trying +# to compile your application is not too fond of the commandline. Additionally, CMake +# commands tend to get rather long with the toolchain path. +# +# To keep things simple for new users who just want to get the project to build, this +# script offers a solution. +# +# Lets assume your main `CMakelists.txt` looks something like this: +# +# cmake_minimum_required (VERSION 3.12.0) +# project (MyProject) +# +# add_executable(MyExecutable main.c) +# +# To integrate Vcpkg into that `CMakelists.txt`, simple put the following lines before the +# call to `project(MyProject)`: +# +# include(cmake/automate-vcpkg.cmake) +# +# vcpkg_bootstrap() +# vcpkg_install_packages(libsquish physfs) +# +# The call to `vcpkg_bootstrap()` will clone the official Vcpkg repository and bootstrap it. +# If it detected an existing environment variable defining a valid `VCPKG_ROOT`, it will +# update the existing installation of Vcpkg. +# +# Arguments to `vcpkg_install_packages()` are the packages you want to install using Vcpkg. +# +# If you want to keep the possibility for users to chose their own copy of Vcpkg, you can +# simply not run the code snippet mentioned above, something like this will work: +# +# option(SKIP_AUTOMATE_VCPKG "When ON, you will need to built the packages +# required by MyProject on your own or supply your own vcpkg toolchain.") +# +# if (NOT SKIP_AUTOMATE_VCPKG) +# include(cmake/automate-vcpkg.cmake) +# +# vcpkg_bootstrap() +# vcpkg_install_packages(libsquish physfs) +# endif() +# +# Then, the user has to supply the packages on their own, be it through Vcpkg or manually +# specifying their locations. +#------------------------------------------------------------------------------------------------------------ + +cmake_minimum_required (VERSION 3.12) + + +macro(_install_or_update_vcpkg) + if(NOT EXISTS ${VCPKG_ROOT}) + message(STATUS "Cloning vcpkg in ${VCPKG_ROOT}") + execute_process(COMMAND git clone https://github.com/Microsoft/vcpkg.git ${VCPKG_ROOT}) + + # If a reproducible build is desired (and potentially old libraries are # ok), uncomment the + # following line and pin the vcpkg repository to a specific githash. + # execute_process(COMMAND git checkout 745a0aea597771a580d0b0f4886ea1e3a94dbca6 WORKING_DIRECTORY ${VCPKG_ROOT}) + else() + # The following command has no effect if the vcpkg repository is in a detached head state. + message(STATUS "Auto-updating vcpkg in ${VCPKG_ROOT}") + execute_process(COMMAND git pull WORKING_DIRECTORY ${VCPKG_ROOT}) + endif() + + if(NOT EXISTS ${VCPKG_ROOT}/README.md) + message(FATAL_ERROR "***** FATAL ERROR: Could not clone vcpkg *****") + endif() + + if(WIN32) + set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg.exe) + set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.bat) + else() + set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg) + set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.sh) + endif() + + if(NOT EXISTS ${VCPKG_EXEC}) + message("Bootstrapping vcpkg in ${VCPKG_ROOT}") + execute_process(COMMAND ${VCPKG_BOOTSTRAP} WORKING_DIRECTORY ${VCPKG_ROOT}) + endif() + + if(NOT EXISTS ${VCPKG_EXEC}) + message(FATAL_ERROR "***** FATAL ERROR: Could not bootstrap vcpkg *****") + endif() + +endmacro() + +# Installs the list of packages given as parameters using Vcpkg +macro(vcpkg_install_packages) + + message("Installing/Updating vcpkg packages: ") + + if (VCPKG_TARGET_TRIPLET) + set(ENV{VCPKG_DEFAULT_TRIPLET} "${VCPKG_TARGET_TRIPLET}") + endif() + + foreach(PKG ${ARGN}) + message(STATUS "---- ${PKG} ---- ") + execute_process( + COMMAND ${VCPKG_EXEC} install ${PKG} + WORKING_DIRECTORY ${VCPKG_ROOT} + OUTPUT_QUIET + RESULT_VARIABLE RES + ) + if( ${RES} ) ## assume zero/null means OK + if(AUTOMATE_VCPKG_UPDATE) # try updating + execute_process( + COMMAND ${VCPKG_EXEC} install ${PKG} --recurse + WORKING_DIRECTORY ${VCPKG_ROOT} + RESULT_VARIABLE RES + ) + if( ${RES} ) + message(FATAL_ERROR "update ${PKG} failed") + endif() + else() + message(WARNING "install ${PKG} failed -- may want update") + endif() + endif() + endforeach() + +endmacro() + +# if user did not supply their own VCPKG toolchain file +# set default directory and toolchain names +if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) + if(NOT DEFINED ENV{VCPKG_ROOT}) + if(WIN32) + set(VCPKG_ROOT ${CMAKE_CURRENT_BINARY_DIR}/vcpkg) + else() + set(VCPKG_ROOT ${CMAKE_CURRENT_BINARY_DIR}/.vcpkg) + endif() + else() + set(VCPKG_ROOT $ENV{VCPKG_ROOT}) + endif() + # set the toolchain file name + set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE STRING "") + message("New CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE}") +else() + message("Existing CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE}") + string(REPLACE "/scripts/buildsystems/vcpkg.cmake" "" TPTH ${CMAKE_TOOLCHAIN_FILE}) + if(NOT DEFINED VCPKG_ROOT) + set(VCPKG_ROOT ${TPTH}) + elseif( NOT "${VCPKG_ROOT}" EQUAL "${TPTH}") + message(FATAL_ERROR "but existing VCPKG_ROOT is ${VCPKG_ROOT}") + endif() +endif() + +# make sure we have a working vcpkg instance +_install_or_update_vcpkg() +message(STATUS "AUTOMATE_VCPKG variables --") +message(STATUS " VCPKG_ROOT: ${VCPKG_ROOT}") +message(STATUS " VCPKG_EXEC: ${VCPKG_EXEC}") +message(STATUS " VCPKG_BOOTSTRAP: ${VCPKG_BOOTSTRAP}") +if (NOT ${VCPKG_TARGET_TRIPLET} EQUAL x64-windows) + message("VCPKG_TARGET_TRIPLET is ${VCPKG_TARGET_TRIPLET}, changing to x64-windows") + set(VCPKG_TARGET_TRIPLET x64-windows) +endif() + +##message(FATAL_ERROR "EXIT DEBUG TEST") + +# MIT License +# +# Copyright (c) 2019 REGoth-project +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. \ No newline at end of file diff --git a/build_win32/build_win32.txt b/build_win32/build_win32.txt new file mode 100644 index 0000000..87b2ce9 --- /dev/null +++ b/build_win32/build_win32.txt @@ -0,0 +1,72 @@ +Building facebook360-dep on Windows with Cmake and vcpkg + +These instructions pertain to the Windows port of facebook360-dep created Oct 2019 +by Thomas Sharpless . It has a directory named build_win32 +containing some cmake scripts and this file. + +== PACKAGES == + +Building facebook360-dep with cmake creates native executables to be run on the +machine that built them, as opposed to a Docker package that can run anywhere. +The Windows Docker package is not so useful since for technical reasons it cannot +use the local GPU. Moreover it limits the available processing scenarios. With +native executables you can apply the many programs that make up fb360-dep to a +wider variety of problems. + +Due to the GPU access problem, there is a sub-package in directory 'windows' to +build just the VR viewer component natively on Windows. On other platforms the +main cmake script builds the viewer too. + +The hardest part of building a big open source project is marshalling all the many +software packages it depends on. The modern way to do that is to use a package +manager, which knows how to find standard packages on the Internet and install them +in places where the build system can find them. This build uses vcpkg, a Microsoft +product available on Windows, OS X and Linux. vcpkg installs everything inside a +single directory that also contains the vcpkg executable, and sets no system-wide +state; its work can be completely undone just by deleting that directory. + +The master cmake script can install all required packages into directory 'vcpkg' +in the build directory. This can take several hours. In case you already +have a vcpkg instance containing some of those packages, you can tell cmake to +use that instead of creating a new one. In that case any missing packages will be +added to the existing instance, since only one instance can be active. + +The file build_win32/vcpkg_list.cmake contains the list of package names. + +Once the vcpkg directory is populated cmake configure will scan it and issue a +warning message for any package that has available updates. However it will not +automatically update those packages; to do that, you can use vcpkg commands. + +== BUILD == + +The build is controlled as usual by the file cmakelists.txt in the root directory +of the source package. I suggest you run it with cmake-gui; if you prefer the +command line, you presumably know how to translate these instructions. + +Start by pointing cmake at the source root and give it a new build directory name. +Click configure. Approve creating the build directory. In the dialog that next pops +up, select your compiler package -- which must be msvc 14 (VisualStudio 2017) or +later -- and the 'x64' platform -- mandatory because cmake still defaults to 32 bit +builds on Windows. + +To use an existing vcpkg instance, check "specify toolchain file for cross-compiling" +before clicking "next". In the new dialog, enter the full path to its vcpkg.cmake +file, example "C:/Users/Me/myvcpkg/scripts/buildsystems/vcpkg.cmake". Otherwise just +click "next" and cmake will create a new vcpkg instance in the build directory. In +either case, it will next invoke vcpkg to install all the needed packages. This can +take a long time when everything needs to be guilt fresh. + +Next, cmake should quickly find the dependencies and configure the build. If it +reports any errors, you must try to resolve them, for example by running external +install commands, then click configure again. + +When configure succeeds, click "generate". Cmake will put a Visual Studio solution +having around 40 projects in the build directory. You can open it by clicking "open" +on cmake-gui, or in the usual ways. + +Building the whole solution takes about 30 minutes. Many projects can be built +independently if you prefer. + + + + diff --git a/build_win32/help_listings.txt b/build_win32/help_listings.txt new file mode 100644 index 0000000..697f5e2 --- /dev/null +++ b/build_win32/help_listings.txt @@ -0,0 +1,498 @@ +Facebook360 Depth Estimation Pipeline (Windows Build) -- Module Help Printouts + obtaind by running .exe --help + +AlignColors.exe: + - Aligns colors using separate (calibrated) color rigs. + + - Example: + ./AlignColors \ + --output=/path/to/output \ + --color=/path/to/video/color \ + --calibrated_rig=/path/to/rigs/rig_calibrated.json \ + --rig_blue=/path/to/rigs/rig_blue.json \ + --rig_green=/path/to/rigs/rig_green.json \ + --rig_red=/path/to/rigs/rig_red.json + + +AlignPointCloud.exe: + - Aligns point cloud to camera rig. The transformation includes translation, rotation and scaling. + + - Example: + ./AlignPointCloud \ + --color=/path/to/background/color \ + --point_cloud=/path/to/lidar/points.pts \ + --rig_in=/path/to/rigs/rig.json \ + --rig_out=/path/to/rigs/rig_aligned.json + + +Calibration.exe: + - Calibrates an uncalibrated rig by feature matching and performing geometric calibration + on a sample frame. + + - Example: + ./Calibration \ + --color=/path/to/video/color \ + --matches=/path/to/output/matches.json \ + --rig_in=/path/to/rigs/rig.json \ + --rig_out=/path/to/rigs/rig_calibrated.json + + +CalibrationLib.exe +Usage: calibrationlib + + - Calibrates an uncalibrated rig by feature matching and performing geometric calibration + on a sample frame. Unlike Calibration, this app takes fixed command line arguments. + + - Example: + ./CalibrationLibMain \ + /path/to/rigs/rig_calibrated.json \ + /path/to/output/matches.json \ + /path/to/rigs/rig.json \ + /path/to/video/color + + +ComputeRephotographyErrors.exe: + - Computes rephotography error for a set of frames. Rephotography error for a single frame is + computed by generating cubemaps for both the reference and the rendered data, translating the + cubemap origin to the center of the reference camera, and computing the MSSIM for each camera. + + - Example: + ./ComputeRephotographyErrors \ + --first=000000 \ + --last=000000 \ + --output=/path/to/output \ + --rig=/path/to/rigs/rig.json \ + --color=/path/to/video/color \ + --disparity=/path/to/output/disparity + + +ConvertToBinary.exe(no help) + + +CorrectVignetting.exe: + - Correct vignetting in a single image. + + - Example: + ./CorrectVignetting \ + --out=/path/to/output/image \ + --principal_x=1680 \ + --principal_y=1080 \ + --raw=/path/to/raw/image + --vignetting_x="1.5,1.0,1.0,1.0,1.0,1.5" \ + --vignetting_y="1.5,1.0,1.0,1.0,1.0,1.5" + + +CreateObjFromDisparityEquirect.exe: + - Creates an OBJ (optionally with texturing) from a disparity equirect. + + - Example: + ./CreateObjFromDisparityEquirect \ + --input_png_color=/path/to/equirects/color.png \ + --input_png_disp=/path/to/equirects/disparity.png \ + --output_obj=/path/to/output/test.obj + + +DerpCLI.exe: + - Runs depth estimation on a set of frames. We assume the inputs have already been resized into + the appropriate pyramid level widths before execution. See scripts/render/config.py to see + the assumed widths. + + - Example: + ./DerpCLI \ + --input_root=/path/to/ \ + --output_root=/path/to/output \ + --rig=/path/to/rigs/rig.json \ + --first=000000 \ + --last=000000 + + +ExportPointCloud.exe: + - Reads a set of color and disparity images and produces an ascii file with a + single point per line + + Each line contains "x y z 1 r g b", where + - x y z is the position (in meters) + - r g b is the color (0..255) + + The format can be imported as a .txt into meshlab with File -> Import Mesh + set Separator to "SPACE" and set Point format to "X Y Z Reflectance R G B" + + - Example: + ./ExportPointCloud \ + --output=/path/to/video/output \ + --color=/path/to/video/color \ + --disparity=/path/to/output/disparity \ + --rig=/path/to/rigs/rig.json \ + --frame=000000 + + +GenerateCameraOverlaps.exe: + - Generates a series of images of the rig cameras projected into destination cameras over + a series of fixed depths. + + - Example: + ./GenerateCameraOverlaps \ + --frame=000000 \ + --output=/path/to/output \ + --rig=/path/to/rigs/rig.json \ + --color=/path/to/video/color + + A typical extension of this is creating a video over the series of depth generated, i.e.: + + ffmpeg -framerate 10 -pattern_type glob \ + -i '/path/to/output/overlaps/cam0/*.png' -c:v libx264 -pix_fmt yuv420p \ + -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" /path/to/output/overlaps/cam0.mp4 -y + + +GenerateEquirect.exe: + - Generates an equirect from a set of color images at a uniformly spaced range of depths. + + - Example: + ./GenerateEquirect \ + --color=/path/to/video/color \ + --output=/path/to/output \ + --rig=/path/to/rigs/rig.json \ + --frame=000000 \ + --depth_min=1.0 \ + --depth_max=1000.0 \ + --num_depths=50 + + +GenerateForegroundMasks.exe: + - Generates foreground masks for a series of frames assuming a fixed background. Various + parameters can be tweaked to improve the mask accuracy. + + - Example: + ./GenerateForegroundMasks \ + --first=000000 \ + --last=000000 \ + --rig=/path/to/rigs/rig.json \ + --color=/path/to/video/color \ + --background_color=/path/to/background/color \ + --foreground_masks=/path/to/video/output + + +GenerateKeypointProjections.exe: + - Reprojects a grid of keypoints to another camera at different depths. + + - Example: + ./GenerateKeypointProjections \ + --color=/path/to/video/color \ + --frame=000000 \ + --rig=/path/to/rigs/rig.json \ + --output_dir=/path/to/output + + +GeometricCalibration.exe: + - Performs geometric calibration on a sample frame. The results of the feature matcher should + be available before execution. + + - Example: + ./GeometricCalibration \ + --matches=/path/to/output/matches.json \ + --rig_in=/path/to/rigs/rig.json \ + --rig_out=/path/to/rigs/rig_calibrated.json + + +GeometricConsistency.exe: +- Compute initial depth for every camera +- Repeat pass_count times: + - Clean away depths that are implausible + - Recompute depths using clean depths to estimate occlusions + +- Example: + GeometricConsistency \ + --color /path/to/color \ + --output /path/to/output \ + --rig /path/to/rigs/rig.json \ + --first 000000 \ + --last 000000 + + +GlViewer.exe: + - OpenGL-based viewer for binary 6dof data files. + + Keyboard navigation: + - w, a, s, d as well as the arrow keyes will rotate the view. + - z, and x move forward and backward. + + Mouse navigation: + - Left button drag the mouse to rotate. + - Right button drag the mouse to pan. + + Misc: + - Hit 'r' to reset the view to what was on the command line. + - Hit 'p' to dump the current view parameters in the command line format. + + - Example: + ./GlViewer \ + --rig=/path/to/output/fused/rig_calibrated.json \ + --catalog=/path/to/output/fused/fused.json \ + --strip_files=/path/to/output/fused/fused_0.bin + + +ImportPointCloud.exe: + - Reads a point cloud as an ASCII file with a single point per line and generates a disparity + image per camera. + + Supports multiple point cloud formats, but only extracts the xyz coordinates. + + The input file can have a single line header with a point count. + + - Example: + ./ImportPointCloud \ + --output=/path/to/output \ + --rig=/path/to/rigs/rig.json \ + --point_cloud=/path/to/points.xyz + + Where points.xyz may be of the form: + + 10000 + -0.04503071680665016 -2.2521071434020996 4.965743541717529 1 90 104 136 + -0.005194493103772402 -2.323836088180542 4.938142776489258 1 94 110 143 + 0.046292994171381 -2.2623345851898193 4.609960079193115 1 101 122 149 + ... + + +LayerDisparities.exe: + - Layers foreground disparity atop background disparity assuming nans to correspond to locations + without valid disparities. + + - Example: + ./LayerDisparities \ + --rig=/path/to/rigs/rig.json \ + --background_disp=/path/to/background/disparity \ + --foreground_disp=/path/to/output/disparity \ + --output=/path/to/output \ + --first=000000 \ + --last=000000 + + +MatchCorners.exe: + - Performs feature matching on a sample frame. + + - Example: + ./MatchCorners \ + --color=/path/to/video/color \ + --matches=/path/to/output/matches.json \ + --rig_in=/path/to/rigs/rig.json + + +PngToPfm.exe: + - Converts a PNG single-channel disparity image to a PFM. + + - Example: + ./PngToPfm \ + --png=/path/to/video/000000.png \ + --pfm=/path/to/video/000000.pfm + + +ProjectCamerasToEquirects.exe: + - Reads cameras and projects them to equirect at a given depth. + + - Example: + ./ProjectCamerasToEquirects \ + --color=/path/to/video/color \ + --rig=/path/to/rigs/rig_calibrated.json \ + --first=000000 \ + --last=000000 \ + --output=/path/to/output + + +ProjectEquirectsToCameras.exe: + - Reads equirect masks and projects them to individual cameras assuming a given depth. + + - Example: + ./ProjectEquirectsToCameras \ + --eqr_masks=/path/to/video/equirect_masks/ \ + --rig=/path/to/rigs/rig.json \ + --first=000000 \ + --last=000000 \ + --output=/path/to/output/ + + +RawToRgb.exe: + - Converts a RAW image to RGB using a given ISP configuration. + + - Example: + ./RawToRgb \ + --input_image_path=/path/to/video/color/000000.raw \ + --output_image_path=/path/to/video/color/000000.png \ + --isp_config_path=/path/to/video/isp.json + + +RigAligner.exe: + - Aligns the scale, position, and orientation of the input rig to a reference rig via rescaling, + translating, and rotating respectively. These can be selectively locked. + + - Example: + ./RigAligner \ + --rig_in=/path/to/rigs/rig.json \ + --rig_reference=/path/to/rigs/reference.json \ + --rig_out=/path/to/rigs/aligned.json + + +RigAnalyzer.exe: + - Miscellaneous analysis utilities for a rig. Various output formats are supported to + visualize the rig setup (e.g. equirect projection). + + - Example: + ./RigAnalyzer \ + --rig=/path/to/rigs/rig.json \ + --output_equirect=/path/to/output/equirect.png + + +RigCompare.exe: + - Performs a camera-to-camera compare between an input rig and a reference rig. + + - Example: + ./RigCompare \ + --rig=/path/to/rigs/rig.json \ + --reference=/path/to/rigs/reference.json + + +RigSimulator.exe: + - Render an artificial scene as seen by the specified rig. + + - Example: + ./RigSimulator \ + --mode=pinhole_ring \ + --skybox_path=/path/to/skybox.png + + +SimpleMeshRenderer.exe: + - Reads a set of disparity (and optionally color) images for a rig and renders a fused version. + It can either output images in a specified format or do a real-time on-screen rendering. + + For the latter: + + Keyboard navigation: + - w, a, s, d as well as the arrow keyes will rotate the view. + - z, and x move forward and backward. + + Mouse navigation: + - Left button drag the mouse to rotate. + - Right button drag the mouse to pan. + + Misc: + - Hit 'r' to reset the view to what was on the command line. + - Hit 'p' to dump the current view parameters in the command line format. + + - Example: + ./SimpleMeshRenderer \ + --first=000000 \ + --last=000000 \ + --rig=/path/to/rigs/rig.json \ + --color=/path/to/video/color \ + --disparity=/path/to/output/disparity \ + --output=/path/to/output/meshes \ + --format=cubecolor + + +TemporalBilateralFilter.exe: + - Runs temporal filter across disparity frames using corresponding color frames as guides. + + - Example: + ./TemporalBilateralFilter \ + --input_root=/path/to/ \ + --output_root=/path/to/output \ + --rig=/path/to/rigs/rig.json \ + --first=000000 \ + --last=000000 + + +UpsampleDisparity.exe: + - Upscales the input disparity using the original color as guide. + + - Example: + ./UpsampleDisparity \ + --rig=/path/to/rigs/rig.json \ + --disparity=/path/to/output/disparity \ + --color=/path/to/video/color \ + --foreground_masks_in=/path/to/video/foreground_masks/ \ + --foreground_masks_out=/path/to/video/foreground_masks_full_size/ \ + --output=/path/to/video/output/disparity_full_size \ + --frame=000000 \ + --background_disp=/path/to/background/disparity_full_size + + +ViewColorVarianceThresholds.exe: + Reads a color image and a width and displays a trackbar to interactively visualize how the + flags --var_noise_floor and --var_high_thresh affect the areas of the image that will be + either ignored or considered at different stages: + + - var_noise_floor: noise variance floor on original, full-size images. Variance noise is + multiplied by the square of the scale at a given level, whose width is given by --width + Random proposals and disparity mismatches are ignored if their variance is lower than this + threshold. + - var_high_thresh: ignore variances higher than this threshold + Random proposals and disparity mismatches are accepted if their variance is higher than this + threshold. + + +ViewForegroundMaskThresholds.exe: + Reads two color images (background and foreground) and a width and displays a trackbar to + interactively visualize how the flags --blur_radius, --threshold and --morph_closing_size + affect the areas of the image that will be either ignored (background) or considered (foreground) + at different stages: + + - blur_radius: Gaussian blur radius, used to reduce noise + - threshold: Foreground/background RGB L2-norm threshold [0..1] + foreground mask = ||background - foreground||^2 > threshold + - morph_closing_size: Morphological closing size, used to fill holes on the final mask + + +DepUnitTest.exe +This program contains tests written using Google Test. You can use the +following command line flags to control its behavior: + +Test Selection: + --gtest_list_tests + List the names of all tests instead of running them. The name of + TEST(Foo, Bar) is "Foo.Bar". + --gtest_filter=POSTIVE_PATTERNS[-NEGATIVE_PATTERNS] + Run only the tests whose name matches one of the positive patterns but + none of the negative patterns. '?' matches any single character; '*' + matches any substring; ':' separates two patterns. + --gtest_also_run_disabled_tests + Run all disabled tests too. + +Test Execution: + --gtest_repeat=[COUNT] + Run the tests repeatedly; use a negative count to repeat forever. + --gtest_shuffle + Randomize tests' orders on every iteration. + --gtest_random_seed=[NUMBER] + Random number seed to use for shuffling test orders (between 1 and + 99999, or 0 to use a seed based on the current time). + +Test Output: + --gtest_color=(yes|no|auto) + Enable/disable colored output. The default is auto. + --gtest_print_time=0 + Don't print the elapsed time of each test. + --gtest_output=(json|xml)[:DIRECTORY_PATH\|:FILE_PATH] + Generate a JSON or XML report in the given directory or with the given + file name. FILE_PATH defaults to test_detail.xml. + +Assertion Behavior: + --gtest_break_on_failure + Turn assertion failures into debugger break-points. + --gtest_throw_on_failure + Turn assertion failures into C++ exceptions for use by an external + test framework. + --gtest_catch_exceptions=0 + Do not report exceptions as test failures. Instead, allow them + to crash the program or throw a pop-up (on Windows). + +Except for --gtest_list_tests, you can alternatively set the corresponding +environment variable of a flag (all letters in upper-case). For example, to +disable colored text output, you can either specify --gtest_color=no or set +the GTEST_COLOR environment variable to no. + +For more information, please read the Google Test documentation at +https://github.com/google/googletest/. If you find a bug in Google Test +(not one in your own code or tests), please report it to +. + + diff --git a/build_win32/ispc_texcomp/debug/ispc_texcomp.dll b/build_win32/ispc_texcomp/debug/ispc_texcomp.dll new file mode 100644 index 0000000..f3dbed4 Binary files /dev/null and b/build_win32/ispc_texcomp/debug/ispc_texcomp.dll differ diff --git a/build_win32/ispc_texcomp/debug/ispc_texcomp.lib b/build_win32/ispc_texcomp/debug/ispc_texcomp.lib new file mode 100644 index 0000000..179e392 Binary files /dev/null and b/build_win32/ispc_texcomp/debug/ispc_texcomp.lib differ diff --git a/build_win32/ispc_texcomp/ispc_texcomp.h b/build_win32/ispc_texcomp/ispc_texcomp.h new file mode 100644 index 0000000..1dbee34 --- /dev/null +++ b/build_win32/ispc_texcomp/ispc_texcomp.h @@ -0,0 +1,122 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016-2019, Intel Corporation +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//////////////////////////////////////////////////////////////////////////////// + +#include + +struct rgba_surface +{ + uint8_t* ptr; + int32_t width; + int32_t height; + int32_t stride; // in bytes +}; + +struct bc7_enc_settings +{ + bool mode_selection[4]; + int refineIterations[8]; + + bool skip_mode2; + int fastSkipTreshold_mode1; + int fastSkipTreshold_mode3; + int fastSkipTreshold_mode7; + + int mode45_channel0; + int refineIterations_channel; + + int channels; +}; + +struct bc6h_enc_settings +{ + bool slow_mode; + bool fast_mode; + int refineIterations_1p; + int refineIterations_2p; + int fastSkipTreshold; +}; + +struct etc_enc_settings +{ + int fastSkipTreshold; +}; + +struct astc_enc_settings +{ + int block_width; + int block_height; + int channels; + + int fastSkipTreshold; + int refineIterations; +}; + +// profiles for RGB data (alpha channel will be ignored) +extern "C" void GetProfile_ultrafast(bc7_enc_settings* settings); +extern "C" void GetProfile_veryfast(bc7_enc_settings* settings); +extern "C" void GetProfile_fast(bc7_enc_settings* settings); +extern "C" void GetProfile_basic(bc7_enc_settings* settings); +extern "C" void GetProfile_slow(bc7_enc_settings* settings); + +// profiles for RGBA inputs +extern "C" void GetProfile_alpha_ultrafast(bc7_enc_settings* settings); +extern "C" void GetProfile_alpha_veryfast(bc7_enc_settings* settings); +extern "C" void GetProfile_alpha_fast(bc7_enc_settings* settings); +extern "C" void GetProfile_alpha_basic(bc7_enc_settings* settings); +extern "C" void GetProfile_alpha_slow(bc7_enc_settings* settings); + +// profiles for BC6H (RGB HDR) +extern "C" void GetProfile_bc6h_veryfast(bc6h_enc_settings* settings); +extern "C" void GetProfile_bc6h_fast(bc6h_enc_settings* settings); +extern "C" void GetProfile_bc6h_basic(bc6h_enc_settings* settings); +extern "C" void GetProfile_bc6h_slow(bc6h_enc_settings* settings); +extern "C" void GetProfile_bc6h_veryslow(bc6h_enc_settings* settings); + +// profiles for ETC +extern "C" void GetProfile_etc_slow(etc_enc_settings* settings); + +// profiles for ASTC +extern "C" void GetProfile_astc_fast(astc_enc_settings* settings, int block_width, int block_height); +extern "C" void GetProfile_astc_alpha_fast(astc_enc_settings* settings, int block_width, int block_height); +extern "C" void GetProfile_astc_alpha_slow(astc_enc_settings* settings, int block_width, int block_height); + +// helper function to replicate border pixels for the desired block sizes (bpp = 32 or 64) +extern "C" void ReplicateBorders(rgba_surface* dst_slice, const rgba_surface* src_tex, int x, int y, int bpp); + +/* +Notes: + - input width and height need to be a multiple of block size + - LDR input is 32 bit/pixel (sRGB), HDR is 64 bit/pixel (half float) + - dst buffer must be allocated with enough space for the compressed texture: + - 8 bytes/block for BC1/ETC1, + - 16 bytes/block for BC3/BC6H/BC7/ASTC + - the blocks are stored in raster scan order (natural CPU texture layout) + - use the GetProfile_* functions to select various speed/quality tradeoffs + - the RGB profiles are slightly faster as they ignore the alpha channel +*/ + +extern "C" void CompressBlocksBC1(const rgba_surface* src, uint8_t* dst); +extern "C" void CompressBlocksBC3(const rgba_surface* src, uint8_t* dst); +extern "C" void CompressBlocksBC6H(const rgba_surface* src, uint8_t* dst, bc6h_enc_settings* settings); +extern "C" void CompressBlocksBC7(const rgba_surface* src, uint8_t* dst, bc7_enc_settings* settings); +extern "C" void CompressBlocksETC1(const rgba_surface* src, uint8_t* dst, etc_enc_settings* settings); +extern "C" void CompressBlocksASTC(const rgba_surface* src, uint8_t* dst, astc_enc_settings* settings); diff --git a/build_win32/ispc_texcomp/release/ispc_texcomp.dll b/build_win32/ispc_texcomp/release/ispc_texcomp.dll new file mode 100644 index 0000000..f62c3b3 Binary files /dev/null and b/build_win32/ispc_texcomp/release/ispc_texcomp.dll differ diff --git a/build_win32/ispc_texcomp/release/ispc_texcomp.lib b/build_win32/ispc_texcomp/release/ispc_texcomp.lib new file mode 100644 index 0000000..179e392 Binary files /dev/null and b/build_win32/ispc_texcomp/release/ispc_texcomp.lib differ diff --git a/build_win32/vcpkg_list.cmake b/build_win32/vcpkg_list.cmake new file mode 100644 index 0000000..82ce18c --- /dev/null +++ b/build_win32/vcpkg_list.cmake @@ -0,0 +1,120 @@ +set( VCPACKAGES +boost-algorithm:x64-windows +boost-any:x64-windows +boost-array:x64-windows +boost-assert:x64-windows +boost-atomic:x64-windows +boost-bind:x64-windows +boost-build:x64-windows +boost-chrono:x64-windows +boost-compatibility:x64-windows +boost-concept-check:x64-windows +boost-config:x64-windows +boost-container-hash:x64-windows +boost-container:x64-windows +boost-context:x64-windows +boost-conversion:x64-windows +boost-core:x64-windows +boost-crc:x64-windows +boost-date-time:x64-windows +boost-detail:x64-windows +boost-endian:x64-windows +boost-exception:x64-windows +boost-filesystem:x64-windows +boost-foreach:x64-windows +boost-function-types:x64-windows +boost-function:x64-windows +boost-functional:x64-windows +boost-fusion:x64-windows +boost-integer:x64-windows +boost-intrusive:x64-windows +boost-io:x64-windows +boost-iostreams:x64-windows +boost-iterator:x64-windows +boost-lambda:x64-windows +boost-lexical-cast:x64-windows +boost-locale:x64-windows +boost-math:x64-windows +boost-modular-build-helper:x64-windows +boost-move:x64-windows +boost-mp11:x64-windows +boost-mpl:x64-windows +boost-multi-index:x64-windows +boost-multiprecision:x64-windows +boost-numeric-conversion:x64-windows +boost-optional:x64-windows +boost-phoenix:x64-windows +boost-pool:x64-windows +boost-predef:x64-windows +boost-preprocessor:x64-windows +boost-program-options:x64-windows +boost-proto:x64-windows +boost-range:x64-windows +boost-ratio:x64-windows +boost-rational:x64-windows +boost-regex:x64-windows +boost-serialization:x64-windows +boost-smart-ptr:x64-windows +boost-spirit:x64-windows +boost-static-assert:x64-windows +boost-system:x64-windows +boost-thread:x64-windows +boost-throw-exception:x64-windows +boost-timer:x64-windows +boost-tokenizer:x64-windows +boost-tti:x64-windows +boost-tuple:x64-windows +boost-type-index:x64-windows +boost-type-traits:x64-windows +boost-typeof:x64-windows +boost-unordered:x64-windows +boost-utility:x64-windows +boost-variant:x64-windows +boost-vcpkg-helpers:x64-windows +boost-winapi:x64-windows +bzip2:x64-windows +ceres:x64-windows +ceres[eigensparse]:x64-windows +ceres[lapack]:x64-windows +ceres[suitesparse]:x64-windows +clapack:x64-windows +double-conversion:x64-windows +eigen3:x64-windows +folly:x64-windows +folly[zlib]:x64-windows +gflags:x64-windows +glew:x64-windows +glfw3:x64-windows +glog:x64-windows +gtest:x64-windows +libevent:x64-windows +libjpeg-turbo:x64-windows +liblzma:x64-windows +libpng:x64-windows +libwebp:x64-windows +openblas:x64-windows +opencv3:x64-windows +opencv3[dnn]:x64-windows +opencv3[flann]:x64-windows +opencv3[jpeg]:x64-windows +opencv3[opengl]:x64-windows +opencv3[png]:x64-windows +opencv3[tiff]:x64-windows +opencv3[webp]:x64-windows +opengl:x64-windows +openssl-windows:x64-windows +openssl:x64-windows +protobuf:x64-windows +pthreads:x64-windows +suitesparse:x64-windows +tiff:x64-windows +zlib:x64-windows +zstd:x64-windows +) + +if(VCPKG_VERBOSE) +message(STATUS "Need the following vcpkg packages: ") +foreach(PKG ${VCPACKAGES}) + message(STATUS " ${PKG} ") +endforeach() +endif(VCPKG_VERBOSE) diff --git a/source/calibration/CalibrationLib.cpp b/source/calibration/CalibrationLib.cpp index 4fe9896..38f315e 100644 --- a/source/calibration/CalibrationLib.cpp +++ b/source/calibration/CalibrationLib.cpp @@ -8,6 +8,10 @@ #include "source/calibration/CalibrationLib.h" #include "source/calibration/Calibration.h" +#ifdef WIN32 +#include "source/calibration/Calibration.cpp" +#endif + int calibration( const std::string& output_rig, diff --git a/source/calibration/CalibrationMain.cpp b/source/calibration/CalibrationMain.cpp index fe41497..4cd3377 100644 --- a/source/calibration/CalibrationMain.cpp +++ b/source/calibration/CalibrationMain.cpp @@ -7,6 +7,9 @@ #include "source/calibration/Calibration.h" #include "source/util/SystemUtil.h" +#ifdef WIN32 +#include "source/calibration/Calibration.cpp" +#endif const std::string kUsageMessage = R"( - Calibrates an uncalibrated rig by feature matching and performing geometric calibration diff --git a/source/calibration/GeometricCalibration.cpp b/source/calibration/GeometricCalibration.cpp index 557fde1..25556e5 100644 --- a/source/calibration/GeometricCalibration.cpp +++ b/source/calibration/GeometricCalibration.cpp @@ -1,4 +1,4 @@ -/** +/** * Copyright 2004-present Facebook. All Rights Reserved. * * This source code is licensed under the BSD-style license found in the @@ -7,7 +7,6 @@ #include "source/calibration/GeometricCalibration.h" -#include #include #include #include @@ -117,15 +116,17 @@ void buildCameraIndexMaps(const Camera::Rig& rig) { using ImageId = std::string; + std::string getCameraId(const ImageId& image) { // image is actually a path filesystem::path path = image; if (FLAGS_dir_per_frame) { - return path.stem().native(); + return path.stem().string(); } - return path.parent_path().filename().native(); + return path.parent_path().filename().string(); } + int getFrameIndex(const ImageId& image) { // image is actually a path filesystem::path path = image; @@ -883,6 +884,9 @@ void solve(ceres::Problem& problem) { } options.function_tolerance = FLAGS_ceres_function_tolerance; + /* try other solvers than default SPARSE_SCHUR */ + options.linear_solver_type = ceres::ITERATIVE_SCHUR; + ceres::Solver::Summary summary; LOG(INFO) << getReprojectionReport(problem); diff --git a/source/calibration/GeometricCalibrationMain.cpp b/source/calibration/GeometricCalibrationMain.cpp index c9c142a..46b9562 100644 --- a/source/calibration/GeometricCalibrationMain.cpp +++ b/source/calibration/GeometricCalibrationMain.cpp @@ -7,6 +7,9 @@ #include "source/calibration/Calibration.h" #include "source/util/SystemUtil.h" +#ifdef WIN32 +#include "source/calibration/Calibration.cpp" +#endif const std::string kUsageMessage = R"( - Performs geometric calibration on a sample frame. The results of the feature matcher should diff --git a/source/calibration/Keypoint.h b/source/calibration/Keypoint.h index 57f44c9..fa5d529 100644 --- a/source/calibration/Keypoint.h +++ b/source/calibration/Keypoint.h @@ -103,6 +103,8 @@ struct Overlap { std::array images; std::vector matches; + Overlap() {}; + Overlap(const std::string& image0, const std::string& image1) { images[0] = image0; images[1] = image1; diff --git a/source/calibration/MatchCornersMain.cpp b/source/calibration/MatchCornersMain.cpp index ceb3003..eff2c8f 100644 --- a/source/calibration/MatchCornersMain.cpp +++ b/source/calibration/MatchCornersMain.cpp @@ -8,6 +8,10 @@ #include "source/calibration/Calibration.h" #include "source/util/SystemUtil.h" +#ifdef WIN32 +#include "source/calibration/Calibration.cpp" +#endif + const std::string kUsageMessage = R"( - Performs feature matching on a sample frame. diff --git a/source/isp/RawToRgb.cpp b/source/isp/RawToRgb.cpp index 7b2e165..a9a9df0 100644 --- a/source/isp/RawToRgb.cpp +++ b/source/isp/RawToRgb.cpp @@ -60,11 +60,11 @@ int main(int argc, char* argv[]) { ++itr) { if (filesystem::is_regular_file(*itr) && itr->path().extension() == ".raw") { filesystem::path inputFile = itr->path(); - inputFiles.emplace_back(inputFile.c_str()); - outputFiles.emplace_back(inputFile.replace_extension(".png").c_str()); + inputFiles.emplace_back(inputFile.string().c_str()); + outputFiles.emplace_back(inputFile.replace_extension(".png").string().c_str()); if (!FLAGS_output_dng_path.empty()) { - dngFiles.emplace_back(inputFile.replace_extension(".dng").c_str()); + dngFiles.emplace_back(inputFile.replace_extension(".dng").string().c_str()); } } } diff --git a/source/mesh_stream/BinaryFusionUtil.h b/source/mesh_stream/BinaryFusionUtil.h index 0633204..9ad16af 100644 --- a/source/mesh_stream/BinaryFusionUtil.h +++ b/source/mesh_stream/BinaryFusionUtil.h @@ -26,7 +26,7 @@ void addFile(std::vector& disks, uint64_t& offset, const filesystem::path uint64_t aligned = align(offset, kStripeSize); uint64_t end = offset == aligned ? offset + kStripeSize : aligned; uint64_t size = filesystem::file_size(filename); - FILE* file = fopen(filename.c_str(), "rb"); + FILE* file = fopen(filename.string().c_str(), "rb"); LOG(INFO) << folly::sformat("Fusing {}...", filename.string()); while (size) { std::vector buffer(std::min(size, end - offset)); diff --git a/source/render/GenerateKeypointProjections.cpp b/source/render/GenerateKeypointProjections.cpp index 683d4b0..55f6027 100644 --- a/source/render/GenerateKeypointProjections.cpp +++ b/source/render/GenerateKeypointProjections.cpp @@ -16,6 +16,13 @@ #include "source/util/ImageUtil.h" #include "source/util/SystemUtil.h" +#ifdef WIN32 +#include "source/calibration/Calibration.cpp" +DEFINE_int32(octave_count, 4, "number of resolutions to use when looking for features"); +DEFINE_bool(same_scale, false, "match at same scale where feature was found"); +DEFINE_bool(use_nearest, false, "use nearest neighbor during corner matching, default is bilinear"); +#endif + using namespace fb360_dep; const std::string kUsageMessage = R"( diff --git a/source/render/MeshUtil.h b/source/render/MeshUtil.h index dc43d0b..7777c68 100644 --- a/source/render/MeshUtil.h +++ b/source/render/MeshUtil.h @@ -97,7 +97,7 @@ inline void writeObj( CHECK(vertexes.cols() == 3 || st) << "expected xyz or xyzst"; CHECK_EQ(st, !filenameMtl.empty()) << "texture coordinates and material go together"; - FILE* fp = fopen(filenameObj.c_str(), "w"); + FILE* fp = fopen(filenameObj.string().c_str(), "w"); CHECK(fp) << "file open failed: " << filenameObj; if (!filenameMtl.empty()) { fprintf(fp, "mtllib %s\nusemtl material\n", filenameMtl.c_str()); diff --git a/source/rig/AlignPointCloud.cpp b/source/rig/AlignPointCloud.cpp index 4ecbcfb..8edb340 100644 --- a/source/rig/AlignPointCloud.cpp +++ b/source/rig/AlignPointCloud.cpp @@ -24,6 +24,10 @@ #include "source/util/ImageUtil.h" #include "source/util/SystemUtil.h" +#ifdef WIN32 +#include "source/calibration/Calibration.cpp" +#endif + using namespace fb360_dep; using namespace fb360_dep::calibration; using namespace fb360_dep::point_cloud_util; diff --git a/source/test/DepUnitTest.cpp b/source/test/DepUnitTest.cpp index 11ada00..31d14ad 100644 --- a/source/test/DepUnitTest.cpp +++ b/source/test/DepUnitTest.cpp @@ -9,6 +9,10 @@ #include "source/util/CvUtil.h" +#ifdef WIN32 +#include "source/calibration/Calibration.cpp" +#endif + int main(int argc, char** argv) { ::cv::setNumThreads(1); ::testing::InitGoogleTest(&argc, argv); diff --git a/source/util/Camera.h b/source/util/Camera.h index 2878010..3d8e9a0 100644 --- a/source/util/Camera.h +++ b/source/util/Camera.h @@ -25,7 +25,7 @@ #endif // windows doesn't need the full rig i/o functionality -#define SUPPRESS_RIG_IO +// yes it does -- TKS #define SUPPRESS_RIG_IO #endif // WIN32 diff --git a/source/util/FilesystemUtil.h b/source/util/FilesystemUtil.h index 87fd034..5a3e01b 100644 --- a/source/util/FilesystemUtil.h +++ b/source/util/FilesystemUtil.h @@ -7,7 +7,7 @@ #pragma once -#ifdef WIN32 +#ifdef WIN32_do_not_use #include #else #define BOOST_FILESYSTEM_NO_DEPRECATED @@ -17,7 +17,7 @@ #include namespace filesystem { -#ifdef WIN32 +#ifdef WIN32_do_not_use using namespace std::experimental::filesystem; #else using namespace boost::filesystem; diff --git a/source/util/SystemUtil.cpp b/source/util/SystemUtil.cpp index 18d10fc..9bf5118 100644 --- a/source/util/SystemUtil.cpp +++ b/source/util/SystemUtil.cpp @@ -16,6 +16,13 @@ #include +#ifdef WIN32 +#include +#include +#include +#endif + + DECLARE_bool(help); DECLARE_bool(helpshort); @@ -96,6 +103,13 @@ void logFlags() { } void initDep(int& argc, char**& argv, const std::string kUsageMessage) { +#ifdef WIN32 + // Create and install global locale default "en_US.UTF-8" + std::locale::global(boost::locale::generator().generate("")); + // Make boost.filesystem use it + boost::filesystem::path::imbue(std::locale()); +#endif + if (kUsageMessage!="") { gflags::SetUsageMessage(kUsageMessage); }