mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Improve the documentation.
This commit is contained in:
parent
a2120263de
commit
336996152a
@ -10,7 +10,7 @@
|
|||||||
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
|
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
|
||||||
message(FATAL_ERROR "
|
message(FATAL_ERROR "
|
||||||
FATAL: In-source builds are not allowed.
|
FATAL: In-source builds are not allowed.
|
||||||
You should create separate directory for build files.
|
You should create a separate directory for build files.
|
||||||
")
|
")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command"
|
|||||||
OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" ON IF (NOT APPLE_FRAMEWORK) )
|
OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" ON IF (NOT APPLE_FRAMEWORK) )
|
||||||
OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ON IF (NOT APPLE_FRAMEWORK) )
|
OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ON IF (NOT APPLE_FRAMEWORK) )
|
||||||
OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON )
|
OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON )
|
||||||
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
|
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for statically linked OpenCV" ON IF MSVC )
|
||||||
OCV_OPTION(BUILD_WITH_DYNAMIC_IPP "Enables dynamic linking of IPP (only for standalone IPP)" OFF )
|
OCV_OPTION(BUILD_WITH_DYNAMIC_IPP "Enables dynamic linking of IPP (only for standalone IPP)" OFF )
|
||||||
OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
|
OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
|
||||||
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID )
|
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID )
|
||||||
|
@ -48,8 +48,8 @@ macro(ocv_update VAR)
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Search packages for host system instead of packages for target system
|
# Search packages for the host system instead of packages for the target system
|
||||||
# in case of cross compilation thess macro should be defined by toolchain file
|
# in case of cross compilation these macros should be defined by the toolchain file
|
||||||
if(NOT COMMAND find_host_package)
|
if(NOT COMMAND find_host_package)
|
||||||
macro(find_host_package)
|
macro(find_host_package)
|
||||||
find_package(${ARGN})
|
find_package(${ARGN})
|
||||||
@ -128,7 +128,7 @@ function(ocv_is_opencv_directory result_var dir)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
# adds include directories in such way that directories from the OpenCV source tree go first
|
# adds include directories in such a way that directories from the OpenCV source tree go first
|
||||||
function(ocv_include_directories)
|
function(ocv_include_directories)
|
||||||
ocv_debug_message("ocv_include_directories( ${ARGN} )")
|
ocv_debug_message("ocv_include_directories( ${ARGN} )")
|
||||||
set(__add_before "")
|
set(__add_before "")
|
||||||
@ -162,7 +162,7 @@ function(ocv_append_dependant_targets target)
|
|||||||
set(OPENCV_DEPENDANT_TARGETS_${target} "${OPENCV_DEPENDANT_TARGETS_${target}};${ARGN}" CACHE INTERNAL "" FORCE)
|
set(OPENCV_DEPENDANT_TARGETS_${target} "${OPENCV_DEPENDANT_TARGETS_${target}};${ARGN}" CACHE INTERNAL "" FORCE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# adds include directories in such way that directories from the OpenCV source tree go first
|
# adds include directories in such a way that directories from the OpenCV source tree go first
|
||||||
function(ocv_target_include_directories target)
|
function(ocv_target_include_directories target)
|
||||||
#ocv_debug_message("ocv_target_include_directories(${target} ${ARGN})")
|
#ocv_debug_message("ocv_target_include_directories(${target} ${ARGN})")
|
||||||
_ocv_fix_target(target)
|
_ocv_fix_target(target)
|
||||||
@ -497,7 +497,7 @@ macro(ocv_check_modules define)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
# Macros that checks if module have been installed.
|
# Macro that checks if module has been installed.
|
||||||
# After it adds module to build and define
|
# After it adds module to build and define
|
||||||
# constants passed as second arg
|
# constants passed as second arg
|
||||||
macro(CHECK_MODULE module_name define cv_module)
|
macro(CHECK_MODULE module_name define cv_module)
|
||||||
@ -656,7 +656,7 @@ macro(ocv_list_add_suffix LST SUFFIX)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
# gets and removes the first element from list
|
# gets and removes the first element from the list
|
||||||
macro(ocv_list_pop_front LST VAR)
|
macro(ocv_list_pop_front LST VAR)
|
||||||
if(${LST})
|
if(${LST})
|
||||||
list(GET ${LST} 0 ${VAR})
|
list(GET ${LST} 0 ${VAR})
|
||||||
|
@ -13,8 +13,8 @@ set(OPENCV_VERSION "${OPENCV_VERSION_PLAIN}${OPENCV_VERSION_STATUS}")
|
|||||||
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
|
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
|
||||||
set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
||||||
|
|
||||||
# create a dependency on version file
|
# create a dependency on the version file
|
||||||
# we never use output of the following command but cmake will rerun automatically if the version file changes
|
# we never use the output of the following command but cmake will rerun automatically if the version file changes
|
||||||
configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY)
|
configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY)
|
||||||
|
|
||||||
ocv_update(OPENCV_VS_VER_FILEVERSION_QUAD "${OPENCV_VERSION_MAJOR},${OPENCV_VERSION_MINOR},${OPENCV_VERSION_PATCH},0")
|
ocv_update(OPENCV_VS_VER_FILEVERSION_QUAD "${OPENCV_VERSION_MAJOR},${OPENCV_VERSION_MINOR},${OPENCV_VERSION_PATCH},0")
|
||||||
|
@ -198,12 +198,12 @@ If threads == 0, OpenCV will disable threading optimizations and run all it's fu
|
|||||||
sequentially. Passing threads \< 0 will reset threads number to system default. This function must
|
sequentially. Passing threads \< 0 will reset threads number to system default. This function must
|
||||||
be called outside of parallel region.
|
be called outside of parallel region.
|
||||||
|
|
||||||
OpenCV will try to run it's functions with specified threads number, but some behaviour differs from
|
OpenCV will try to run its functions with specified threads number, but some behaviour differs from
|
||||||
framework:
|
framework:
|
||||||
- `TBB` - User-defined parallel constructions will run with the same threads number, if
|
- `TBB` - User-defined parallel constructions will run with the same threads number, if
|
||||||
another does not specified. If later on user creates own scheduler, OpenCV will use it.
|
another is not specified. If later on user creates his own scheduler, OpenCV will use it.
|
||||||
- `OpenMP` - No special defined behaviour.
|
- `OpenMP` - No special defined behaviour.
|
||||||
- `Concurrency` - If threads == 1, OpenCV will disable threading optimizations and run it's
|
- `Concurrency` - If threads == 1, OpenCV will disable threading optimizations and run its
|
||||||
functions sequentially.
|
functions sequentially.
|
||||||
- `GCD` - Supports only values \<= 0.
|
- `GCD` - Supports only values \<= 0.
|
||||||
- `C=` - No special defined behaviour.
|
- `C=` - No special defined behaviour.
|
||||||
@ -233,7 +233,7 @@ CV_EXPORTS_W int getNumThreads();
|
|||||||
/** @brief Returns the index of the currently executed thread within the current parallel region. Always
|
/** @brief Returns the index of the currently executed thread within the current parallel region. Always
|
||||||
returns 0 if called outside of parallel region.
|
returns 0 if called outside of parallel region.
|
||||||
|
|
||||||
The exact meaning of return value depends on the threading framework used by OpenCV library:
|
The exact meaning of the return value depends on the threading framework used by OpenCV library:
|
||||||
- `TBB` - Unsupported with current 4.1 TBB release. Maybe will be supported in future.
|
- `TBB` - Unsupported with current 4.1 TBB release. Maybe will be supported in future.
|
||||||
- `OpenMP` - The thread number, within the current team, of the calling thread.
|
- `OpenMP` - The thread number, within the current team, of the calling thread.
|
||||||
- `Concurrency` - An ID for the virtual processor that the current context is executing on (0
|
- `Concurrency` - An ID for the virtual processor that the current context is executing on (0
|
||||||
@ -285,6 +285,19 @@ tm.start();
|
|||||||
tm.stop();
|
tm.stop();
|
||||||
std::cout << tm.getTimeSec();
|
std::cout << tm.getTimeSec();
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
It is also possible to compute the average time over multiple runs:
|
||||||
|
@code
|
||||||
|
TickMeter tm;
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
tm.start();
|
||||||
|
// do something ...
|
||||||
|
tm.stop();
|
||||||
|
}
|
||||||
|
double average_time = tm.getTimeSec() / tm.getCounter();
|
||||||
|
std::cout << "Average time in second per iteration is: " << average_time << std::endl;
|
||||||
|
@endcode
|
||||||
@sa getTickCount, getTickFrequency
|
@sa getTickCount, getTickFrequency
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -428,12 +441,13 @@ The function returns the aligned pointer of the same type as the input pointer:
|
|||||||
*/
|
*/
|
||||||
template<typename _Tp> static inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_Tp))
|
template<typename _Tp> static inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_Tp))
|
||||||
{
|
{
|
||||||
|
CV_DbgAssert((n & (n - 1)) == 0); // n is a power of 2
|
||||||
return (_Tp*)(((size_t)ptr + n-1) & -n);
|
return (_Tp*)(((size_t)ptr + n-1) & -n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Aligns a buffer size to the specified number of bytes.
|
/** @brief Aligns a buffer size to the specified number of bytes.
|
||||||
|
|
||||||
The function returns the minimum number that is greater or equal to sz and is divisible by n :
|
The function returns the minimum number that is greater than or equal to sz and is divisible by n :
|
||||||
\f[\texttt{(sz + n-1) & -n}\f]
|
\f[\texttt{(sz + n-1) & -n}\f]
|
||||||
@param sz Buffer size to align.
|
@param sz Buffer size to align.
|
||||||
@param n Alignment size that must be a power of two.
|
@param n Alignment size that must be a power of two.
|
||||||
@ -482,7 +496,7 @@ The function returns true if the optimized code is enabled. Otherwise, it return
|
|||||||
*/
|
*/
|
||||||
CV_EXPORTS_W bool useOptimized();
|
CV_EXPORTS_W bool useOptimized();
|
||||||
|
|
||||||
static inline size_t getElemSize(int type) { return CV_ELEM_SIZE(type); }
|
static inline size_t getElemSize(int type) { return (size_t)CV_ELEM_SIZE(type); }
|
||||||
|
|
||||||
/////////////////////////////// Parallel Primitives //////////////////////////////////
|
/////////////////////////////// Parallel Primitives //////////////////////////////////
|
||||||
|
|
||||||
@ -526,10 +540,10 @@ template<typename _Tp, typename Functor> inline
|
|||||||
void Mat::forEach_impl(const Functor& operation) {
|
void Mat::forEach_impl(const Functor& operation) {
|
||||||
if (false) {
|
if (false) {
|
||||||
operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(0));
|
operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(0));
|
||||||
// If your compiler fail in this line.
|
// If your compiler fails in this line.
|
||||||
// Please check that your functor signature is
|
// Please check that your functor signature is
|
||||||
// (_Tp&, const int*) <- multidimential
|
// (_Tp&, const int*) <- multi-dimensional
|
||||||
// or (_Tp&, void*) <- in case of you don't need current idx.
|
// or (_Tp&, void*) <- in case you don't need current idx.
|
||||||
}
|
}
|
||||||
|
|
||||||
CV_Assert(this->total() / this->size[this->dims - 1] <= INT_MAX);
|
CV_Assert(this->total() / this->size[this->dims - 1] <= INT_MAX);
|
||||||
|
Loading…
Reference in New Issue
Block a user