Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Facebook Optical Flow #271

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions surround360_render/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.2)

PROJECT(Surround360Render CXX)

OPTION(USE_SCANNER "Enable using Scanner for distributed rendering" ON)

FIND_PACKAGE(OpenCV)
FIND_PACKAGE(Ceres REQUIRED)
FIND_PACKAGE(Boost REQUIRED)

INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/source)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/source/util)
Expand All @@ -15,6 +19,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/source/render)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
INCLUDE_DIRECTORIES(/usr/local/include/eigen3)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# required for clang, including AppleClang
LINK_DIRECTORIES(/usr/local/lib)
Expand Down Expand Up @@ -53,7 +59,7 @@ ADD_CUSTOM_TARGET( _source SOURCES ${SRC} )

### Halide support
IF (DEFINED HALIDE_DIR)
INCLUDE("${HALIDE_DIR}/../HalideGenerator.cmake")
INCLUDE("${HALIDE_DIR}/HalideGenerator.cmake")

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_HALIDE")

Expand Down Expand Up @@ -90,14 +96,19 @@ FILE(GLOB optical_flow_SRC "source/optical_flow/*.cpp")
FILE(GLOB render_SRC "source/render/*.cpp")
FILE(GLOB util_SRC "source/util/*.cpp")

ADD_LIBRARY(
LibVrCamera
ADD_LIBRARY(LibVrCamera
source/util/SystemUtil.cpp
${calibration_SRC}
${optical_flow_SRC}
${render_SRC}
${util_SRC}
)
# TARGET_LINK_LIBRARIES(LibVrCamera
# folly
# ceres
# LibJSON
# ${OpenCV_LIBS}
# ${PLATFORM_SPECIFIC_LIBS})
TARGET_COMPILE_FEATURES(LibVrCamera PRIVATE cxx_range_for)

### Raw2Rgb ###
Expand Down Expand Up @@ -198,6 +209,12 @@ TARGET_LINK_LIBRARIES(
LibJSON
glog
gflags

# folly
# ceres
# LibJSON
${OpenCV_LIBS}
${PLATFORM_SPECIFIC_LIBS}
)

### TestOpticalFlow ###
Expand Down Expand Up @@ -498,11 +515,31 @@ TARGET_LINK_LIBRARIES(
LibJSON
gflags
glog
folly
-L${Boost_LIBRARY_DIRS}
boost_filesystem
boost_system
double-conversion
folly
${CERES_LIBRARIES}
${OpenCV_LIBS}
${PLATFORM_SPECIFIC_LIBS}
${CERES_LIBRARIES}
)


IF (USE_SCANNER)
SET(SCANNER_PATH "~/repos/scanner/")
include(${SCANNER_PATH}/cmake/Util/Op.cmake)
build_op(
LIB_NAME surround360kernels
CPP_SRCS
source/scanner_kernels/project_spherical_kernel_cpu.cpp
source/scanner_kernels/temporal_optical_flow_kernel_cpu.cpp
source/scanner_kernels/render_stereo_panorama_chunk_kernel_cpu.cpp
source/scanner_kernels/concat_panorama_chunks_kernel_cpu.cpp

PROTO_SRC source/scanner_kernels/surround360.proto)
target_link_libraries(surround360kernels PUBLIC
LibVrCamera
folly
${OpenCV_LIBS})
ENDIF()
2 changes: 2 additions & 0 deletions surround360_render/scripts/batch_process_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def list_only_files(src_dir): return filter(lambda f: f[0] != ".", [f for f in l
parser.add_argument('--rig_json_file', help='path to rig json file', required=True)
parser.add_argument('--flow_alg', help='flow algorithm e.g., pixflow_low, pixflow_search_20', required=True)
parser.add_argument('--verbose', dest='verbose', action='store_true')
parser.add_argument('--cores', default=-1)
parser.set_defaults(save_debug_images=False)
parser.set_defaults(enable_top=False)
parser.set_defaults(enable_bottom=False)
Expand Down Expand Up @@ -192,6 +193,7 @@ def list_only_files(src_dir): return filter(lambda f: f[0] != ".", [f for f in l
render_params["FINAL_EQR_HEIGHT"] = 6144
elif quality == "8k":
render_params["SHARPENNING"] = 0.25
render_params["SHARPENNING"] = 0.0
render_params["EQR_WIDTH"] = 8400
render_params["EQR_HEIGHT"] = 4096
render_params["FINAL_EQR_WIDTH"] = 8192
Expand Down
1 change: 1 addition & 0 deletions surround360_render/scripts/geometric_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{COLMAP_DIR}/feature_extractor
--General.image_path {IMAGE_PATH}
--General.database_path {COLMAP_DB_PATH}
--ExtractionOptions.gpu_index 0
"""

COLMAP_MATCH_TEMPLATE = """
Expand Down
Loading