Skip to content

Commit

Permalink
dense: add a stricter depth-map filter
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcseacave committed Oct 11, 2015
1 parent c121ffc commit b2a1a45
Show file tree
Hide file tree
Showing 28 changed files with 495 additions and 526 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if(OpenMVS_USE_BREAKPAD)
FIND_PACKAGE(BREAKPAD)
if(BREAKPAD_FOUND)
include_directories(${BREAKPAD_INCLUDE_DIRS})
add_definitions(-D_USE_BREAKPAD)
add_definitions(${BREAKPAD_DEFINITIONS} -D_USE_BREAKPAD)
else()
message("-- Can't find BreakPad. Continuing without it.")
endif()
Expand All @@ -89,7 +89,7 @@ endif()
FIND_PACKAGE(Eigen ${SYSTEM_PACKAGE_REQUIRED})
if(EIGEN_FOUND)
include_directories(${EIGEN_INCLUDE_DIRS})
add_definitions(${EIGEN_DEFINITIONS})
add_definitions(${EIGEN_DEFINITIONS} -D_USE_EIGEN)
endif()

FIND_PACKAGE(OpenCV ${SYSTEM_PACKAGE_REQUIRED})
Expand Down
66 changes: 32 additions & 34 deletions build/Cotire.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ if (NOT CMAKE_SCRIPT_MODE_FILE)
cmake_policy(POP)
endif()

set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
set (COTIRE_CMAKE_MODULE_VERSION "1.7.4")

# activate select policies
if (POLICY CMP0038)
# targets may not link directly to themselves
Expand Down Expand Up @@ -93,9 +96,6 @@ if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()

set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
set (COTIRE_CMAKE_MODULE_VERSION "1.7.3")

include(CMakeParseArguments)
include(ProcessorCount)

Expand Down Expand Up @@ -802,7 +802,7 @@ macro (cotire_add_frameworks_to_cmd _cmdVar _language)
set (_frameWorkDirs "")
foreach (_include ${ARGN})
if (IS_ABSOLUTE "${_include}" AND _include MATCHES "\\.framework$")
get_filename_component(_frameWorkDir "${_include}" PATH)
get_filename_component(_frameWorkDir "${_include}" DIRECTORY)
list (APPEND _frameWorkDirs "${_frameWorkDir}")
endif()
endforeach()
Expand Down Expand Up @@ -1508,7 +1508,7 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
# -Kc++ process all source or unrecognized file types as C++ source files
# -fsyntax-only check only for correct syntax
# -Wpch-messages enable diagnostics related to pre-compiled headers (requires Intel XE 2013 Update 2)
get_filename_component(_pchDir "${_pchFile}" PATH)
get_filename_component(_pchDir "${_pchFile}" DIRECTORY)
get_filename_component(_pchName "${_pchFile}" NAME)
set (_xLanguage_C "c-header")
set (_xLanguage_CXX "c++-header")
Expand Down Expand Up @@ -1634,7 +1634,7 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
# -include process include file as the first line of the primary source file
# -Wpch-messages enable diagnostics related to pre-compiled headers (requires Intel XE 2013 Update 2)
if (_pchFile)
get_filename_component(_pchDir "${_pchFile}" PATH)
get_filename_component(_pchDir "${_pchFile}" DIRECTORY)
get_filename_component(_pchName "${_pchFile}" NAME)
if (_flags)
# append to list
Expand Down Expand Up @@ -2019,7 +2019,12 @@ function (cotire_generate_target_script _language _configurations _target _targe
# copy variable definitions to cotire target script
get_cmake_property(_vars VARIABLES)
string (REGEX MATCHALL "COTIRE_[A-Za-z0-9_]+" _matchVars "${_vars}")
# remove COTIRE_VERBOSE which is passed as a CMake define on command line
# omit COTIRE_*_INIT variables
string (REGEX MATCHALL "COTIRE_[A-Za-z0-9_]+_INIT" _initVars "${_matchVars}")
if (_initVars)
list (REMOVE_ITEM _matchVars ${_initVars})
endif()
# omit COTIRE_VERBOSE which is passed as a CMake define on command line
list (REMOVE_ITEM _matchVars COTIRE_VERBOSE)
set (_contents "")
set (_contentsHasGeneratorExpressions FALSE)
Expand Down Expand Up @@ -2298,21 +2303,15 @@ function (cotire_setup_unity_generation_commands _language _target _targetScript
VERBATIM)
list (APPEND ${_cmdsVar} COMMAND ${_unityCmd})
endforeach()
list (LENGTH _unityFiles _numberOfUnityFiles)
if (_numberOfUnityFiles GREATER 1)
# create a joint unity file from all unity file segments
cotire_make_single_unity_source_file_path(${_language} ${_target} _unityFile)
cotire_setup_combine_command(${_language} "${_targetConfigScript}" "${_unityFile}" ${_cmdsVar} ${_unityFiles})
endif()
set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE)
endfunction()

function (cotire_setup_prefix_generation_command _language _target _targetScript _prefixFile _unityFile _cmdsVar)
function (cotire_setup_prefix_generation_command _language _target _targetScript _prefixFile _unityFiles _cmdsVar)
set (_sourceFiles ${ARGN})
set (_dependencySources "")
cotire_get_prefix_header_dependencies(${_language} ${_target} _dependencySources ${_sourceFiles})
cotire_set_cmd_to_prologue(_prefixCmd)
list (APPEND _prefixCmd -P "${COTIRE_CMAKE_MODULE_FILE}" "prefix" "${_targetScript}" "${_prefixFile}" "${_unityFile}")
list (APPEND _prefixCmd -P "${COTIRE_CMAKE_MODULE_FILE}" "prefix" "${_targetScript}" "${_prefixFile}" ${_unityFiles})
set_property (SOURCE "${_prefixFile}" PROPERTY GENERATED TRUE)
if (COTIRE_DEBUG)
message (STATUS "add_custom_command: OUTPUT ${_prefixFile} COMMAND ${_prefixCmd} DEPENDS ${_unityFile} ${_dependencySources}")
Expand All @@ -2327,7 +2326,7 @@ function (cotire_setup_prefix_generation_command _language _target _targetScript
add_custom_command(
OUTPUT "${_prefixFile}" "${_prefixFile}.log"
COMMAND ${_prefixCmd}
DEPENDS "${_unityFile}" ${_dependencySources}
DEPENDS ${_unityFiles} ${_dependencySources}
COMMENT "${_comment}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
VERBATIM)
Expand All @@ -2343,17 +2342,9 @@ function (cotire_setup_prefix_generation_from_unity_command _language _target _t
else()
set (_prefixSourceFile "${_prefixFile}")
endif()
list (LENGTH _unityFiles _numberOfUnityFiles)
if (_numberOfUnityFiles GREATER 1)
cotire_make_single_unity_source_file_path(${_language} ${_target} _unityFile)
cotire_setup_prefix_generation_command(
${_language} ${_target} "${_targetScript}"
"${_prefixSourceFile}" "${_unityFile}" ${_cmdsVar} ${_sourceFiles})
else()
cotire_setup_prefix_generation_command(
${_language} ${_target} "${_targetScript}"
"${_prefixSourceFile}" "${_unityFiles}" ${_cmdsVar} ${_sourceFiles})
endif()
cotire_setup_prefix_generation_command(
${_language} ${_target} "${_targetScript}"
"${_prefixSourceFile}" "${_unityFiles}" ${_cmdsVar} ${_sourceFiles})
if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang")
# set up generation of a prefix source file which includes the prefix header
cotire_setup_combine_command(${_language} "${_targetScript}" "${_prefixFile}" _cmds ${_prefixSourceFile})
Expand Down Expand Up @@ -2614,14 +2605,22 @@ function (cotire_process_target_language _language _configurations _target _whol
endif()
cotire_generate_target_script(
${_language} "${_configurations}" ${_target} _targetScript _targetConfigScript ${_unitySourceFiles})
# set up unity files for parallel compilation
cotire_compute_unity_max_number_of_includes(${_target} _maxIncludes ${_unitySourceFiles})
cotire_make_unity_source_file_paths(${_language} ${_target} ${_maxIncludes} _unityFiles ${_unitySourceFiles})
if (NOT _unityFiles)
list (LENGTH _unityFiles _numberOfUnityFiles)
if (_numberOfUnityFiles EQUAL 0)
return()
elseif (_numberOfUnityFiles GREATER 1)
cotire_setup_unity_generation_commands(
${_language} ${_target} "${_targetScript}" "${_targetConfigScript}" "${_unityFiles}" _cmds ${_unitySourceFiles})
endif()
# set up single unity file for prefix header generation
cotire_make_single_unity_source_file_path(${_language} ${_target} _unityFile)
cotire_setup_unity_generation_commands(
${_language} ${_target} "${_targetScript}" "${_targetConfigScript}" "${_unityFiles}" _cmds ${_unitySourceFiles})
${_language} ${_target} "${_targetScript}" "${_targetConfigScript}" "${_unityFile}" _cmds ${_unitySourceFiles})
cotire_make_prefix_file_path(${_language} ${_target} _prefixFile)
# set up prefix header
if (_prefixFile)
# check for user provided prefix header files
get_property(_prefixHeaderFiles TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER_INIT)
Expand All @@ -2630,7 +2629,7 @@ function (cotire_process_target_language _language _configurations _target _whol
${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" _cmds ${_prefixHeaderFiles})
else()
cotire_setup_prefix_generation_from_unity_command(
${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" "${_unityFiles}" _cmds ${_unitySourceFiles})
${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" "${_unityFile}" _cmds ${_unitySourceFiles})
endif()
# check if selected language has enough sources at all
list (LENGTH _sourceFiles _numberOfSources)
Expand Down Expand Up @@ -3032,7 +3031,7 @@ function (cotire_cleanup _binaryDir _cotireIntermediateDirName _targetName)
# filter files in intermediate directory
set (_filesToRemove "")
foreach (_file ${_cotireFiles})
get_filename_component(_dir "${_file}" PATH)
get_filename_component(_dir "${_file}" DIRECTORY)
get_filename_component(_dirName "${_dir}" NAME)
if ("${_dirName}" STREQUAL "${_cotireIntermediateDirName}")
list (APPEND _filesToRemove "${_file}")
Expand Down Expand Up @@ -3156,7 +3155,6 @@ if (CMAKE_SCRIPT_MODE_FILE)
message (STATUS "COTIRE_BUILD_TYPE=${COTIRE_BUILD_TYPE} not cotired (${COTIRE_TARGET_CONFIGURATION_TYPES})")
endif()
set (_sources "")
set (_sourceLocations "")
set (_sourcesDefinitions "")
endif()
set (_targetPreUndefs ${COTIRE_TARGET_PRE_UNDEFS})
Expand Down Expand Up @@ -3358,9 +3356,9 @@ else()
endif()
if (MSVC)
# MSVC default PCH memory scaling factor of 100 percent (75 MB) is too small for template heavy C++ code
# use a bigger default factor of 140 percent (105 MB)
# use a bigger default factor of 170 percent (128 MB)
if (NOT DEFINED COTIRE_PCH_MEMORY_SCALING_FACTOR)
set (COTIRE_PCH_MEMORY_SCALING_FACTOR "140")
set (COTIRE_PCH_MEMORY_SCALING_FACTOR "170")
endif()
endif()
if (NOT COTIRE_UNITY_BUILD_TARGET_SUFFIX)
Expand Down
6 changes: 3 additions & 3 deletions libs/Common/AutoEstimator.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ class ACKernelAdaptor
inline double logalpha0() const { return logalpha0_; }
inline double multError() const { return (bPointToLine_ ? 0.5 : 1.0); }

private:
protected:
DMatrix32F x1_, x2_; // Normalized input data
double logalpha0_; // Alpha0 is used to make the error adaptive to the image size
bool bPointToLine_;// Store if error model is pointToLine or point to point
Expand Down Expand Up @@ -597,7 +597,7 @@ class ACKernelAdaptorResection
inline double logalpha0() const { return logalpha0_; }
inline double multError() const { return 1.0; } // point to point error

private:
protected:
DMatrix32F x2d_;
DMatrix x3D_;
double logalpha0_; // Alpha0 is used to make the error adaptive to the image size
Expand Down Expand Up @@ -656,7 +656,7 @@ class ACKernelAdaptorEssential
inline double logalpha0() const { return logalpha0_; }
inline double multError() const { return 0.5; } // point to line error

private:
protected:
Solver solver;
DMatrix32F x1_, x2_; // image point and camera plane point.
double logalpha0_; // Alpha0 is used to make the error adaptive to the image size
Expand Down
14 changes: 6 additions & 8 deletions libs/Common/AutoPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,10 @@ class CAutoPtr
m_pointer = _Ptr;
}

private:
protected:
TypePtr m_pointer; // the wrapped object pointer

#ifdef _USE_BOOST
protected:
#ifdef _USE_BOOST
// implement BOOST serialization
friend class boost::serialization::access;
template<class Archive>
Expand All @@ -154,7 +153,7 @@ class CAutoPtr
operator=(newPointer);
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
#endif
#endif
};


Expand Down Expand Up @@ -248,11 +247,10 @@ class CAutoPtrArr
m_pointer = _Ptr;
}

private:
protected:
TypePtr m_pointer; // the wrapped object pointer

#ifdef _USE_BOOST
protected:
#ifdef _USE_BOOST
// implement BOOST serialization
friend class boost::serialization::access;
template<class Archive>
Expand All @@ -268,7 +266,7 @@ class CAutoPtrArr
operator=(newPointer);
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
#endif
#endif
};
/*----------------------------------------------------------------*/

Expand Down
12 changes: 6 additions & 6 deletions libs/Common/CUDA.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ inline CUresult freeMemDevice(CUdeviceptr& dataDevice) {

class MemDevice
{
private:
protected:
CUdeviceptr pData;
size_t nSize;

Expand Down Expand Up @@ -195,7 +195,7 @@ typedef CLISTDEFIDX(MemDevice,int) MemDeviceArr;

class EventRT
{
private:
protected:
CUevent hEvent;

protected:
Expand All @@ -222,7 +222,7 @@ typedef CSharedPtr<EventRT> EventRTPtr;

class StreamRT
{
private:
protected:
CUstream hStream;

protected:
Expand Down Expand Up @@ -251,7 +251,7 @@ typedef CSharedPtr<StreamRT> StreamRTPtr;

class ModuleRT
{
private:
protected:
CUmodule hModule;

protected:
Expand Down Expand Up @@ -393,7 +393,7 @@ class KernelRT
}
CUresult GetResult(const std::initializer_list<ReturnParam>& params) const;

private:
protected:
CUresult _AddParam(const InputParam& param);
CUresult _AddParam(const OutputParam& param);
template <typename T>
Expand Down Expand Up @@ -453,7 +453,7 @@ class TArrayRT
typedef TYPE Type;
typedef TImage<TYPE> ImageType;

private:
protected:
CUarray hArray;

public:
Expand Down
16 changes: 12 additions & 4 deletions libs/Common/CriticalSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,10 @@ class RLock {
public:
RLock(RWLock& aCs) : cs(aCs) { cs.EnterRead(); }
~RLock() { cs.LeaveRead(); }
protected:
private:
RLock(const RLock&);
RLock& operator=(const RLock&);
protected:
RWLock& cs;
};

Expand All @@ -223,8 +225,10 @@ class RLockTry {
bool IsLocked() const { return bLocked; }
bool TryEnter() { return (bLocked = cs.TryEnterRead()); }
bool TryLeave() { return !(bLocked = !cs.TryLeaveRead()); }
private:
RLockTry(const RLockTry&);
RLockTry& operator=(const RLockTry&);
protected:
RLock& operator=(const RLock&);
RWLock& cs;
bool bLocked;
};
Expand All @@ -233,8 +237,10 @@ class WLock {
public:
WLock(RWLock& aCs) : cs(aCs) { cs.EnterWrite(); }
~WLock() { cs.LeaveWrite(); }
private:
WLock(const WLock&);
WLock& operator=(const WLock&);
protected:
RLock& operator=(const RLock&);
RWLock& cs;
};

Expand All @@ -244,8 +250,10 @@ class WLockTry {
~WLockTry() { if (bLocked) cs.LeaveWrite(); }
bool IsLocked() const { return bLocked; }
bool TryEnter() { return (bLocked = cs.TryEnterWrite()); }
private:
WLockTry(const WLockTry&);
WLockTry& operator=(const WLockTry&);
protected:
RLock& operator=(const RLock&);
RWLock& cs;
bool bLocked;
};
Expand Down
4 changes: 2 additions & 2 deletions libs/Common/EventQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Event

virtual bool Run(void* /*pArgs*/) { return true; }

private:
protected:
const uint32_t id;
};
typedef cQueue<Event*,Event*,0> EVENTQUEUE;
Expand Down Expand Up @@ -64,7 +64,7 @@ class GENERAL_API EventQueue
bool IsEmpty() const; //are there any events in the queue?
uint_t GetSize() const; //number of events in the queue

private:
protected:
Semaphore m_sem;
mutable CriticalSection m_cs;
EVENTQUEUE m_events;
Expand Down
Loading

0 comments on commit b2a1a45

Please sign in to comment.