Fixed mingw build.
This commit is contained in:
parent
bee982b492
commit
f62028dc16
32
3rdparty/libjasper/CMakeLists.txt
vendored
32
3rdparty/libjasper/CMakeLists.txt
vendored
@ -7,31 +7,23 @@ project(${JASPER_LIBRARY})
|
|||||||
|
|
||||||
add_definitions(-DEXCLUDE_MIF_SUPPORT -DEXCLUDE_PNM_SUPPORT -DEXCLUDE_BMP_SUPPORT -DEXCLUDE_RAS_SUPPORT -DEXCLUDE_JPG_SUPPORT -DEXCLUDE_PGX_SUPPORT)
|
add_definitions(-DEXCLUDE_MIF_SUPPORT -DEXCLUDE_PNM_SUPPORT -DEXCLUDE_BMP_SUPPORT -DEXCLUDE_RAS_SUPPORT -DEXCLUDE_JPG_SUPPORT -DEXCLUDE_PGX_SUPPORT)
|
||||||
|
|
||||||
# List of C++ files:
|
|
||||||
ocv_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
ocv_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
# The .cpp files:
|
|
||||||
file(GLOB lib_srcs *.c)
|
file(GLOB lib_srcs *.c)
|
||||||
file(GLOB lib_hdrs *.h)
|
file(GLOB lib_hdrs *.h)
|
||||||
file(GLOB lib_ext_hdrs jasper/*.h)
|
file(GLOB lib_ext_hdrs jasper/*.h)
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------
|
||||||
# Define the library target:
|
# Define the library target:
|
||||||
# ----------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
add_library(${JASPER_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs})
|
add_library(${JASPER_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs})
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
if(NOT ENABLE_NOISY_WARNINGS)
|
|
||||||
string(REPLACE "/W3" "/W0" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
|
||||||
string(REPLACE "/W4" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
endif()
|
|
||||||
add_definitions(-DJAS_WIN_MSVC_BUILD)
|
add_definitions(-DJAS_WIN_MSVC_BUILD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-uninitialized")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
|
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
|
||||||
@ -39,21 +31,17 @@ if(UNIX)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration -Wno-unused")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_target_properties(${JASPER_LIBRARY}
|
set_target_properties(${JASPER_LIBRARY}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
OUTPUT_NAME ${JASPER_LIBRARY}
|
OUTPUT_NAME ${JASPER_LIBRARY}
|
||||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_SOLUTION_FOLDERS)
|
if(ENABLE_SOLUTION_FOLDERS)
|
||||||
set_target_properties(${JASPER_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
set_target_properties(${JASPER_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT BUILD_SHARED_LIBS)
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
install(TARGETS ${JASPER_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
install(TARGETS ${JASPER_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
||||||
endif()
|
endif()
|
||||||
|
23
3rdparty/libjpeg/CMakeLists.txt
vendored
23
3rdparty/libjpeg/CMakeLists.txt
vendored
@ -4,24 +4,17 @@
|
|||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
project(${JPEG_LIBRARY})
|
project(${JPEG_LIBRARY})
|
||||||
|
|
||||||
# List of C++ files:
|
|
||||||
|
|
||||||
ocv_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
ocv_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
# The .cpp files:
|
|
||||||
file(GLOB lib_srcs *.c)
|
file(GLOB lib_srcs *.c)
|
||||||
file(GLOB lib_hdrs *.h)
|
file(GLOB lib_hdrs *.h)
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------
|
||||||
# Define the library target:
|
# Define the library target:
|
||||||
# ----------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
add_library(${JPEG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
|
add_library(${JPEG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
|
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||||
@ -33,15 +26,15 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(${JPEG_LIBRARY}
|
set_target_properties(${JPEG_LIBRARY}
|
||||||
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
|
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
|
||||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}
|
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_SOLUTION_FOLDERS)
|
if(ENABLE_SOLUTION_FOLDERS)
|
||||||
set_target_properties(${JPEG_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
set_target_properties(${JPEG_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT BUILD_SHARED_LIBS)
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
install(TARGETS ${JPEG_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
install(TARGETS ${JPEG_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
||||||
endif()
|
endif()
|
||||||
|
20
3rdparty/libpng/CMakeLists.txt
vendored
20
3rdparty/libpng/CMakeLists.txt
vendored
@ -4,23 +4,17 @@
|
|||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
project(${PNG_LIBRARY})
|
project(${PNG_LIBRARY})
|
||||||
|
|
||||||
# List of C++ files:
|
|
||||||
|
|
||||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIR})
|
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
file(GLOB lib_srcs *.c)
|
file(GLOB lib_srcs *.c)
|
||||||
file(GLOB lib_hdrs *.h)
|
file(GLOB lib_hdrs *.h)
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------
|
||||||
# Define the library target:
|
# Define the library target:
|
||||||
# ----------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
|
add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
|
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||||
@ -28,15 +22,15 @@ if(UNIX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(${PNG_LIBRARY}
|
set_target_properties(${PNG_LIBRARY}
|
||||||
PROPERTIES OUTPUT_NAME ${PNG_LIBRARY}
|
PROPERTIES OUTPUT_NAME ${PNG_LIBRARY}
|
||||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_SOLUTION_FOLDERS)
|
if(ENABLE_SOLUTION_FOLDERS)
|
||||||
set_target_properties(${PNG_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
set_target_properties(${PNG_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT BUILD_SHARED_LIBS)
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
install(TARGETS ${PNG_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
install(TARGETS ${PNG_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
||||||
endif()
|
endif()
|
||||||
|
21
3rdparty/libtiff/CMakeLists.txt
vendored
21
3rdparty/libtiff/CMakeLists.txt
vendored
@ -26,7 +26,6 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tif_config.h.cmakein"
|
|||||||
|
|
||||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIR})
|
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
# List of C++ files:
|
|
||||||
set(lib_srcs
|
set(lib_srcs
|
||||||
tif_aux.c
|
tif_aux.c
|
||||||
tif_close.c
|
tif_close.c
|
||||||
@ -91,10 +90,8 @@ if(WIN32)
|
|||||||
list(APPEND lib_srcs tif_win32.c)
|
list(APPEND lib_srcs tif_win32.c)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
if(MSVC AND NOT ENABLE_NOISY_WARNINGS)
|
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef)
|
||||||
string(REPLACE "/W4" "/W0" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations)
|
||||||
string(REPLACE "/W4" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
|
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||||
@ -104,15 +101,15 @@ add_library(${TIFF_LIBRARY} STATIC ${lib_srcs})
|
|||||||
target_link_libraries(${TIFF_LIBRARY} ${ZLIB_LIBRARIES})
|
target_link_libraries(${TIFF_LIBRARY} ${ZLIB_LIBRARIES})
|
||||||
|
|
||||||
set_target_properties(${TIFF_LIBRARY}
|
set_target_properties(${TIFF_LIBRARY}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
OUTPUT_NAME "${TIFF_LIBRARY}"
|
OUTPUT_NAME "${TIFF_LIBRARY}"
|
||||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_SOLUTION_FOLDERS)
|
if(ENABLE_SOLUTION_FOLDERS)
|
||||||
set_target_properties(${TIFF_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
set_target_properties(${TIFF_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT BUILD_SHARED_LIBS)
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
install(TARGETS ${TIFF_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
install(TARGETS ${TIFF_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
||||||
|
2
3rdparty/libtiff/tif_config.h.cmakein
vendored
2
3rdparty/libtiff/tif_config.h.cmakein
vendored
@ -143,7 +143,7 @@
|
|||||||
|
|
||||||
/* Signed 64-bit type formatter */
|
/* Signed 64-bit type formatter */
|
||||||
/* Unsigned 64-bit type formatter */
|
/* Unsigned 64-bit type formatter */
|
||||||
#ifdef _MSC_VER
|
#if defined _MSC_VER || defined __MINGW__ || defined __MINGW32__
|
||||||
# define TIFF_UINT64_FORMAT "%I64u"
|
# define TIFF_UINT64_FORMAT "%I64u"
|
||||||
# define TIFF_SSIZE_FORMAT "%Iu"
|
# define TIFF_SSIZE_FORMAT "%Iu"
|
||||||
#else
|
#else
|
||||||
|
15
3rdparty/zlib/CMakeLists.txt
vendored
15
3rdparty/zlib/CMakeLists.txt
vendored
@ -5,19 +5,10 @@
|
|||||||
|
|
||||||
project(${ZLIB_LIBRARY} C)
|
project(${ZLIB_LIBRARY} C)
|
||||||
|
|
||||||
include(CheckTypeSize)
|
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
#
|
|
||||||
# Check to see if we have large file support
|
|
||||||
#
|
|
||||||
check_type_size(off64_t OFF64_T)
|
|
||||||
if(HAVE_OFF64_T)
|
|
||||||
add_definitions(-D_LARGEFILE64_SOURCE=1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check for fseeko
|
# Check for fseeko
|
||||||
#
|
#
|
||||||
@ -82,9 +73,7 @@ if(UNIX)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC AND NOT ENABLE_NOISY_WARNINGS)
|
ocv_warnings_disable(CMAKE_C_FLAGS /wd4013 -Wattributes -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4013")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_target_properties(${ZLIB_LIBRARY} PROPERTIES
|
set_target_properties(${ZLIB_LIBRARY} PROPERTIES
|
||||||
OUTPUT_NAME ${ZLIB_LIBRARY}
|
OUTPUT_NAME ${ZLIB_LIBRARY}
|
||||||
@ -95,7 +84,7 @@ set_target_properties(${ZLIB_LIBRARY} PROPERTIES
|
|||||||
if(ENABLE_SOLUTION_FOLDERS)
|
if(ENABLE_SOLUTION_FOLDERS)
|
||||||
set_target_properties(${ZLIB_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
set_target_properties(${ZLIB_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT BUILD_SHARED_LIBS)
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
install(TARGETS ${ZLIB_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
install(TARGETS ${ZLIB_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
||||||
endif()
|
endif()
|
||||||
|
8
3rdparty/zlib/zconf.h.cmakein
vendored
8
3rdparty/zlib/zconf.h.cmakein
vendored
@ -414,6 +414,14 @@ typedef uLong FAR uLongf;
|
|||||||
# undef _LARGEFILE64_SOURCE
|
# undef _LARGEFILE64_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _LFS64_LARGEFILE
|
||||||
|
# define _LFS64_LARGEFILE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _FILE_OFFSET_BITS
|
||||||
|
# define _FILE_OFFSET_BITS
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||||
# define Z_LARGE
|
# define Z_LARGE
|
||||||
#endif
|
#endif
|
||||||
|
@ -329,6 +329,15 @@ if(UNIX)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check to see if we have large file support (needed by zlib)
|
||||||
|
#
|
||||||
|
include(CheckTypeSize)
|
||||||
|
check_type_size(off64_t OFF64_T)
|
||||||
|
if(HAVE_OFF64_T)
|
||||||
|
add_definitions(-D_LARGEFILE64_SOURCE=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(cmake/OpenCVPCHSupport.cmake REQUIRED)
|
include(cmake/OpenCVPCHSupport.cmake REQUIRED)
|
||||||
include(cmake/OpenCVModule.cmake REQUIRED)
|
include(cmake/OpenCVModule.cmake REQUIRED)
|
||||||
|
|
||||||
|
@ -213,13 +213,10 @@ static int icvFindStumpThreshold_##suffix(
|
|||||||
float* curval = NULL; \
|
float* curval = NULL; \
|
||||||
float curlerror = 0.0F; \
|
float curlerror = 0.0F; \
|
||||||
float currerror = 0.0F; \
|
float currerror = 0.0F; \
|
||||||
float wposl; \
|
|
||||||
float wposr; \
|
|
||||||
\
|
\
|
||||||
int i = 0; \
|
int i = 0; \
|
||||||
int idx = 0; \
|
int idx = 0; \
|
||||||
\
|
\
|
||||||
wposl = wposr = 0.0F; \
|
|
||||||
if( *sumw == FLT_MAX ) \
|
if( *sumw == FLT_MAX ) \
|
||||||
{ \
|
{ \
|
||||||
/* calculate sums */ \
|
/* calculate sums */ \
|
||||||
@ -298,8 +295,8 @@ static int icvFindStumpThreshold_##suffix(
|
|||||||
*/
|
*/
|
||||||
#define ICV_DEF_FIND_STUMP_THRESHOLD_MISC( suffix, type ) \
|
#define ICV_DEF_FIND_STUMP_THRESHOLD_MISC( suffix, type ) \
|
||||||
ICV_DEF_FIND_STUMP_THRESHOLD( misc_##suffix, type, \
|
ICV_DEF_FIND_STUMP_THRESHOLD( misc_##suffix, type, \
|
||||||
wposl = 0.5F * ( wl + wyl ); \
|
float wposl = 0.5F * ( wl + wyl ); \
|
||||||
wposr = 0.5F * ( wr + wyr ); \
|
float wposr = 0.5F * ( wr + wyr ); \
|
||||||
curleft = 0.5F * ( 1.0F + curleft ); \
|
curleft = 0.5F * ( 1.0F + curleft ); \
|
||||||
curright = 0.5F * ( 1.0F + curright ); \
|
curright = 0.5F * ( 1.0F + curright ); \
|
||||||
curlerror = MIN( wposl, wl - wposl ); \
|
curlerror = MIN( wposl, wl - wposl ); \
|
||||||
@ -311,8 +308,8 @@ static int icvFindStumpThreshold_##suffix(
|
|||||||
*/
|
*/
|
||||||
#define ICV_DEF_FIND_STUMP_THRESHOLD_GINI( suffix, type ) \
|
#define ICV_DEF_FIND_STUMP_THRESHOLD_GINI( suffix, type ) \
|
||||||
ICV_DEF_FIND_STUMP_THRESHOLD( gini_##suffix, type, \
|
ICV_DEF_FIND_STUMP_THRESHOLD( gini_##suffix, type, \
|
||||||
wposl = 0.5F * ( wl + wyl ); \
|
float wposl = 0.5F * ( wl + wyl ); \
|
||||||
wposr = 0.5F * ( wr + wyr ); \
|
float wposr = 0.5F * ( wr + wyr ); \
|
||||||
curleft = 0.5F * ( 1.0F + curleft ); \
|
curleft = 0.5F * ( 1.0F + curleft ); \
|
||||||
curright = 0.5F * ( 1.0F + curright ); \
|
curright = 0.5F * ( 1.0F + curright ); \
|
||||||
curlerror = 2.0F * wposl * ( 1.0F - curleft ); \
|
curlerror = 2.0F * wposl * ( 1.0F - curleft ); \
|
||||||
@ -326,8 +323,8 @@ static int icvFindStumpThreshold_##suffix(
|
|||||||
*/
|
*/
|
||||||
#define ICV_DEF_FIND_STUMP_THRESHOLD_ENTROPY( suffix, type ) \
|
#define ICV_DEF_FIND_STUMP_THRESHOLD_ENTROPY( suffix, type ) \
|
||||||
ICV_DEF_FIND_STUMP_THRESHOLD( entropy_##suffix, type, \
|
ICV_DEF_FIND_STUMP_THRESHOLD( entropy_##suffix, type, \
|
||||||
wposl = 0.5F * ( wl + wyl ); \
|
float wposl = 0.5F * ( wl + wyl ); \
|
||||||
wposr = 0.5F * ( wr + wyr ); \
|
float wposr = 0.5F * ( wr + wyr ); \
|
||||||
curleft = 0.5F * ( 1.0F + curleft ); \
|
curleft = 0.5F * ( 1.0F + curleft ); \
|
||||||
curright = 0.5F * ( 1.0F + curright ); \
|
curright = 0.5F * ( 1.0F + curright ); \
|
||||||
curlerror = currerror = 0.0F; \
|
curlerror = currerror = 0.0F; \
|
||||||
@ -1560,7 +1557,7 @@ CvBoostTrainer* icvBoostStartTraining( CvMat* trainClasses,
|
|||||||
CV_MAT2VEC( *trainClasses, ydata, ystep, m );
|
CV_MAT2VEC( *trainClasses, ydata, ystep, m );
|
||||||
CV_MAT2VEC( *weakTrainVals, traindata, trainstep, trainnum );
|
CV_MAT2VEC( *weakTrainVals, traindata, trainstep, trainnum );
|
||||||
|
|
||||||
assert( m == trainnum );
|
CV_Assert( m == trainnum );
|
||||||
|
|
||||||
idxnum = 0;
|
idxnum = 0;
|
||||||
idxstep = 0;
|
idxstep = 0;
|
||||||
@ -1640,8 +1637,8 @@ float icvBoostNextWeakClassifierDAB( CvMat* weakEvalVals,
|
|||||||
CV_MAT2VEC( *trainClasses, ydata, ystep, ynum );
|
CV_MAT2VEC( *trainClasses, ydata, ystep, ynum );
|
||||||
CV_MAT2VEC( *weights, wdata, wstep, wnum );
|
CV_MAT2VEC( *weights, wdata, wstep, wnum );
|
||||||
|
|
||||||
assert( m == ynum );
|
CV_Assert( m == ynum );
|
||||||
assert( m == wnum );
|
CV_Assert( m == wnum );
|
||||||
|
|
||||||
sumw = 0.0F;
|
sumw = 0.0F;
|
||||||
err = 0.0F;
|
err = 0.0F;
|
||||||
@ -1808,8 +1805,8 @@ CvBoostTrainer* icvBoostStartTrainingLB( CvMat* trainClasses,
|
|||||||
CV_MAT2VEC( *weakTrainVals, traindata, trainstep, trainnum );
|
CV_MAT2VEC( *weakTrainVals, traindata, trainstep, trainnum );
|
||||||
CV_MAT2VEC( *weights, wdata, wstep, wnum );
|
CV_MAT2VEC( *weights, wdata, wstep, wnum );
|
||||||
|
|
||||||
assert( m == trainnum );
|
CV_Assert( m == trainnum );
|
||||||
assert( m == wnum );
|
CV_Assert( m == wnum );
|
||||||
|
|
||||||
|
|
||||||
idxnum = 0;
|
idxnum = 0;
|
||||||
@ -1889,9 +1886,9 @@ float icvBoostNextWeakClassifierLB( CvMat* weakEvalVals,
|
|||||||
CV_MAT2VEC( *weakTrainVals, traindata, trainstep, trainnum );
|
CV_MAT2VEC( *weakTrainVals, traindata, trainstep, trainnum );
|
||||||
CV_MAT2VEC( *weights, wdata, wstep, wnum );
|
CV_MAT2VEC( *weights, wdata, wstep, wnum );
|
||||||
|
|
||||||
assert( m == ynum );
|
CV_Assert( m == ynum );
|
||||||
assert( m == wnum );
|
CV_Assert( m == wnum );
|
||||||
assert( m == trainnum );
|
CV_Assert( m == trainnum );
|
||||||
//assert( m == trainer->count );
|
//assert( m == trainer->count );
|
||||||
|
|
||||||
for( i = 0; i < trainer->count; i++ )
|
for( i = 0; i < trainer->count; i++ )
|
||||||
@ -1944,8 +1941,8 @@ float icvBoostNextWeakClassifierGAB( CvMat* weakEvalVals,
|
|||||||
CV_MAT2VEC( *trainClasses, ydata, ystep, ynum );
|
CV_MAT2VEC( *trainClasses, ydata, ystep, ynum );
|
||||||
CV_MAT2VEC( *weights, wdata, wstep, wnum );
|
CV_MAT2VEC( *weights, wdata, wstep, wnum );
|
||||||
|
|
||||||
assert( m == ynum );
|
CV_Assert( m == ynum );
|
||||||
assert( m == wnum );
|
CV_Assert( m == wnum );
|
||||||
|
|
||||||
sumw = 0.0F;
|
sumw = 0.0F;
|
||||||
for( i = 0; i < trainer->count; i++ )
|
for( i = 0; i < trainer->count; i++ )
|
||||||
|
@ -525,9 +525,9 @@ float icvEvalTreeCascadeClassifierFilter( CvIntHaarClassifier* classifier, sum_t
|
|||||||
sum_type* tilted, float normfactor )
|
sum_type* tilted, float normfactor )
|
||||||
{
|
{
|
||||||
CvTreeCascadeNode* ptr;
|
CvTreeCascadeNode* ptr;
|
||||||
CvTreeCascadeClassifier* tree;
|
//CvTreeCascadeClassifier* tree;
|
||||||
|
|
||||||
tree = (CvTreeCascadeClassifier*) classifier;
|
//tree = (CvTreeCascadeClassifier*) classifier;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,10 +169,11 @@ CvIntHaarFeatures* icvCreateIntHaarFeatures( CvSize winsize,
|
|||||||
int dx = 0;
|
int dx = 0;
|
||||||
int dy = 0;
|
int dy = 0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
float factor = 1.0F;
|
float factor = 1.0F;
|
||||||
|
|
||||||
factor = ((float) winsize.width) * winsize.height / (24 * 24);
|
factor = ((float) winsize.width) * winsize.height / (24 * 24);
|
||||||
#if 0
|
|
||||||
s0 = (int) (s0 * factor);
|
s0 = (int) (s0 * factor);
|
||||||
s1 = (int) (s1 * factor);
|
s1 = (int) (s1 * factor);
|
||||||
s2 = (int) (s2 * factor);
|
s2 = (int) (s2 * factor);
|
||||||
|
@ -44,6 +44,12 @@ if(MSVC AND CMAKE_C_COMPILER MATCHES "icc")
|
|||||||
set(CV_ICC __INTEL_COMPILER_FOR_WINDOWS)
|
set(CV_ICC __INTEL_COMPILER_FOR_WINDOWS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR (UNIX AND CV_ICC))
|
||||||
|
set(CV_COMPILER_IS_GNU TRUE)
|
||||||
|
else()
|
||||||
|
set(CV_COMPILER_IS_GNU FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Detect GNU version:
|
# Detect GNU version:
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
@ -32,6 +32,46 @@ macro(ocv_clear_vars)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# turns off warnings
|
||||||
|
macro(ocv_warnings_disable)
|
||||||
|
if(NOT ENABLE_NOISY_WARNINGS)
|
||||||
|
set(_flag_vars "")
|
||||||
|
set(_msvc_warnings "")
|
||||||
|
set(_gxx_warnings "")
|
||||||
|
foreach(arg ${ARGN})
|
||||||
|
if(arg MATCHES "^CMAKE_")
|
||||||
|
list(APPEND _flag_vars ${arg})
|
||||||
|
elseif(arg MATCHES "^/wd")
|
||||||
|
list(APPEND _msvc_warnings ${arg})
|
||||||
|
elseif(arg MATCHES "^-W")
|
||||||
|
list(APPEND _gxx_warnings ${arg})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(MSVC AND _msvc_warnings AND _flag_vars)
|
||||||
|
foreach(var ${_flag_vars})
|
||||||
|
foreach(warning ${_msvc_warnings})
|
||||||
|
set(${var} "${${var}} ${warning}")
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
elseif(CV_COMPILER_IS_GNU AND _gxx_warnings AND _flag_vars)
|
||||||
|
foreach(var ${_flag_vars})
|
||||||
|
foreach(warning ${_gxx_warnings})
|
||||||
|
if(warning MATCHES "^-Wno-")
|
||||||
|
set(${var} "${${var}} ${warning}")
|
||||||
|
else()
|
||||||
|
string(REPLACE "${warning}" "" ${var} "${${var}}")
|
||||||
|
string(REPLACE "-W" "-Wno-" warning "${warning}")
|
||||||
|
set(${var} "${${var}} ${warning}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
unset(_flag_vars)
|
||||||
|
unset(_msvc_warnings)
|
||||||
|
unset(_gxx_warnings)
|
||||||
|
endif(NOT ENABLE_NOISY_WARNINGS)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# Provides an option that the user can optionally select.
|
# Provides an option that the user can optionally select.
|
||||||
# Can accept condition to control when option is available for user.
|
# Can accept condition to control when option is available for user.
|
||||||
# Usage:
|
# Usage:
|
||||||
|
@ -252,7 +252,7 @@ bool cv::find4QuadCornerSubpix(InputArray _img, InputOutputArray _corners, Size
|
|||||||
int black_thresh = histQuantile(hist, 0.45f);
|
int black_thresh = histQuantile(hist, 0.45f);
|
||||||
int white_thresh = histQuantile(hist, 0.55f);
|
int white_thresh = histQuantile(hist, 0.55f);
|
||||||
#else
|
#else
|
||||||
int black_thresh, white_thresh;
|
int black_thresh = 0, white_thresh = 0;
|
||||||
segment_hist_max(hist, black_thresh, white_thresh);
|
segment_hist_max(hist, black_thresh, white_thresh);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
|
||||||
Retina::Retina(const cv::Size inputSize)
|
Retina::Retina(const cv::Size inputSize)
|
||||||
{
|
{
|
||||||
_retinaFilter = 0;
|
_retinaFilter = 0;
|
||||||
@ -94,19 +94,19 @@ Retina::~Retina()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retreive retina input buffer size
|
* retreive retina input buffer size
|
||||||
*/
|
*/
|
||||||
Size Retina::inputSize(){return cv::Size(_retinaFilter->getInputNBcolumns(), _retinaFilter->getInputNBrows());}
|
Size Retina::inputSize(){return cv::Size(_retinaFilter->getInputNBcolumns(), _retinaFilter->getInputNBrows());}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retreive retina output buffer size
|
* retreive retina output buffer size
|
||||||
*/
|
*/
|
||||||
Size Retina::outputSize(){return cv::Size(_retinaFilter->getOutputNBcolumns(), _retinaFilter->getOutputNBrows());}
|
Size Retina::outputSize(){return cv::Size(_retinaFilter->getOutputNBcolumns(), _retinaFilter->getOutputNBrows());}
|
||||||
|
|
||||||
|
|
||||||
void Retina::setColorSaturation(const bool saturateColors, const float colorSaturationValue)
|
void Retina::setColorSaturation(const bool saturateColors, const float colorSaturationValue)
|
||||||
{
|
{
|
||||||
_retinaFilter->setColorSaturation(saturateColors, colorSaturationValue);
|
_retinaFilter->setColorSaturation(saturateColors, colorSaturationValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Retina::RetinaParameters Retina::getParameters(){return _retinaParameters;}
|
struct Retina::RetinaParameters Retina::getParameters(){return _retinaParameters;}
|
||||||
@ -121,71 +121,71 @@ void Retina::setup(std::string retinaParameterFile, const bool applyDefaultSetup
|
|||||||
setup(fs, applyDefaultSetupOnFailure);
|
setup(fs, applyDefaultSetupOnFailure);
|
||||||
}catch(Exception &e)
|
}catch(Exception &e)
|
||||||
{
|
{
|
||||||
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
|
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
|
||||||
if (applyDefaultSetupOnFailure)
|
if (applyDefaultSetupOnFailure)
|
||||||
{
|
{
|
||||||
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
|
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
|
||||||
setupOPLandIPLParvoChannel();
|
setupOPLandIPLParvoChannel();
|
||||||
setupIPLMagnoChannel();
|
setupIPLMagnoChannel();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<"=> keeping current parameters"<<std::endl;
|
std::cout<<"=> keeping current parameters"<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Retina::setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure)
|
void Retina::setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// read parameters file if it exists or apply default setup if asked for
|
// read parameters file if it exists or apply default setup if asked for
|
||||||
if (!fs.isOpened())
|
if (!fs.isOpened())
|
||||||
{
|
{
|
||||||
std::cout<<"Retina::setup: provided parameters file could not be open... skeeping configuration"<<std::endl;
|
std::cout<<"Retina::setup: provided parameters file could not be open... skeeping configuration"<<std::endl;
|
||||||
return;
|
return;
|
||||||
// implicit else case : retinaParameterFile could be open (it exists at least)
|
// implicit else case : retinaParameterFile could be open (it exists at least)
|
||||||
}
|
}
|
||||||
// OPL and Parvo init first... update at the same time the parameters structure and the retina core
|
// OPL and Parvo init first... update at the same time the parameters structure and the retina core
|
||||||
cv::FileNode rootFn = fs.root(), currFn=rootFn["OPLandIPLparvo"];
|
cv::FileNode rootFn = fs.root(), currFn=rootFn["OPLandIPLparvo"];
|
||||||
currFn["colorMode"]>>_retinaParameters.OPLandIplParvo.colorMode;
|
currFn["colorMode"]>>_retinaParameters.OPLandIplParvo.colorMode;
|
||||||
currFn["normaliseOutput"]>>_retinaParameters.OPLandIplParvo.normaliseOutput;
|
currFn["normaliseOutput"]>>_retinaParameters.OPLandIplParvo.normaliseOutput;
|
||||||
currFn["photoreceptorsLocalAdaptationSensitivity"]>>_retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity;
|
currFn["photoreceptorsLocalAdaptationSensitivity"]>>_retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity;
|
||||||
currFn["photoreceptorsTemporalConstant"]>>_retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant;
|
currFn["photoreceptorsTemporalConstant"]>>_retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant;
|
||||||
currFn["photoreceptorsSpatialConstant"]>>_retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant;
|
currFn["photoreceptorsSpatialConstant"]>>_retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant;
|
||||||
currFn["horizontalCellsGain"]>>_retinaParameters.OPLandIplParvo.horizontalCellsGain;
|
currFn["horizontalCellsGain"]>>_retinaParameters.OPLandIplParvo.horizontalCellsGain;
|
||||||
currFn["hcellsTemporalConstant"]>>_retinaParameters.OPLandIplParvo.hcellsTemporalConstant;
|
currFn["hcellsTemporalConstant"]>>_retinaParameters.OPLandIplParvo.hcellsTemporalConstant;
|
||||||
currFn["hcellsSpatialConstant"]>>_retinaParameters.OPLandIplParvo.hcellsSpatialConstant;
|
currFn["hcellsSpatialConstant"]>>_retinaParameters.OPLandIplParvo.hcellsSpatialConstant;
|
||||||
currFn["ganglionCellsSensitivity"]>>_retinaParameters.OPLandIplParvo.ganglionCellsSensitivity;
|
currFn["ganglionCellsSensitivity"]>>_retinaParameters.OPLandIplParvo.ganglionCellsSensitivity;
|
||||||
setupOPLandIPLParvoChannel(_retinaParameters.OPLandIplParvo.colorMode, _retinaParameters.OPLandIplParvo.normaliseOutput, _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity, _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant, _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant, _retinaParameters.OPLandIplParvo.horizontalCellsGain, _retinaParameters.OPLandIplParvo.hcellsTemporalConstant, _retinaParameters.OPLandIplParvo.hcellsSpatialConstant, _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity);
|
setupOPLandIPLParvoChannel(_retinaParameters.OPLandIplParvo.colorMode, _retinaParameters.OPLandIplParvo.normaliseOutput, _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity, _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant, _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant, _retinaParameters.OPLandIplParvo.horizontalCellsGain, _retinaParameters.OPLandIplParvo.hcellsTemporalConstant, _retinaParameters.OPLandIplParvo.hcellsSpatialConstant, _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity);
|
||||||
|
|
||||||
// init retina IPL magno setup... update at the same time the parameters structure and the retina core
|
// init retina IPL magno setup... update at the same time the parameters structure and the retina core
|
||||||
currFn=rootFn["IPLmagno"];
|
currFn=rootFn["IPLmagno"];
|
||||||
currFn["normaliseOutput"]>>_retinaParameters.IplMagno.normaliseOutput;
|
currFn["normaliseOutput"]>>_retinaParameters.IplMagno.normaliseOutput;
|
||||||
currFn["parasolCells_beta"]>>_retinaParameters.IplMagno.parasolCells_beta;
|
currFn["parasolCells_beta"]>>_retinaParameters.IplMagno.parasolCells_beta;
|
||||||
currFn["parasolCells_tau"]>>_retinaParameters.IplMagno.parasolCells_tau;
|
currFn["parasolCells_tau"]>>_retinaParameters.IplMagno.parasolCells_tau;
|
||||||
currFn["parasolCells_k"]>>_retinaParameters.IplMagno.parasolCells_k;
|
currFn["parasolCells_k"]>>_retinaParameters.IplMagno.parasolCells_k;
|
||||||
currFn["amacrinCellsTemporalCutFrequency"]>>_retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency;
|
currFn["amacrinCellsTemporalCutFrequency"]>>_retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency;
|
||||||
currFn["V0CompressionParameter"]>>_retinaParameters.IplMagno.V0CompressionParameter;
|
currFn["V0CompressionParameter"]>>_retinaParameters.IplMagno.V0CompressionParameter;
|
||||||
currFn["localAdaptintegration_tau"]>>_retinaParameters.IplMagno.localAdaptintegration_tau;
|
currFn["localAdaptintegration_tau"]>>_retinaParameters.IplMagno.localAdaptintegration_tau;
|
||||||
currFn["localAdaptintegration_k"]>>_retinaParameters.IplMagno.localAdaptintegration_k;
|
currFn["localAdaptintegration_k"]>>_retinaParameters.IplMagno.localAdaptintegration_k;
|
||||||
|
|
||||||
setupIPLMagnoChannel(_retinaParameters.IplMagno.normaliseOutput, _retinaParameters.IplMagno.parasolCells_beta, _retinaParameters.IplMagno.parasolCells_tau, _retinaParameters.IplMagno.parasolCells_k, _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency,_retinaParameters.IplMagno.V0CompressionParameter, _retinaParameters.IplMagno.localAdaptintegration_tau, _retinaParameters.IplMagno.localAdaptintegration_k);
|
setupIPLMagnoChannel(_retinaParameters.IplMagno.normaliseOutput, _retinaParameters.IplMagno.parasolCells_beta, _retinaParameters.IplMagno.parasolCells_tau, _retinaParameters.IplMagno.parasolCells_k, _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency,_retinaParameters.IplMagno.V0CompressionParameter, _retinaParameters.IplMagno.localAdaptintegration_tau, _retinaParameters.IplMagno.localAdaptintegration_k);
|
||||||
|
|
||||||
}catch(Exception &e)
|
}catch(Exception &e)
|
||||||
{
|
{
|
||||||
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
|
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
|
||||||
if (applyDefaultSetupOnFailure)
|
if (applyDefaultSetupOnFailure)
|
||||||
{
|
{
|
||||||
setupOPLandIPLParvoChannel();
|
setupOPLandIPLParvoChannel();
|
||||||
setupIPLMagnoChannel();
|
setupIPLMagnoChannel();
|
||||||
}
|
}
|
||||||
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
|
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
|
||||||
std::cout<<"=> keeping current parameters"<<std::endl;
|
std::cout<<"=> keeping current parameters"<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// report current configuration
|
// report current configuration
|
||||||
std::cout<<printSetup()<<std::endl;
|
std::cout<<printSetup()<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
|
void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
|
||||||
@ -201,35 +201,35 @@ void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
|
|||||||
|
|
||||||
const std::string Retina::printSetup()
|
const std::string Retina::printSetup()
|
||||||
{
|
{
|
||||||
std::stringstream outmessage;
|
std::stringstream outmessage;
|
||||||
|
|
||||||
// displaying OPL and IPL parvo setup
|
// displaying OPL and IPL parvo setup
|
||||||
outmessage<<"Current Retina instance setup :"
|
outmessage<<"Current Retina instance setup :"
|
||||||
<<"\nOPLandIPLparvo"<<"{"
|
<<"\nOPLandIPLparvo"<<"{"
|
||||||
<< "\n==> colorMode : " << _retinaParameters.OPLandIplParvo.colorMode
|
<< "\n==> colorMode : " << _retinaParameters.OPLandIplParvo.colorMode
|
||||||
<< "\n==> normalizeParvoOutput :" << _retinaParameters.OPLandIplParvo.normaliseOutput
|
<< "\n==> normalizeParvoOutput :" << _retinaParameters.OPLandIplParvo.normaliseOutput
|
||||||
<< "\n==> photoreceptorsLocalAdaptationSensitivity : " << _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity
|
<< "\n==> photoreceptorsLocalAdaptationSensitivity : " << _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity
|
||||||
<< "\n==> photoreceptorsTemporalConstant : " << _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant
|
<< "\n==> photoreceptorsTemporalConstant : " << _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant
|
||||||
<< "\n==> photoreceptorsSpatialConstant : " << _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant
|
<< "\n==> photoreceptorsSpatialConstant : " << _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant
|
||||||
<< "\n==> horizontalCellsGain : " << _retinaParameters.OPLandIplParvo.horizontalCellsGain
|
<< "\n==> horizontalCellsGain : " << _retinaParameters.OPLandIplParvo.horizontalCellsGain
|
||||||
<< "\n==> hcellsTemporalConstant : " << _retinaParameters.OPLandIplParvo.hcellsTemporalConstant
|
<< "\n==> hcellsTemporalConstant : " << _retinaParameters.OPLandIplParvo.hcellsTemporalConstant
|
||||||
<< "\n==> hcellsSpatialConstant : " << _retinaParameters.OPLandIplParvo.hcellsSpatialConstant
|
<< "\n==> hcellsSpatialConstant : " << _retinaParameters.OPLandIplParvo.hcellsSpatialConstant
|
||||||
<< "\n==> parvoGanglionCellsSensitivity : " << _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity
|
<< "\n==> parvoGanglionCellsSensitivity : " << _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity
|
||||||
<<"}\n";
|
<<"}\n";
|
||||||
|
|
||||||
// displaying IPL magno setup
|
// displaying IPL magno setup
|
||||||
outmessage<<"Current Retina instance setup :"
|
outmessage<<"Current Retina instance setup :"
|
||||||
<<"\nIPLmagno"<<"{"
|
<<"\nIPLmagno"<<"{"
|
||||||
<< "\n==> normaliseOutput : " << _retinaParameters.IplMagno.normaliseOutput
|
<< "\n==> normaliseOutput : " << _retinaParameters.IplMagno.normaliseOutput
|
||||||
<< "\n==> parasolCells_beta : " << _retinaParameters.IplMagno.parasolCells_beta
|
<< "\n==> parasolCells_beta : " << _retinaParameters.IplMagno.parasolCells_beta
|
||||||
<< "\n==> parasolCells_tau : " << _retinaParameters.IplMagno.parasolCells_tau
|
<< "\n==> parasolCells_tau : " << _retinaParameters.IplMagno.parasolCells_tau
|
||||||
<< "\n==> parasolCells_k : " << _retinaParameters.IplMagno.parasolCells_k
|
<< "\n==> parasolCells_k : " << _retinaParameters.IplMagno.parasolCells_k
|
||||||
<< "\n==> amacrinCellsTemporalCutFrequency : " << _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency
|
<< "\n==> amacrinCellsTemporalCutFrequency : " << _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency
|
||||||
<< "\n==> V0CompressionParameter : " << _retinaParameters.IplMagno.V0CompressionParameter
|
<< "\n==> V0CompressionParameter : " << _retinaParameters.IplMagno.V0CompressionParameter
|
||||||
<< "\n==> localAdaptintegration_tau : " << _retinaParameters.IplMagno.localAdaptintegration_tau
|
<< "\n==> localAdaptintegration_tau : " << _retinaParameters.IplMagno.localAdaptintegration_tau
|
||||||
<< "\n==> localAdaptintegration_k : " << _retinaParameters.IplMagno.localAdaptintegration_k
|
<< "\n==> localAdaptintegration_k : " << _retinaParameters.IplMagno.localAdaptintegration_k
|
||||||
<<"}";
|
<<"}";
|
||||||
return outmessage.str();
|
return outmessage.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Retina::write( std::string fs ) const
|
void Retina::write( std::string fs ) const
|
||||||
@ -240,98 +240,98 @@ void Retina::write( std::string fs ) const
|
|||||||
|
|
||||||
void Retina::write( FileStorage& fs ) const
|
void Retina::write( FileStorage& fs ) const
|
||||||
{
|
{
|
||||||
if (!fs.isOpened())
|
if (!fs.isOpened())
|
||||||
return; // basic error case
|
return; // basic error case
|
||||||
fs<<"OPLandIPLparvo"<<"{";
|
fs<<"OPLandIPLparvo"<<"{";
|
||||||
fs << "colorMode" << _retinaParameters.OPLandIplParvo.colorMode;
|
fs << "colorMode" << _retinaParameters.OPLandIplParvo.colorMode;
|
||||||
fs << "normaliseOutput" << _retinaParameters.OPLandIplParvo.normaliseOutput;
|
fs << "normaliseOutput" << _retinaParameters.OPLandIplParvo.normaliseOutput;
|
||||||
fs << "photoreceptorsLocalAdaptationSensitivity" << _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity;
|
fs << "photoreceptorsLocalAdaptationSensitivity" << _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity;
|
||||||
fs << "photoreceptorsTemporalConstant" << _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant;
|
fs << "photoreceptorsTemporalConstant" << _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant;
|
||||||
fs << "photoreceptorsSpatialConstant" << _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant;
|
fs << "photoreceptorsSpatialConstant" << _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant;
|
||||||
fs << "horizontalCellsGain" << _retinaParameters.OPLandIplParvo.horizontalCellsGain;
|
fs << "horizontalCellsGain" << _retinaParameters.OPLandIplParvo.horizontalCellsGain;
|
||||||
fs << "hcellsTemporalConstant" << _retinaParameters.OPLandIplParvo.hcellsTemporalConstant;
|
fs << "hcellsTemporalConstant" << _retinaParameters.OPLandIplParvo.hcellsTemporalConstant;
|
||||||
fs << "hcellsSpatialConstant" << _retinaParameters.OPLandIplParvo.hcellsSpatialConstant;
|
fs << "hcellsSpatialConstant" << _retinaParameters.OPLandIplParvo.hcellsSpatialConstant;
|
||||||
fs << "ganglionCellsSensitivity" << _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity;
|
fs << "ganglionCellsSensitivity" << _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity;
|
||||||
fs << "}";
|
fs << "}";
|
||||||
fs<<"IPLmagno"<<"{";
|
fs<<"IPLmagno"<<"{";
|
||||||
fs << "normaliseOutput" << _retinaParameters.IplMagno.normaliseOutput;
|
fs << "normaliseOutput" << _retinaParameters.IplMagno.normaliseOutput;
|
||||||
fs << "parasolCells_beta" << _retinaParameters.IplMagno.parasolCells_beta;
|
fs << "parasolCells_beta" << _retinaParameters.IplMagno.parasolCells_beta;
|
||||||
fs << "parasolCells_tau" << _retinaParameters.IplMagno.parasolCells_tau;
|
fs << "parasolCells_tau" << _retinaParameters.IplMagno.parasolCells_tau;
|
||||||
fs << "parasolCells_k" << _retinaParameters.IplMagno.parasolCells_k;
|
fs << "parasolCells_k" << _retinaParameters.IplMagno.parasolCells_k;
|
||||||
fs << "amacrinCellsTemporalCutFrequency" << _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency;
|
fs << "amacrinCellsTemporalCutFrequency" << _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency;
|
||||||
fs << "V0CompressionParameter" << _retinaParameters.IplMagno.V0CompressionParameter;
|
fs << "V0CompressionParameter" << _retinaParameters.IplMagno.V0CompressionParameter;
|
||||||
fs << "localAdaptintegration_tau" << _retinaParameters.IplMagno.localAdaptintegration_tau;
|
fs << "localAdaptintegration_tau" << _retinaParameters.IplMagno.localAdaptintegration_tau;
|
||||||
fs << "localAdaptintegration_k" << _retinaParameters.IplMagno.localAdaptintegration_k;
|
fs << "localAdaptintegration_k" << _retinaParameters.IplMagno.localAdaptintegration_k;
|
||||||
fs<<"}";
|
fs<<"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Retina::setupOPLandIPLParvoChannel(const bool colorMode, const bool normaliseOutput, const float photoreceptorsLocalAdaptationSensitivity, const float photoreceptorsTemporalConstant, const float photoreceptorsSpatialConstant, const float horizontalCellsGain, const float HcellsTemporalConstant, const float HcellsSpatialConstant, const float ganglionCellsSensitivity)
|
void Retina::setupOPLandIPLParvoChannel(const bool colorMode, const bool normaliseOutput, const float photoreceptorsLocalAdaptationSensitivity, const float photoreceptorsTemporalConstant, const float photoreceptorsSpatialConstant, const float horizontalCellsGain, const float HcellsTemporalConstant, const float HcellsSpatialConstant, const float ganglionCellsSensitivity)
|
||||||
{
|
{
|
||||||
// retina core parameters setup
|
// retina core parameters setup
|
||||||
_retinaFilter->setColorMode(colorMode);
|
_retinaFilter->setColorMode(colorMode);
|
||||||
_retinaFilter->setPhotoreceptorsLocalAdaptationSensitivity(photoreceptorsLocalAdaptationSensitivity);
|
_retinaFilter->setPhotoreceptorsLocalAdaptationSensitivity(photoreceptorsLocalAdaptationSensitivity);
|
||||||
_retinaFilter->setOPLandParvoParameters(0, photoreceptorsTemporalConstant, photoreceptorsSpatialConstant, horizontalCellsGain, HcellsTemporalConstant, HcellsSpatialConstant, ganglionCellsSensitivity);
|
_retinaFilter->setOPLandParvoParameters(0, photoreceptorsTemporalConstant, photoreceptorsSpatialConstant, horizontalCellsGain, HcellsTemporalConstant, HcellsSpatialConstant, ganglionCellsSensitivity);
|
||||||
_retinaFilter->setParvoGanglionCellsLocalAdaptationSensitivity(ganglionCellsSensitivity);
|
_retinaFilter->setParvoGanglionCellsLocalAdaptationSensitivity(ganglionCellsSensitivity);
|
||||||
_retinaFilter->activateNormalizeParvoOutput_0_maxOutputValue(normaliseOutput);
|
_retinaFilter->activateNormalizeParvoOutput_0_maxOutputValue(normaliseOutput);
|
||||||
|
|
||||||
// update parameters struture
|
// update parameters struture
|
||||||
|
|
||||||
_retinaParameters.OPLandIplParvo.colorMode = colorMode;
|
_retinaParameters.OPLandIplParvo.colorMode = colorMode;
|
||||||
_retinaParameters.OPLandIplParvo.normaliseOutput = normaliseOutput;
|
_retinaParameters.OPLandIplParvo.normaliseOutput = normaliseOutput;
|
||||||
_retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity = photoreceptorsLocalAdaptationSensitivity;
|
_retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity = photoreceptorsLocalAdaptationSensitivity;
|
||||||
_retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant = photoreceptorsTemporalConstant;
|
_retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant = photoreceptorsTemporalConstant;
|
||||||
_retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant = photoreceptorsSpatialConstant;
|
_retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant = photoreceptorsSpatialConstant;
|
||||||
_retinaParameters.OPLandIplParvo.horizontalCellsGain = horizontalCellsGain;
|
_retinaParameters.OPLandIplParvo.horizontalCellsGain = horizontalCellsGain;
|
||||||
_retinaParameters.OPLandIplParvo.hcellsTemporalConstant = HcellsTemporalConstant;
|
_retinaParameters.OPLandIplParvo.hcellsTemporalConstant = HcellsTemporalConstant;
|
||||||
_retinaParameters.OPLandIplParvo.hcellsSpatialConstant = HcellsSpatialConstant;
|
_retinaParameters.OPLandIplParvo.hcellsSpatialConstant = HcellsSpatialConstant;
|
||||||
_retinaParameters.OPLandIplParvo.ganglionCellsSensitivity = ganglionCellsSensitivity;
|
_retinaParameters.OPLandIplParvo.ganglionCellsSensitivity = ganglionCellsSensitivity;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Retina::setupIPLMagnoChannel(const bool normaliseOutput, const float parasolCells_beta, const float parasolCells_tau, const float parasolCells_k, const float amacrinCellsTemporalCutFrequency, const float V0CompressionParameter, const float localAdaptintegration_tau, const float localAdaptintegration_k)
|
void Retina::setupIPLMagnoChannel(const bool normaliseOutput, const float parasolCells_beta, const float parasolCells_tau, const float parasolCells_k, const float amacrinCellsTemporalCutFrequency, const float V0CompressionParameter, const float localAdaptintegration_tau, const float localAdaptintegration_k)
|
||||||
{
|
{
|
||||||
|
|
||||||
_retinaFilter->setMagnoCoefficientsTable(parasolCells_beta, parasolCells_tau, parasolCells_k, amacrinCellsTemporalCutFrequency, V0CompressionParameter, localAdaptintegration_tau, localAdaptintegration_k);
|
_retinaFilter->setMagnoCoefficientsTable(parasolCells_beta, parasolCells_tau, parasolCells_k, amacrinCellsTemporalCutFrequency, V0CompressionParameter, localAdaptintegration_tau, localAdaptintegration_k);
|
||||||
_retinaFilter->activateNormalizeMagnoOutput_0_maxOutputValue(normaliseOutput);
|
_retinaFilter->activateNormalizeMagnoOutput_0_maxOutputValue(normaliseOutput);
|
||||||
|
|
||||||
// update parameters struture
|
// update parameters struture
|
||||||
_retinaParameters.IplMagno.normaliseOutput = normaliseOutput;
|
_retinaParameters.IplMagno.normaliseOutput = normaliseOutput;
|
||||||
_retinaParameters.IplMagno.parasolCells_beta = parasolCells_beta;
|
_retinaParameters.IplMagno.parasolCells_beta = parasolCells_beta;
|
||||||
_retinaParameters.IplMagno.parasolCells_tau = parasolCells_tau;
|
_retinaParameters.IplMagno.parasolCells_tau = parasolCells_tau;
|
||||||
_retinaParameters.IplMagno.parasolCells_k = parasolCells_k;
|
_retinaParameters.IplMagno.parasolCells_k = parasolCells_k;
|
||||||
_retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency = amacrinCellsTemporalCutFrequency;
|
_retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency = amacrinCellsTemporalCutFrequency;
|
||||||
_retinaParameters.IplMagno.V0CompressionParameter = V0CompressionParameter;
|
_retinaParameters.IplMagno.V0CompressionParameter = V0CompressionParameter;
|
||||||
_retinaParameters.IplMagno.localAdaptintegration_tau = localAdaptintegration_tau;
|
_retinaParameters.IplMagno.localAdaptintegration_tau = localAdaptintegration_tau;
|
||||||
_retinaParameters.IplMagno.localAdaptintegration_k = localAdaptintegration_k;
|
_retinaParameters.IplMagno.localAdaptintegration_k = localAdaptintegration_k;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Retina::run(const cv::Mat &inputMatToConvert)
|
void Retina::run(const cv::Mat &inputMatToConvert)
|
||||||
{
|
{
|
||||||
// first convert input image to the compatible format : std::valarray<float>
|
// first convert input image to the compatible format : std::valarray<float>
|
||||||
const bool colorMode = _convertCvMat2ValarrayBuffer(inputMatToConvert, _inputBuffer);
|
const bool colorMode = _convertCvMat2ValarrayBuffer(inputMatToConvert, _inputBuffer);
|
||||||
// process the retina
|
// process the retina
|
||||||
if (!_retinaFilter->runFilter(_inputBuffer, colorMode, false, _retinaParameters.OPLandIplParvo.colorMode && colorMode, false))
|
if (!_retinaFilter->runFilter(_inputBuffer, colorMode, false, _retinaParameters.OPLandIplParvo.colorMode && colorMode, false))
|
||||||
throw cv::Exception(-1, "Retina cannot be applied, wrong input buffer size", "Retina::run", "Retina.h", 0);
|
throw cv::Exception(-1, "Retina cannot be applied, wrong input buffer size", "Retina::run", "Retina.h", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Retina::getParvo(cv::Mat &retinaOutput_parvo)
|
void Retina::getParvo(cv::Mat &retinaOutput_parvo)
|
||||||
{
|
{
|
||||||
if (_retinaFilter->getColorMode())
|
if (_retinaFilter->getColorMode())
|
||||||
{
|
{
|
||||||
// reallocate output buffer (if necessary)
|
// reallocate output buffer (if necessary)
|
||||||
_convertValarrayBuffer2cvMat(_retinaFilter->getColorOutput(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), true, retinaOutput_parvo);
|
_convertValarrayBuffer2cvMat(_retinaFilter->getColorOutput(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), true, retinaOutput_parvo);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// reallocate output buffer (if necessary)
|
// reallocate output buffer (if necessary)
|
||||||
_convertValarrayBuffer2cvMat(_retinaFilter->getContours(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), false, retinaOutput_parvo);
|
_convertValarrayBuffer2cvMat(_retinaFilter->getContours(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), false, retinaOutput_parvo);
|
||||||
}
|
}
|
||||||
//retinaOutput_parvo/=255.0;
|
//retinaOutput_parvo/=255.0;
|
||||||
}
|
}
|
||||||
void Retina::getMagno(cv::Mat &retinaOutput_magno)
|
void Retina::getMagno(cv::Mat &retinaOutput_magno)
|
||||||
{
|
{
|
||||||
// reallocate output buffer (if necessary)
|
// reallocate output buffer (if necessary)
|
||||||
_convertValarrayBuffer2cvMat(_retinaFilter->getMovingContours(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), false, retinaOutput_magno);
|
_convertValarrayBuffer2cvMat(_retinaFilter->getMovingContours(), _retinaFilter->getOutputNBrows(), _retinaFilter->getOutputNBcolumns(), false, retinaOutput_magno);
|
||||||
//retinaOutput_magno/=255.0;
|
//retinaOutput_magno/=255.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// original API level data accessors : copy buffers if size matches
|
// original API level data accessors : copy buffers if size matches
|
||||||
@ -344,110 +344,112 @@ const std::valarray<float> & Retina::getParvo() const {if (_retinaFilter->getCol
|
|||||||
// private method called by constructirs
|
// private method called by constructirs
|
||||||
void Retina::_init(const cv::Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght)
|
void Retina::_init(const cv::Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght)
|
||||||
{
|
{
|
||||||
// basic error check
|
// basic error check
|
||||||
if (inputSize.height*inputSize.width <= 0)
|
if (inputSize.height*inputSize.width <= 0)
|
||||||
throw cv::Exception(-1, "Bad retina size setup : size height and with must be superior to zero", "Retina::setup", "Retina.h", 0);
|
throw cv::Exception(-1, "Bad retina size setup : size height and with must be superior to zero", "Retina::setup", "Retina.h", 0);
|
||||||
|
|
||||||
unsigned int nbPixels=inputSize.height*inputSize.width;
|
unsigned int nbPixels=inputSize.height*inputSize.width;
|
||||||
// resize buffers if size does not match
|
// resize buffers if size does not match
|
||||||
_inputBuffer.resize(nbPixels*3); // buffer supports gray images but also 3 channels color buffers... (larger is better...)
|
_inputBuffer.resize(nbPixels*3); // buffer supports gray images but also 3 channels color buffers... (larger is better...)
|
||||||
|
|
||||||
// allocate the retina model
|
// allocate the retina model
|
||||||
if (_retinaFilter)
|
if (_retinaFilter)
|
||||||
delete _retinaFilter;
|
delete _retinaFilter;
|
||||||
_retinaFilter = new RetinaFilter(inputSize.height, inputSize.width, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght);
|
_retinaFilter = new RetinaFilter(inputSize.height, inputSize.width, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght);
|
||||||
|
|
||||||
// prepare the default parameter XML file with default setup
|
// prepare the default parameter XML file with default setup
|
||||||
setup(_retinaParameters);
|
setup(_retinaParameters);
|
||||||
|
|
||||||
// init retina
|
// init retina
|
||||||
_retinaFilter->clearAllBuffers();
|
_retinaFilter->clearAllBuffers();
|
||||||
|
|
||||||
// report current configuration
|
// report current configuration
|
||||||
std::cout<<printSetup()<<std::endl;
|
std::cout<<printSetup()<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Retina::_convertValarrayBuffer2cvMat(const std::valarray<float> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer)
|
void Retina::_convertValarrayBuffer2cvMat(const std::valarray<float> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer)
|
||||||
{
|
{
|
||||||
// fill output buffer with the valarray buffer
|
// fill output buffer with the valarray buffer
|
||||||
const float *valarrayPTR=get_data(grayMatrixToConvert);
|
const float *valarrayPTR=get_data(grayMatrixToConvert);
|
||||||
if (!colorMode)
|
if (!colorMode)
|
||||||
{
|
{
|
||||||
outBuffer.create(cv::Size(nbColumns, nbRows), CV_8U);
|
outBuffer.create(cv::Size(nbColumns, nbRows), CV_8U);
|
||||||
for (unsigned int i=0;i<nbRows;++i)
|
for (unsigned int i=0;i<nbRows;++i)
|
||||||
{
|
{
|
||||||
for (unsigned int j=0;j<nbColumns;++j)
|
for (unsigned int j=0;j<nbColumns;++j)
|
||||||
{
|
{
|
||||||
cv::Point2d pixel(j,i);
|
cv::Point2d pixel(j,i);
|
||||||
outBuffer.at<unsigned char>(pixel)=(unsigned char)*(valarrayPTR++);
|
outBuffer.at<unsigned char>(pixel)=(unsigned char)*(valarrayPTR++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
const unsigned int doubleNBpixels=_retinaFilter->getOutputNBpixels()*2;
|
const unsigned int doubleNBpixels=_retinaFilter->getOutputNBpixels()*2;
|
||||||
outBuffer.create(cv::Size(nbColumns, nbRows), CV_8UC3);
|
outBuffer.create(cv::Size(nbColumns, nbRows), CV_8UC3);
|
||||||
for (unsigned int i=0;i<nbRows;++i)
|
for (unsigned int i=0;i<nbRows;++i)
|
||||||
{
|
{
|
||||||
for (unsigned int j=0;j<nbColumns;++j,++valarrayPTR)
|
for (unsigned int j=0;j<nbColumns;++j,++valarrayPTR)
|
||||||
{
|
{
|
||||||
cv::Point2d pixel(j,i);
|
cv::Point2d pixel(j,i);
|
||||||
cv::Vec3b pixelValues;
|
cv::Vec3b pixelValues;
|
||||||
pixelValues[2]=(unsigned char)*(valarrayPTR);
|
pixelValues[2]=(unsigned char)*(valarrayPTR);
|
||||||
pixelValues[1]=(unsigned char)*(valarrayPTR+_retinaFilter->getOutputNBpixels());
|
pixelValues[1]=(unsigned char)*(valarrayPTR+_retinaFilter->getOutputNBpixels());
|
||||||
pixelValues[0]=(unsigned char)*(valarrayPTR+doubleNBpixels);
|
pixelValues[0]=(unsigned char)*(valarrayPTR+doubleNBpixels);
|
||||||
|
|
||||||
outBuffer.at<cv::Vec3b>(pixel)=pixelValues;
|
outBuffer.at<cv::Vec3b>(pixel)=pixelValues;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Retina::_convertCvMat2ValarrayBuffer(const cv::Mat inputMatToConvert, std::valarray<float> &outputValarrayMatrix)
|
bool Retina::_convertCvMat2ValarrayBuffer(const cv::Mat inputMatToConvert, std::valarray<float> &outputValarrayMatrix)
|
||||||
{
|
{
|
||||||
// first check input consistency
|
// first check input consistency
|
||||||
if (inputMatToConvert.empty())
|
if (inputMatToConvert.empty())
|
||||||
throw cv::Exception(-1, "Retina cannot be applied, input buffer is empty", "Retina::run", "Retina.h", 0);
|
throw cv::Exception(-1, "Retina cannot be applied, input buffer is empty", "Retina::run", "Retina.h", 0);
|
||||||
|
|
||||||
|
// retreive color mode from image input
|
||||||
|
int imageNumberOfChannels = inputMatToConvert.channels();
|
||||||
|
|
||||||
// retreive color mode from image input
|
|
||||||
int imageNumberOfChannels = inputMatToConvert.channels();
|
|
||||||
|
|
||||||
// convert to float AND fill the valarray buffer
|
// convert to float AND fill the valarray buffer
|
||||||
typedef float T; // define here the target pixel format, here, float
|
typedef float T; // define here the target pixel format, here, float
|
||||||
const int dsttype = DataType<T>::depth; // output buffer is float format
|
const int dsttype = DataType<T>::depth; // output buffer is float format
|
||||||
|
|
||||||
|
|
||||||
if(imageNumberOfChannels==4)
|
if(imageNumberOfChannels==4)
|
||||||
|
{
|
||||||
|
// create a cv::Mat table (for RGBA planes)
|
||||||
|
cv::Mat planes[4] =
|
||||||
{
|
{
|
||||||
// create a cv::Mat table (for RGBA planes)
|
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()*2]),
|
||||||
cv::Mat planes[] =
|
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()]),
|
||||||
{
|
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0])
|
||||||
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()*2]),
|
};
|
||||||
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()]),
|
planes[3] = cv::Mat(inputMatToConvert.size(), dsttype); // last channel (alpha) does not point on the valarray (not usefull in our case)
|
||||||
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0]),
|
// split color cv::Mat in 4 planes... it fills valarray directely
|
||||||
cv::Mat(inputMatToConvert.size(), dsttype) // last channel (alpha) does not point on the valarray (not usefull in our case)
|
cv::split(cv::Mat_<Vec<T, 4> >(inputMatToConvert), planes);
|
||||||
};
|
}
|
||||||
// split color cv::Mat in 4 planes... it fills valarray directely
|
else if (imageNumberOfChannels==3)
|
||||||
cv::split(cv::Mat_<Vec<T, 4> >(inputMatToConvert), planes);
|
{
|
||||||
}else if (imageNumberOfChannels==3)
|
// create a cv::Mat table (for RGB planes)
|
||||||
{
|
cv::Mat planes[] =
|
||||||
// create a cv::Mat table (for RGB planes)
|
{
|
||||||
cv::Mat planes[] =
|
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()*2]),
|
||||||
{
|
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()]),
|
||||||
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()*2]),
|
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0])
|
||||||
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[_retinaFilter->getInputNBpixels()]),
|
};
|
||||||
cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0])
|
// split color cv::Mat in 3 planes... it fills valarray directely
|
||||||
};
|
cv::split(cv::Mat_<Vec<T, 3> >(inputMatToConvert), planes);
|
||||||
// split color cv::Mat in 3 planes... it fills valarray directely
|
}
|
||||||
cv::split(cv::Mat_<Vec<T, 3> >(inputMatToConvert), planes);
|
else if(imageNumberOfChannels==1)
|
||||||
}else if(imageNumberOfChannels==1)
|
{
|
||||||
{
|
// create a cv::Mat header for the valarray
|
||||||
// create a cv::Mat header for the valarray
|
cv::Mat dst(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0]);
|
||||||
cv::Mat dst(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0]);
|
inputMatToConvert.convertTo(dst, dsttype);
|
||||||
inputMatToConvert.convertTo(dst, dsttype);
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
CV_Error(CV_StsUnsupportedFormat, "input image must be single channel (gray levels), bgr format (color) or bgra (color with transparency which won't be considered");
|
CV_Error(CV_StsUnsupportedFormat, "input image must be single channel (gray levels), bgr format (color) or bgra (color with transparency which won't be considered");
|
||||||
|
|
||||||
return imageNumberOfChannels>1; // return bool : false for gray level image processing, true for color mode
|
return imageNumberOfChannels>1; // return bool : false for gray level image processing, true for color mode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,6 +869,8 @@ cvGetModuleInfo( const char* name, const char **version, const char **plugin_lis
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined BUILD_SHARED_LIBS && defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE
|
#if defined BUILD_SHARED_LIBS && defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE
|
||||||
|
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID );
|
||||||
|
|
||||||
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
|
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
|
||||||
{
|
{
|
||||||
if( fdwReason == DLL_THREAD_DETACH || fdwReason == DLL_PROCESS_DETACH )
|
if( fdwReason == DLL_THREAD_DETACH || fdwReason == DLL_PROCESS_DETACH )
|
||||||
|
@ -133,7 +133,7 @@ CV_INIT_ALGORITHM(DenseFeatureDetector, "Feature2D.Dense",
|
|||||||
obj.info()->addParam(obj, "varyImgBoundWithScale", obj.varyImgBoundWithScale));
|
obj.info()->addParam(obj, "varyImgBoundWithScale", obj.varyImgBoundWithScale));
|
||||||
|
|
||||||
CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid",
|
CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid",
|
||||||
//obj.info()->addParam(obj, "detector", (Ptr<Algorithm>&)obj.detector);
|
obj.info()->addParam(obj, "detector", (Ptr<Algorithm>&)obj.detector);
|
||||||
obj.info()->addParam(obj, "maxTotalKeypoints", obj.maxTotalKeypoints);
|
obj.info()->addParam(obj, "maxTotalKeypoints", obj.maxTotalKeypoints);
|
||||||
obj.info()->addParam(obj, "gridRows", obj.gridRows);
|
obj.info()->addParam(obj, "gridRows", obj.gridRows);
|
||||||
obj.info()->addParam(obj, "gridCols", obj.gridCols));
|
obj.info()->addParam(obj, "gridCols", obj.gridCols));
|
||||||
|
@ -911,7 +911,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
|
|||||||
|
|
||||||
dmatcher->radiusMatch( query, matches, radius, masks );
|
dmatcher->radiusMatch( query, matches, radius, masks );
|
||||||
|
|
||||||
int curRes = cvtest::TS::OK;
|
//int curRes = cvtest::TS::OK;
|
||||||
if( (int)matches.size() != queryDescCount )
|
if( (int)matches.size() != queryDescCount )
|
||||||
{
|
{
|
||||||
ts->printf(cvtest::TS::LOG, "Incorrect matches count while test radiusMatch() function (1).\n");
|
ts->printf(cvtest::TS::LOG, "Incorrect matches count while test radiusMatch() function (1).\n");
|
||||||
@ -951,7 +951,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
|
|||||||
}
|
}
|
||||||
if( (float)badCount > (float)queryDescCount*badPart )
|
if( (float)badCount > (float)queryDescCount*badPart )
|
||||||
{
|
{
|
||||||
curRes = cvtest::TS::FAIL_INVALID_OUTPUT;
|
//curRes = cvtest::TS::FAIL_INVALID_OUTPUT;
|
||||||
ts->printf( cvtest::TS::LOG, "%f - too large bad matches part while test radiusMatch() function (2).\n",
|
ts->printf( cvtest::TS::LOG, "%f - too large bad matches part while test radiusMatch() function (2).\n",
|
||||||
(float)badCount/(float)queryDescCount );
|
(float)badCount/(float)queryDescCount );
|
||||||
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
|
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
#undef FLANN_PLATFORM_32_BIT
|
#undef FLANN_PLATFORM_32_BIT
|
||||||
#undef FLANN_PLATFORM_64_BIT
|
#undef FLANN_PLATFORM_64_BIT
|
||||||
#if __amd64__ || __x86_64__ || _WIN64 || _M_X64
|
#if defined __amd64__ || defined __x86_64__ || defined _WIN64 || defined _M_X64
|
||||||
#define FLANN_PLATFORM_64_BIT
|
#define FLANN_PLATFORM_64_BIT
|
||||||
#else
|
#else
|
||||||
#define FLANN_PLATFORM_32_BIT
|
#define FLANN_PLATFORM_32_BIT
|
||||||
|
@ -164,7 +164,7 @@ float test_index_precision(NNIndex<Distance>& index, const Matrix<typename Dista
|
|||||||
int c2 = 1;
|
int c2 = 1;
|
||||||
float p2;
|
float p2;
|
||||||
int c1 = 1;
|
int c1 = 1;
|
||||||
float p1;
|
//float p1;
|
||||||
float time;
|
float time;
|
||||||
DistanceType dist;
|
DistanceType dist;
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ float test_index_precision(NNIndex<Distance>& index, const Matrix<typename Dista
|
|||||||
|
|
||||||
while (p2<precision) {
|
while (p2<precision) {
|
||||||
c1 = c2;
|
c1 = c2;
|
||||||
p1 = p2;
|
//p1 = p2;
|
||||||
c2 *=2;
|
c2 *=2;
|
||||||
p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
|
p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
|
||||||
}
|
}
|
||||||
|
@ -133,12 +133,8 @@ endif()
|
|||||||
|
|
||||||
if(HAVE_OPENNI)
|
if(HAVE_OPENNI)
|
||||||
list(APPEND highgui_srcs src/cap_openni.cpp)
|
list(APPEND highgui_srcs src/cap_openni.cpp)
|
||||||
ocv_include_directories(${OPENNI_INCLUDE_DIR})
|
include_directories(AFTER SYSTEM ${OPENNI_INCLUDE_DIR})
|
||||||
list(APPEND HIGHGUI_LIBRARIES ${OPENNI_LIBRARY})
|
list(APPEND HIGHGUI_LIBRARIES ${OPENNI_LIBRARY})
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set_source_files_properties(src/cap_openni.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -Wno-strict-aliasing")
|
|
||||||
endif()
|
|
||||||
endif(HAVE_OPENNI)
|
endif(HAVE_OPENNI)
|
||||||
|
|
||||||
if(HAVE_opencv_androidcamera)
|
if(HAVE_opencv_androidcamera)
|
||||||
@ -194,7 +190,7 @@ endif()
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
link_directories("${OpenCV_SOURCE_DIR}/3rdparty/lib") # for ffmpeg wrapper only
|
link_directories("${OpenCV_SOURCE_DIR}/3rdparty/lib") # for ffmpeg wrapper only
|
||||||
include_directories(AFTER "${OpenCV_SOURCE_DIR}/3rdparty/include") # for directshow in VS2005 and multi-monitor support on MinGW
|
include_directories(AFTER SYSTEM "${OpenCV_SOURCE_DIR}/3rdparty/include") # for directshow in VS2005 and multi-monitor support on MinGW
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
@ -228,10 +224,7 @@ endif()
|
|||||||
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
|
|
||||||
ocv_add_precompiled_headers(${the_module})
|
ocv_add_precompiled_headers(${the_module})
|
||||||
|
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-deprecated-declarations)
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32 AND WITH_FFMPEG)
|
if(WIN32 AND WITH_FFMPEG)
|
||||||
#copy ffmpeg dll to the output folder
|
#copy ffmpeg dll to the output folder
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
/****************** Capturing video from camera via CMU lib *******************/
|
/****************** Capturing video from camera via CMU lib *******************/
|
||||||
|
|
||||||
#if HAVE_CMU1394
|
#ifdef HAVE_CMU1394
|
||||||
|
|
||||||
// This firewire capability added by Philip Gruebele (pgruebele@cox.net).
|
// This firewire capability added by Philip Gruebele (pgruebele@cox.net).
|
||||||
// For this to work you need to install the CMU firewire DCAM drivers,
|
// For this to work you need to install the CMU firewire DCAM drivers,
|
||||||
|
@ -89,7 +89,7 @@ Thanks to:
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
#if _MSC_VER >= 100
|
#if defined _MSC_VER && _MSC_VER >= 100
|
||||||
#pragma warning(disable: 4995)
|
#pragma warning(disable: 4995)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -103,17 +103,18 @@ Thanks to:
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
//Include Directshow stuff here so we don't worry about needing all the h files.
|
//Include Directshow stuff here so we don't worry about needing all the h files.
|
||||||
#if _MSC_VER >= 1500
|
#if defined _MSC_VER && _MSC_VER >= 1500
|
||||||
#include "DShow.h"
|
# include "DShow.h"
|
||||||
#include "strmif.h"
|
# include "strmif.h"
|
||||||
#include "Aviriff.h"
|
# include "Aviriff.h"
|
||||||
#include "dvdmedia.h"
|
# include "dvdmedia.h"
|
||||||
#include "bdaiface.h"
|
# include "bdaiface.h"
|
||||||
#else
|
#else
|
||||||
#ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
#define __extension__
|
# define __extension__
|
||||||
typedef BOOL WINBOOL;
|
typedef BOOL WINBOOL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dshow/dshow.h"
|
#include "dshow/dshow.h"
|
||||||
#include "dshow/dvdmedia.h"
|
#include "dshow/dvdmedia.h"
|
||||||
#include "dshow/bdatypes.h"
|
#include "dshow/bdatypes.h"
|
||||||
@ -133,6 +134,8 @@ public:
|
|||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE Clone(
|
virtual HRESULT STDMETHODCALLTYPE Clone(
|
||||||
/* [out] */ IEnumPIDMap **ppIEnumPIDMap) = 0;
|
/* [out] */ IEnumPIDMap **ppIEnumPIDMap) = 0;
|
||||||
|
|
||||||
|
virtual ~IEnumPIDMap() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IMPEG2PIDMap : public IUnknown
|
interface IMPEG2PIDMap : public IUnknown
|
||||||
@ -148,6 +151,8 @@ interface IMPEG2PIDMap : public IUnknown
|
|||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE EnumPIDMap(
|
virtual HRESULT STDMETHODCALLTYPE EnumPIDMap(
|
||||||
/* [out] */ IEnumPIDMap **pIEnumPIDMap) = 0;
|
/* [out] */ IEnumPIDMap **pIEnumPIDMap) = 0;
|
||||||
|
|
||||||
|
virtual ~IMPEG2PIDMap() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -234,6 +239,7 @@ interface ISampleGrabberCB : public IUnknown
|
|||||||
BYTE *pBuffer,
|
BYTE *pBuffer,
|
||||||
LONG BufferLen) = 0;
|
LONG BufferLen) = 0;
|
||||||
|
|
||||||
|
virtual ~ISampleGrabberCB() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
interface ISampleGrabber : public IUnknown
|
interface ISampleGrabber : public IUnknown
|
||||||
@ -261,6 +267,7 @@ interface ISampleGrabber : public IUnknown
|
|||||||
ISampleGrabberCB *pCallback,
|
ISampleGrabberCB *pCallback,
|
||||||
LONG WhichMethodToCallback) = 0;
|
LONG WhichMethodToCallback) = 0;
|
||||||
|
|
||||||
|
virtual ~ISampleGrabber() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef HEADER
|
#ifndef HEADER
|
||||||
@ -519,12 +526,12 @@ class videoInput{
|
|||||||
|
|
||||||
//Manual control over settings thanks.....
|
//Manual control over settings thanks.....
|
||||||
//These are experimental for now.
|
//These are experimental for now.
|
||||||
bool setVideoSettingFilter(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
|
bool setVideoSettingFilter(int deviceID, long Property, long lValue, long Flags = 0, bool useDefaultValue = false);
|
||||||
bool setVideoSettingFilterPct(int deviceID, long Property, float pctValue, long Flags = NULL);
|
bool setVideoSettingFilterPct(int deviceID, long Property, float pctValue, long Flags = 0);
|
||||||
bool getVideoSettingFilter(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long ¤tValue, long &flags, long &defaultValue);
|
bool getVideoSettingFilter(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long ¤tValue, long &flags, long &defaultValue);
|
||||||
|
|
||||||
bool setVideoSettingCamera(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
|
bool setVideoSettingCamera(int deviceID, long Property, long lValue, long Flags = 0, bool useDefaultValue = false);
|
||||||
bool setVideoSettingCameraPct(int deviceID, long Property, float pctValue, long Flags = NULL);
|
bool setVideoSettingCameraPct(int deviceID, long Property, float pctValue, long Flags = 0);
|
||||||
bool getVideoSettingCamera(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long ¤tValue, long &flags, long &defaultValue);
|
bool getVideoSettingCamera(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long ¤tValue, long &flags, long &defaultValue);
|
||||||
|
|
||||||
//bool setVideoSettingCam(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
|
//bool setVideoSettingCam(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
|
||||||
@ -597,7 +604,7 @@ class videoInput{
|
|||||||
|
|
||||||
/////////////////////////// HANDY FUNCTIONS /////////////////////////////
|
/////////////////////////// HANDY FUNCTIONS /////////////////////////////
|
||||||
|
|
||||||
void MyFreeMediaType(AM_MEDIA_TYPE& mt){
|
static void MyFreeMediaType(AM_MEDIA_TYPE& mt){
|
||||||
if (mt.cbFormat != 0)
|
if (mt.cbFormat != 0)
|
||||||
{
|
{
|
||||||
CoTaskMemFree((PVOID)mt.pbFormat);
|
CoTaskMemFree((PVOID)mt.pbFormat);
|
||||||
@ -612,7 +619,7 @@ void MyFreeMediaType(AM_MEDIA_TYPE& mt){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyDeleteMediaType(AM_MEDIA_TYPE *pmt)
|
static void MyDeleteMediaType(AM_MEDIA_TYPE *pmt)
|
||||||
{
|
{
|
||||||
if (pmt != NULL)
|
if (pmt != NULL)
|
||||||
{
|
{
|
||||||
@ -642,7 +649,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//------------------------------------------------
|
//------------------------------------------------
|
||||||
~SampleGrabberCallback(){
|
virtual ~SampleGrabberCallback(){
|
||||||
ptrBuffer = NULL;
|
ptrBuffer = NULL;
|
||||||
DeleteCriticalSection(&critSection);
|
DeleteCriticalSection(&critSection);
|
||||||
CloseHandle(hEvent);
|
CloseHandle(hEvent);
|
||||||
@ -849,7 +856,7 @@ void videoDevice::NukeDownstream(IBaseFilter *pBF){
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
void videoDevice::destroyGraph(){
|
void videoDevice::destroyGraph(){
|
||||||
HRESULT hr = NULL;
|
HRESULT hr = 0;
|
||||||
//int FuncRetval=0;
|
//int FuncRetval=0;
|
||||||
//int NumFilters=0;
|
//int NumFilters=0;
|
||||||
|
|
||||||
@ -867,7 +874,7 @@ void videoDevice::destroyGraph(){
|
|||||||
IBaseFilter * pFilter = NULL;
|
IBaseFilter * pFilter = NULL;
|
||||||
if (pEnum->Next(1, &pFilter, &cFetched) == S_OK)
|
if (pEnum->Next(1, &pFilter, &cFetched) == S_OK)
|
||||||
{
|
{
|
||||||
FILTER_INFO FilterInfo={0};
|
FILTER_INFO FilterInfo;
|
||||||
memset(&FilterInfo, 0, sizeof(FilterInfo));
|
memset(&FilterInfo, 0, sizeof(FilterInfo));
|
||||||
hr = pFilter->QueryFilterInfo(&FilterInfo);
|
hr = pFilter->QueryFilterInfo(&FilterInfo);
|
||||||
FilterInfo.pGraph->Release();
|
FilterInfo.pGraph->Release();
|
||||||
@ -1620,14 +1627,15 @@ void __cdecl videoInput::basicThread(void * objPtr){
|
|||||||
void videoInput::showSettingsWindow(int id){
|
void videoInput::showSettingsWindow(int id){
|
||||||
|
|
||||||
if(isDeviceSetup(id)){
|
if(isDeviceSetup(id)){
|
||||||
HANDLE myTempThread;
|
//HANDLE myTempThread;
|
||||||
|
|
||||||
//we reconnect to the device as we have freed our reference to it
|
//we reconnect to the device as we have freed our reference to it
|
||||||
//why have we freed our reference? because there seemed to be an issue
|
//why have we freed our reference? because there seemed to be an issue
|
||||||
//with some mpeg devices if we didn't
|
//with some mpeg devices if we didn't
|
||||||
HRESULT hr = getDevice(&VDList[id]->pVideoInputFilter, id, VDList[id]->wDeviceName, VDList[id]->nDeviceName);
|
HRESULT hr = getDevice(&VDList[id]->pVideoInputFilter, id, VDList[id]->wDeviceName, VDList[id]->nDeviceName);
|
||||||
if(hr == S_OK){
|
if(hr == S_OK){
|
||||||
myTempThread = (HANDLE)_beginthread(basicThread, 0, (void *)&VDList[id]);
|
//myTempThread = (HANDLE)
|
||||||
|
_beginthread(basicThread, 0, (void *)&VDList[id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1705,7 +1713,7 @@ bool videoInput::setVideoSettingFilterPct(int deviceID, long Property, float pct
|
|||||||
float halfStep = (float)stepAmnt * 0.5f;
|
float halfStep = (float)stepAmnt * 0.5f;
|
||||||
if( mod < halfStep ) rasterValue -= mod;
|
if( mod < halfStep ) rasterValue -= mod;
|
||||||
else rasterValue += stepAmnt - mod;
|
else rasterValue += stepAmnt - mod;
|
||||||
printf("RASTER - pctValue is %f - value is %i - step is %i - mod is %i - rasterValue is %i\n", pctValue, value, stepAmnt, mod, rasterValue);
|
printf("RASTER - pctValue is %f - value is %li - step is %li - mod is %li - rasterValue is %li\n", pctValue, value, stepAmnt, mod, rasterValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return setVideoSettingFilter(deviceID, Property, rasterValue, Flags, false);
|
return setVideoSettingFilter(deviceID, Property, rasterValue, Flags, false);
|
||||||
@ -1795,7 +1803,7 @@ bool videoInput::setVideoSettingCameraPct(int deviceID, long Property, float pct
|
|||||||
float halfStep = (float)stepAmnt * 0.5f;
|
float halfStep = (float)stepAmnt * 0.5f;
|
||||||
if( mod < halfStep ) rasterValue -= mod;
|
if( mod < halfStep ) rasterValue -= mod;
|
||||||
else rasterValue += stepAmnt - mod;
|
else rasterValue += stepAmnt - mod;
|
||||||
printf("RASTER - pctValue is %f - value is %i - step is %i - mod is %i - rasterValue is %i\n", pctValue, value, stepAmnt, mod, rasterValue);
|
printf("RASTER - pctValue is %f - value is %li - step is %li - mod is %li - rasterValue is %li\n", pctValue, value, stepAmnt, mod, rasterValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return setVideoSettingCamera(deviceID, Property, rasterValue, Flags, false);
|
return setVideoSettingCamera(deviceID, Property, rasterValue, Flags, false);
|
||||||
@ -1920,7 +1928,7 @@ bool videoInput::restartDevice(int id){
|
|||||||
stopDevice(id);
|
stopDevice(id);
|
||||||
|
|
||||||
//set our fps if needed
|
//set our fps if needed
|
||||||
if( avgFrameTime != -1){
|
if( avgFrameTime != (unsigned long)-1){
|
||||||
VDList[id]->requestedFrameTime = avgFrameTime;
|
VDList[id]->requestedFrameTime = avgFrameTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2300,7 +2308,7 @@ static void findClosestSizeAndSubtype(videoDevice * VD, int widthIn, int heightI
|
|||||||
//find perfect match or closest size
|
//find perfect match or closest size
|
||||||
int nearW = 9999999;
|
int nearW = 9999999;
|
||||||
int nearH = 9999999;
|
int nearH = 9999999;
|
||||||
bool foundClosestMatch = true;
|
//bool foundClosestMatch = true;
|
||||||
|
|
||||||
int iCount = 0;
|
int iCount = 0;
|
||||||
int iSize = 0;
|
int iSize = 0;
|
||||||
@ -2360,7 +2368,7 @@ static void findClosestSizeAndSubtype(videoDevice * VD, int widthIn, int heightI
|
|||||||
|
|
||||||
//see if we have an exact match!
|
//see if we have an exact match!
|
||||||
if(exactMatchX && exactMatchY){
|
if(exactMatchX && exactMatchY){
|
||||||
foundClosestMatch = false;
|
//foundClosestMatch = false;
|
||||||
exactMatch = true;
|
exactMatch = true;
|
||||||
|
|
||||||
widthOut = widthIn;
|
widthOut = widthIn;
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#include <vfw.h>
|
#include <vfw.h>
|
||||||
|
|
||||||
#if _MSC_VER >= 1200
|
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||||
#pragma warning( disable: 4711 )
|
#pragma warning( disable: 4711 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#if defined WIN32 || defined _WIN32
|
#if defined WIN32 || defined _WIN32
|
||||||
|
|
||||||
#if _MSC_VER >= 1200
|
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||||
#pragma warning( disable: 4710 )
|
#pragma warning( disable: 4710 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -61,6 +61,10 @@
|
|||||||
#ifndef __inout
|
#ifndef __inout
|
||||||
# define __inout
|
# define __inout
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||||
|
#endif
|
||||||
#include <MultiMon.h>
|
#include <MultiMon.h>
|
||||||
|
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
@ -166,7 +170,7 @@ typedef struct CvWindow
|
|||||||
HGDIOBJ image;
|
HGDIOBJ image;
|
||||||
int last_key;
|
int last_key;
|
||||||
int flags;
|
int flags;
|
||||||
int status;//0 normal, 1 fullscreen (YV)
|
int status;//0 normal, 1 fullscreen (YV)
|
||||||
|
|
||||||
CvMouseCallback on_mouse;
|
CvMouseCallback on_mouse;
|
||||||
void* on_mouse_param;
|
void* on_mouse_param;
|
||||||
@ -360,7 +364,7 @@ icvSaveWindowPos( const char* name, CvRect rect )
|
|||||||
char rootKey[1024];
|
char rootKey[1024];
|
||||||
strcpy( szKey, icvWindowPosRootKey );
|
strcpy( szKey, icvWindowPosRootKey );
|
||||||
strcat( szKey, name );
|
strcat( szKey, name );
|
||||||
|
|
||||||
if( RegOpenKeyEx( HKEY_CURRENT_USER,szKey,0,KEY_READ,&hkey) != ERROR_SUCCESS )
|
if( RegOpenKeyEx( HKEY_CURRENT_USER,szKey,0,KEY_READ,&hkey) != ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
HKEY hroot;
|
HKEY hroot;
|
||||||
@ -405,7 +409,7 @@ icvSaveWindowPos( const char* name, CvRect rect )
|
|||||||
if( RegOpenKeyEx( HKEY_CURRENT_USER,szKey,0,KEY_WRITE,&hkey) != ERROR_SUCCESS )
|
if( RegOpenKeyEx( HKEY_CURRENT_USER,szKey,0,KEY_WRITE,&hkey) != ERROR_SUCCESS )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegSetValueEx(hkey, "Left", 0, REG_DWORD, (BYTE*)&rect.x, sizeof(rect.x));
|
RegSetValueEx(hkey, "Left", 0, REG_DWORD, (BYTE*)&rect.x, sizeof(rect.x));
|
||||||
RegSetValueEx(hkey, "Top", 0, REG_DWORD, (BYTE*)&rect.y, sizeof(rect.y));
|
RegSetValueEx(hkey, "Top", 0, REG_DWORD, (BYTE*)&rect.y, sizeof(rect.y));
|
||||||
RegSetValueEx(hkey, "Width", 0, REG_DWORD, (BYTE*)&rect.width, sizeof(rect.width));
|
RegSetValueEx(hkey, "Width", 0, REG_DWORD, (BYTE*)&rect.width, sizeof(rect.width));
|
||||||
@ -415,9 +419,9 @@ icvSaveWindowPos( const char* name, CvRect rect )
|
|||||||
|
|
||||||
double cvGetModeWindow_W32(const char* name)//YV
|
double cvGetModeWindow_W32(const char* name)//YV
|
||||||
{
|
{
|
||||||
double result = -1;
|
double result = -1;
|
||||||
|
|
||||||
CV_FUNCNAME( "cvGetModeWindow_W32" );
|
CV_FUNCNAME( "cvGetModeWindow_W32" );
|
||||||
|
|
||||||
__BEGIN__;
|
__BEGIN__;
|
||||||
|
|
||||||
@ -429,75 +433,75 @@ double cvGetModeWindow_W32(const char* name)//YV
|
|||||||
window = icvFindWindowByName( name );
|
window = icvFindWindowByName( name );
|
||||||
if (!window)
|
if (!window)
|
||||||
EXIT; // keep silence here
|
EXIT; // keep silence here
|
||||||
|
|
||||||
result = window->status;
|
result = window->status;
|
||||||
|
|
||||||
__END__;
|
__END__;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cvSetModeWindow_W32( const char* name, double prop_value)//Yannick Verdie
|
void cvSetModeWindow_W32( const char* name, double prop_value)//Yannick Verdie
|
||||||
{
|
{
|
||||||
CV_FUNCNAME( "cvSetModeWindow_W32" );
|
CV_FUNCNAME( "cvSetModeWindow_W32" );
|
||||||
|
|
||||||
__BEGIN__;
|
__BEGIN__;
|
||||||
|
|
||||||
CvWindow* window;
|
CvWindow* window;
|
||||||
|
|
||||||
if(!name)
|
if(!name)
|
||||||
CV_ERROR( CV_StsNullPtr, "NULL name string" );
|
CV_ERROR( CV_StsNullPtr, "NULL name string" );
|
||||||
|
|
||||||
window = icvFindWindowByName( name );
|
window = icvFindWindowByName( name );
|
||||||
if( !window )
|
if( !window )
|
||||||
CV_ERROR( CV_StsNullPtr, "NULL window" );
|
CV_ERROR( CV_StsNullPtr, "NULL window" );
|
||||||
|
|
||||||
if(window->flags & CV_WINDOW_AUTOSIZE)//if the flag CV_WINDOW_AUTOSIZE is set
|
if(window->flags & CV_WINDOW_AUTOSIZE)//if the flag CV_WINDOW_AUTOSIZE is set
|
||||||
EXIT;
|
EXIT;
|
||||||
|
|
||||||
{
|
{
|
||||||
DWORD dwStyle = (DWORD)GetWindowLongPtr(window->frame, GWL_STYLE);
|
DWORD dwStyle = (DWORD)GetWindowLongPtr(window->frame, GWL_STYLE);
|
||||||
CvRect position;
|
CvRect position;
|
||||||
|
|
||||||
if (window->status==CV_WINDOW_FULLSCREEN && prop_value==CV_WINDOW_NORMAL)
|
if (window->status==CV_WINDOW_FULLSCREEN && prop_value==CV_WINDOW_NORMAL)
|
||||||
{
|
{
|
||||||
icvLoadWindowPos(window->name,position );
|
icvLoadWindowPos(window->name,position );
|
||||||
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle | WS_CAPTION | WS_THICKFRAME);
|
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle | WS_CAPTION | WS_THICKFRAME);
|
||||||
|
|
||||||
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
|
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||||
window->status=CV_WINDOW_NORMAL;
|
window->status=CV_WINDOW_NORMAL;
|
||||||
|
|
||||||
EXIT;
|
EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->status==CV_WINDOW_NORMAL && prop_value==CV_WINDOW_FULLSCREEN)
|
if (window->status==CV_WINDOW_NORMAL && prop_value==CV_WINDOW_FULLSCREEN)
|
||||||
{
|
{
|
||||||
//save dimension
|
//save dimension
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetWindowRect(window->frame, &rect);
|
GetWindowRect(window->frame, &rect);
|
||||||
CvRect RectCV = cvRect(rect.left, rect.top,rect.right - rect.left, rect.bottom - rect.top);
|
CvRect RectCV = cvRect(rect.left, rect.top,rect.right - rect.left, rect.bottom - rect.top);
|
||||||
icvSaveWindowPos(window->name,RectCV );
|
icvSaveWindowPos(window->name,RectCV );
|
||||||
|
|
||||||
//Look at coordinate for fullscreen
|
//Look at coordinate for fullscreen
|
||||||
HMONITOR hMonitor;
|
HMONITOR hMonitor;
|
||||||
MONITORINFO mi;
|
MONITORINFO mi;
|
||||||
hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
|
hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
|
||||||
|
|
||||||
mi.cbSize = sizeof(mi);
|
mi.cbSize = sizeof(mi);
|
||||||
GetMonitorInfo(hMonitor, &mi);
|
GetMonitorInfo(hMonitor, &mi);
|
||||||
|
|
||||||
//fullscreen
|
//fullscreen
|
||||||
position.x=mi.rcMonitor.left;position.y=mi.rcMonitor.top;
|
position.x=mi.rcMonitor.left;position.y=mi.rcMonitor.top;
|
||||||
position.width=mi.rcMonitor.right - mi.rcMonitor.left;position.height=mi.rcMonitor.bottom - mi.rcMonitor.top;
|
position.width=mi.rcMonitor.right - mi.rcMonitor.left;position.height=mi.rcMonitor.bottom - mi.rcMonitor.top;
|
||||||
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle & ~WS_CAPTION & ~WS_THICKFRAME);
|
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle & ~WS_CAPTION & ~WS_THICKFRAME);
|
||||||
|
|
||||||
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
|
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||||
window->status=CV_WINDOW_FULLSCREEN;
|
window->status=CV_WINDOW_FULLSCREEN;
|
||||||
|
|
||||||
EXIT;
|
EXIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__END__;
|
__END__;
|
||||||
}
|
}
|
||||||
|
|
||||||
double cvGetPropWindowAutoSize_W32(const char* name)
|
double cvGetPropWindowAutoSize_W32(const char* name)
|
||||||
@ -526,9 +530,9 @@ double cvGetPropWindowAutoSize_W32(const char* name)
|
|||||||
|
|
||||||
double cvGetRatioWindow_W32(const char* name)
|
double cvGetRatioWindow_W32(const char* name)
|
||||||
{
|
{
|
||||||
double result = -1;
|
double result = -1;
|
||||||
|
|
||||||
CV_FUNCNAME( "cvGetRatioWindow_W32" );
|
CV_FUNCNAME( "cvGetRatioWindow_W32" );
|
||||||
|
|
||||||
__BEGIN__;
|
__BEGIN__;
|
||||||
|
|
||||||
@ -540,20 +544,20 @@ double cvGetRatioWindow_W32(const char* name)
|
|||||||
window = icvFindWindowByName( name );
|
window = icvFindWindowByName( name );
|
||||||
if (!window)
|
if (!window)
|
||||||
EXIT; // keep silence here
|
EXIT; // keep silence here
|
||||||
|
|
||||||
result = static_cast<double>(window->width) / window->height;
|
result = static_cast<double>(window->width) / window->height;
|
||||||
|
|
||||||
__END__;
|
__END__;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
double cvGetOpenGlProp_W32(const char* name)
|
double cvGetOpenGlProp_W32(const char* name)
|
||||||
{
|
{
|
||||||
double result = -1;
|
double result = -1;
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
CV_FUNCNAME( "cvGetOpenGlProp_W32" );
|
CV_FUNCNAME( "cvGetOpenGlProp_W32" );
|
||||||
|
|
||||||
__BEGIN__;
|
__BEGIN__;
|
||||||
|
|
||||||
@ -565,14 +569,14 @@ double cvGetOpenGlProp_W32(const char* name)
|
|||||||
window = icvFindWindowByName( name );
|
window = icvFindWindowByName( name );
|
||||||
if (!window)
|
if (!window)
|
||||||
EXIT; // keep silence here
|
EXIT; // keep silence here
|
||||||
|
|
||||||
result = window->useGl;
|
result = window->useGl;
|
||||||
|
|
||||||
__END__;
|
__END__;
|
||||||
#endif
|
#endif
|
||||||
(void)name;
|
(void)name;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -626,7 +630,7 @@ namespace
|
|||||||
void generateBitmapFont(const std::string& family, int height, int weight, bool italic, bool underline, int start, int count, int base) const;
|
void generateBitmapFont(const std::string& family, int height, int weight, bool italic, bool underline, int start, int count, int base) const;
|
||||||
|
|
||||||
bool isGlContextInitialized() const;
|
bool isGlContextInitialized() const;
|
||||||
|
|
||||||
PFNGLGENBUFFERSPROC glGenBuffersExt;
|
PFNGLGENBUFFERSPROC glGenBuffersExt;
|
||||||
PFNGLDELETEBUFFERSPROC glDeleteBuffersExt;
|
PFNGLDELETEBUFFERSPROC glDeleteBuffersExt;
|
||||||
|
|
||||||
@ -787,8 +791,8 @@ namespace
|
|||||||
weight, // font weight
|
weight, // font weight
|
||||||
italic ? TRUE : FALSE, // Italic
|
italic ? TRUE : FALSE, // Italic
|
||||||
underline ? TRUE : FALSE, // Underline
|
underline ? TRUE : FALSE, // Underline
|
||||||
FALSE, // StrikeOut
|
FALSE, // StrikeOut
|
||||||
ANSI_CHARSET, // CharSet
|
ANSI_CHARSET, // CharSet
|
||||||
OUT_TT_PRECIS, // OutPrecision
|
OUT_TT_PRECIS, // OutPrecision
|
||||||
CLIP_DEFAULT_PRECIS, // ClipPrecision
|
CLIP_DEFAULT_PRECIS, // ClipPrecision
|
||||||
ANTIALIASED_QUALITY, // Quality
|
ANTIALIASED_QUALITY, // Quality
|
||||||
@ -870,12 +874,12 @@ namespace
|
|||||||
0, // Shift Bit Ignored
|
0, // Shift Bit Ignored
|
||||||
0, // No Accumulation Buffer
|
0, // No Accumulation Buffer
|
||||||
0, 0, 0, 0, // Accumulation Bits Ignored
|
0, 0, 0, 0, // Accumulation Bits Ignored
|
||||||
32, // 32 Bit Z-Buffer (Depth Buffer)
|
32, // 32 Bit Z-Buffer (Depth Buffer)
|
||||||
0, // No Stencil Buffer
|
0, // No Stencil Buffer
|
||||||
0, // No Auxiliary Buffer
|
0, // No Auxiliary Buffer
|
||||||
PFD_MAIN_PLANE, // Main Drawing Layer
|
PFD_MAIN_PLANE, // Main Drawing Layer
|
||||||
0, // Reserved
|
0, // Reserved
|
||||||
0, 0, 0 // Layer Masks Ignored
|
0, 0, 0 // Layer Masks Ignored
|
||||||
};
|
};
|
||||||
|
|
||||||
hGLDC = GetDC(hWnd);
|
hGLDC = GetDC(hWnd);
|
||||||
@ -915,7 +919,7 @@ namespace
|
|||||||
window->hGLRC = NULL;
|
window->hGLRC = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->dc)
|
if (window->dc)
|
||||||
{
|
{
|
||||||
ReleaseDC(window->hwnd, window->dc);
|
ReleaseDC(window->hwnd, window->dc);
|
||||||
window->dc = NULL;
|
window->dc = NULL;
|
||||||
@ -935,7 +939,7 @@ namespace
|
|||||||
if (!wglMakeCurrent(window->dc, window->hGLRC))
|
if (!wglMakeCurrent(window->dc, window->hGLRC))
|
||||||
CV_ERROR( CV_OpenGlApiCallError, "Can't Activate The GL Rendering Context" );
|
CV_ERROR( CV_OpenGlApiCallError, "Can't Activate The GL Rendering Context" );
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
if (window->glDrawCallback)
|
if (window->glDrawCallback)
|
||||||
window->glDrawCallback(window->glDrawData);
|
window->glDrawCallback(window->glDrawData);
|
||||||
@ -1009,7 +1013,7 @@ CV_IMPL int cvNamedWindow( const char* name, int flags )
|
|||||||
|
|
||||||
ShowWindow(mainhWnd, SW_SHOW);
|
ShowWindow(mainhWnd, SW_SHOW);
|
||||||
|
|
||||||
//YV- remove one border by changing the style
|
//YV- remove one border by changing the style
|
||||||
hWnd = CreateWindow("HighGUI class", "", (defStyle & ~WS_SIZEBOX) | WS_CHILD, CW_USEDEFAULT, 0, rect.width, rect.height, mainhWnd, 0, hg_hinstance, 0);
|
hWnd = CreateWindow("HighGUI class", "", (defStyle & ~WS_SIZEBOX) | WS_CHILD, CW_USEDEFAULT, 0, rect.width, rect.height, mainhWnd, 0, hg_hinstance, 0);
|
||||||
if( !hWnd )
|
if( !hWnd )
|
||||||
CV_ERROR( CV_StsError, "Frame window can not be created" );
|
CV_ERROR( CV_StsError, "Frame window can not be created" );
|
||||||
@ -1400,16 +1404,16 @@ cvShowImage( const char* name, const CvArr* arr )
|
|||||||
CV_ERROR( CV_StsNullPtr, "NULL name" );
|
CV_ERROR( CV_StsNullPtr, "NULL name" );
|
||||||
|
|
||||||
window = icvFindWindowByName(name);
|
window = icvFindWindowByName(name);
|
||||||
if(!window)
|
if(!window)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
cvNamedWindow(name, CV_WINDOW_AUTOSIZE);
|
cvNamedWindow(name, CV_WINDOW_AUTOSIZE);
|
||||||
#else
|
#else
|
||||||
cvNamedWindow(name, CV_WINDOW_AUTOSIZE | CV_WINDOW_OPENGL);
|
cvNamedWindow(name, CV_WINDOW_AUTOSIZE | CV_WINDOW_OPENGL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
window = icvFindWindowByName(name);
|
window = icvFindWindowByName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !window || !arr )
|
if( !window || !arr )
|
||||||
EXIT; // keep silence here.
|
EXIT; // keep silence here.
|
||||||
@ -1467,6 +1471,7 @@ cvShowImage( const char* name, const CvArr* arr )
|
|||||||
__END__;
|
__END__;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
CV_IMPL void
|
CV_IMPL void
|
||||||
cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
|
cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
|
||||||
{
|
{
|
||||||
@ -1494,7 +1499,7 @@ cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
|
|||||||
if( CV_IS_IMAGE_HDR( arr ) )
|
if( CV_IS_IMAGE_HDR( arr ) )
|
||||||
origin = ((IplImage*)arr)->origin;
|
origin = ((IplImage*)arr)->origin;
|
||||||
|
|
||||||
CV_CALL( image = cvGetMat( arr, &stub ) );
|
CV_CALL( image = cvGetMat( arr, &stub ) );
|
||||||
|
|
||||||
if ( hdc )
|
if ( hdc )
|
||||||
{
|
{
|
||||||
@ -1512,7 +1517,7 @@ cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
|
|||||||
dst_ptr = bmp.bmBits;
|
dst_ptr = bmp.bmBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( size.cx != image->width || size.cy != image->height || channels != channels0 )
|
if( size.cx != image->width || size.cy != image->height || channels != channels0 )
|
||||||
{
|
{
|
||||||
changed_size = true;
|
changed_size = true;
|
||||||
|
|
||||||
@ -1544,6 +1549,7 @@ cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
|
|||||||
|
|
||||||
__END__;
|
__END__;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CV_IMPL void cvResizeWindow(const char* name, int width, int height )
|
CV_IMPL void cvResizeWindow(const char* name, int width, int height )
|
||||||
{
|
{
|
||||||
@ -1666,7 +1672,7 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|||||||
{
|
{
|
||||||
// Snap window to screen edges with multi-monitor support. // Adi Shavit
|
// Snap window to screen edges with multi-monitor support. // Adi Shavit
|
||||||
LPWINDOWPOS pos = (LPWINDOWPOS)lParam;
|
LPWINDOWPOS pos = (LPWINDOWPOS)lParam;
|
||||||
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetWindowRect(window->frame, &rect);
|
GetWindowRect(window->frame, &rect);
|
||||||
|
|
||||||
@ -1679,15 +1685,15 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|||||||
|
|
||||||
const int SNAP_DISTANCE = 15;
|
const int SNAP_DISTANCE = 15;
|
||||||
|
|
||||||
if (abs(pos->x - mi.rcMonitor.left) <= SNAP_DISTANCE)
|
if (abs(pos->x - mi.rcMonitor.left) <= SNAP_DISTANCE)
|
||||||
pos->x = mi.rcMonitor.left; // snap to left edge
|
pos->x = mi.rcMonitor.left; // snap to left edge
|
||||||
else
|
else
|
||||||
if (abs(pos->x + pos->cx - mi.rcMonitor.right) <= SNAP_DISTANCE)
|
if (abs(pos->x + pos->cx - mi.rcMonitor.right) <= SNAP_DISTANCE)
|
||||||
pos->x = mi.rcMonitor.right - pos->cx; // snap to right edge
|
pos->x = mi.rcMonitor.right - pos->cx; // snap to right edge
|
||||||
|
|
||||||
if (abs(pos->y - mi.rcMonitor.top) <= SNAP_DISTANCE)
|
if (abs(pos->y - mi.rcMonitor.top) <= SNAP_DISTANCE)
|
||||||
pos->y = mi.rcMonitor.top; // snap to top edge
|
pos->y = mi.rcMonitor.top; // snap to top edge
|
||||||
else
|
else
|
||||||
if (abs(pos->y + pos->cy - mi.rcMonitor.bottom) <= SNAP_DISTANCE)
|
if (abs(pos->y + pos->cy - mi.rcMonitor.bottom) <= SNAP_DISTANCE)
|
||||||
pos->y = mi.rcMonitor.bottom - pos->cy; // snap to bottom edge
|
pos->y = mi.rcMonitor.bottom - pos->cy; // snap to bottom edge
|
||||||
}
|
}
|
||||||
@ -1848,9 +1854,9 @@ static LRESULT CALLBACK HighGUIProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
|
|||||||
EndPaint(hwnd, &paint);
|
EndPaint(hwnd, &paint);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
else if(window->useGl)
|
else if(window->useGl)
|
||||||
{
|
{
|
||||||
drawGl(window);
|
drawGl(window);
|
||||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,18 +64,18 @@ icvMinAreaState;
|
|||||||
// Parameters:
|
// Parameters:
|
||||||
// points - convex hull vertices ( any orientation )
|
// points - convex hull vertices ( any orientation )
|
||||||
// n - number of vertices
|
// n - number of vertices
|
||||||
// mode - concrete application of algorithm
|
// mode - concrete application of algorithm
|
||||||
// can be CV_CALIPERS_MAXDIST or
|
// can be CV_CALIPERS_MAXDIST or
|
||||||
// CV_CALIPERS_MINAREARECT
|
// CV_CALIPERS_MINAREARECT
|
||||||
// left, bottom, right, top - indexes of extremal points
|
// left, bottom, right, top - indexes of extremal points
|
||||||
// out - output info.
|
// out - output info.
|
||||||
// In case CV_CALIPERS_MAXDIST it points to float value -
|
// In case CV_CALIPERS_MAXDIST it points to float value -
|
||||||
// maximal height of polygon.
|
// maximal height of polygon.
|
||||||
// In case CV_CALIPERS_MINAREARECT
|
// In case CV_CALIPERS_MINAREARECT
|
||||||
// ((CvPoint2D32f*)out)[0] - corner
|
// ((CvPoint2D32f*)out)[0] - corner
|
||||||
// ((CvPoint2D32f*)out)[1] - vector1
|
// ((CvPoint2D32f*)out)[1] - vector1
|
||||||
// ((CvPoint2D32f*)out)[0] - corner2
|
// ((CvPoint2D32f*)out)[0] - corner2
|
||||||
//
|
//
|
||||||
// ^
|
// ^
|
||||||
// |
|
// |
|
||||||
// vector2 |
|
// vector2 |
|
||||||
@ -94,15 +94,15 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
|
|||||||
{
|
{
|
||||||
float minarea = FLT_MAX;
|
float minarea = FLT_MAX;
|
||||||
float max_dist = 0;
|
float max_dist = 0;
|
||||||
char buffer[32];
|
char buffer[32] = {};
|
||||||
int i, k;
|
int i, k;
|
||||||
CvPoint2D32f* vect = (CvPoint2D32f*)cvAlloc( n * sizeof(vect[0]) );
|
CvPoint2D32f* vect = (CvPoint2D32f*)cvAlloc( n * sizeof(vect[0]) );
|
||||||
float* inv_vect_length = (float*)cvAlloc( n * sizeof(inv_vect_length[0]) );
|
float* inv_vect_length = (float*)cvAlloc( n * sizeof(inv_vect_length[0]) );
|
||||||
int left = 0, bottom = 0, right = 0, top = 0;
|
int left = 0, bottom = 0, right = 0, top = 0;
|
||||||
int seq[4] = { -1, -1, -1, -1 };
|
int seq[4] = { -1, -1, -1, -1 };
|
||||||
|
|
||||||
/* rotating calipers sides will always have coordinates
|
/* rotating calipers sides will always have coordinates
|
||||||
(a,b) (-b,a) (-a,-b) (b, -a)
|
(a,b) (-b,a) (-a,-b) (b, -a)
|
||||||
*/
|
*/
|
||||||
/* this is a first base bector (a,b) initialized by (1,0) */
|
/* this is a first base bector (a,b) initialized by (1,0) */
|
||||||
float orientation = 0;
|
float orientation = 0;
|
||||||
@ -111,14 +111,14 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
|
|||||||
|
|
||||||
float left_x, right_x, top_y, bottom_y;
|
float left_x, right_x, top_y, bottom_y;
|
||||||
CvPoint2D32f pt0 = points[0];
|
CvPoint2D32f pt0 = points[0];
|
||||||
|
|
||||||
left_x = right_x = pt0.x;
|
left_x = right_x = pt0.x;
|
||||||
top_y = bottom_y = pt0.y;
|
top_y = bottom_y = pt0.y;
|
||||||
|
|
||||||
for( i = 0; i < n; i++ )
|
for( i = 0; i < n; i++ )
|
||||||
{
|
{
|
||||||
double dx, dy;
|
double dx, dy;
|
||||||
|
|
||||||
if( pt0.x < left_x )
|
if( pt0.x < left_x )
|
||||||
left_x = pt0.x, left = i;
|
left_x = pt0.x, left = i;
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
|
|||||||
bottom_y = pt0.y, bottom = i;
|
bottom_y = pt0.y, bottom = i;
|
||||||
|
|
||||||
CvPoint2D32f pt = points[(i+1) & (i+1 < n ? -1 : 0)];
|
CvPoint2D32f pt = points[(i+1) & (i+1 < n ? -1 : 0)];
|
||||||
|
|
||||||
dx = pt.x - pt0.x;
|
dx = pt.x - pt0.x;
|
||||||
dy = pt.y - pt0.y;
|
dy = pt.y - pt0.y;
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
|
|||||||
{
|
{
|
||||||
double ax = vect[n-1].x;
|
double ax = vect[n-1].x;
|
||||||
double ay = vect[n-1].y;
|
double ay = vect[n-1].y;
|
||||||
|
|
||||||
for( i = 0; i < n; i++ )
|
for( i = 0; i < n; i++ )
|
||||||
{
|
{
|
||||||
double bx = vect[i].x;
|
double bx = vect[i].x;
|
||||||
@ -218,7 +218,7 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
|
|||||||
base_b = lead_y;
|
base_b = lead_y;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
base_a = lead_y;
|
base_a = lead_y;
|
||||||
base_b = -lead_x;
|
base_b = -lead_x;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -231,12 +231,12 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
|
|||||||
break;
|
break;
|
||||||
default: assert(0);
|
default: assert(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* change base point of main edge */
|
/* change base point of main edge */
|
||||||
seq[main_element] += 1;
|
seq[main_element] += 1;
|
||||||
seq[main_element] = (seq[main_element] == n) ? 0 : seq[main_element];
|
seq[main_element] = (seq[main_element] == n) ? 0 : seq[main_element];
|
||||||
|
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case CV_CALIPERS_MAXHEIGHT:
|
case CV_CALIPERS_MAXHEIGHT:
|
||||||
@ -351,7 +351,7 @@ cvMinAreaRect2( const CvArr* array, CvMemStorage* storage )
|
|||||||
CvBox2D box;
|
CvBox2D box;
|
||||||
cv::AutoBuffer<CvPoint2D32f> _points;
|
cv::AutoBuffer<CvPoint2D32f> _points;
|
||||||
CvPoint2D32f* points;
|
CvPoint2D32f* points;
|
||||||
|
|
||||||
memset(&box, 0, sizeof(box));
|
memset(&box, 0, sizeof(box));
|
||||||
|
|
||||||
int i, n;
|
int i, n;
|
||||||
@ -409,7 +409,7 @@ cvMinAreaRect2( const CvArr* array, CvMemStorage* storage )
|
|||||||
CV_READ_SEQ_ELEM( points[i], reader );
|
CV_READ_SEQ_ELEM( points[i], reader );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( n > 2 )
|
if( n > 2 )
|
||||||
{
|
{
|
||||||
icvRotatingCalipers( points, n, CV_CALIPERS_MINAREARECT, (float*)out );
|
icvRotatingCalipers( points, n, CV_CALIPERS_MINAREARECT, (float*)out );
|
||||||
|
@ -41,14 +41,15 @@
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
#ifdef WIN32 /* make sure it builds under Linux whenever it is included into Makefile.am or not. */
|
#if 0
|
||||||
|
//#ifdef WIN32 /* make sure it builds under Linux whenever it is included into Makefile.am or not. */
|
||||||
|
|
||||||
//void icvCutContour( CvSeq* current, IplImage* image );
|
//void icvCutContour( CvSeq* current, IplImage* image );
|
||||||
CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* image );
|
CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* image );
|
||||||
|
|
||||||
|
|
||||||
//create lists of segments of all contours from image
|
//create lists of segments of all contours from image
|
||||||
CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be destroyed by cvFindContours
|
CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be destroyed by cvFindContours
|
||||||
CvMemStorage* storage )
|
CvMemStorage* storage )
|
||||||
{
|
{
|
||||||
CvMemStorage* tmp_storage = cvCreateChildMemStorage( storage );
|
CvMemStorage* tmp_storage = cvCreateChildMemStorage( storage );
|
||||||
@ -57,29 +58,29 @@ CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be
|
|||||||
cvZero( image );
|
cvZero( image );
|
||||||
|
|
||||||
//iterate through contours
|
//iterate through contours
|
||||||
//iterate through tree
|
//iterate through tree
|
||||||
CvSeq* current = contours;
|
CvSeq* current = contours;
|
||||||
int number = 0;
|
int number = 0;
|
||||||
int level = 1;
|
int level = 1;
|
||||||
|
|
||||||
CvSeq* output = 0;
|
CvSeq* output = 0;
|
||||||
CvSeq* tail_seq = 0;
|
CvSeq* tail_seq = 0;
|
||||||
|
|
||||||
//actually this loop can iterates through tree,
|
//actually this loop can iterates through tree,
|
||||||
//but still we use CV_RETR_LIST it is not useful
|
//but still we use CV_RETR_LIST it is not useful
|
||||||
while( current )
|
while( current )
|
||||||
{
|
{
|
||||||
number++;
|
number++;
|
||||||
|
|
||||||
//get vertical list of segments for one contour
|
//get vertical list of segments for one contour
|
||||||
CvSeq* new_seq = icvCutContourRaster( current, storage, image );
|
CvSeq* new_seq = icvCutContourRaster( current, storage, image );
|
||||||
|
|
||||||
//add this vertical list to horisontal list
|
//add this vertical list to horisontal list
|
||||||
if( new_seq )
|
if( new_seq )
|
||||||
{
|
{
|
||||||
if( tail_seq )
|
if( tail_seq )
|
||||||
{
|
{
|
||||||
tail_seq->h_next = new_seq;
|
tail_seq->h_next = new_seq;
|
||||||
new_seq->h_prev = tail_seq;
|
new_seq->h_prev = tail_seq;
|
||||||
tail_seq = new_seq;
|
tail_seq = new_seq;
|
||||||
}
|
}
|
||||||
@ -90,13 +91,13 @@ CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be
|
|||||||
}
|
}
|
||||||
|
|
||||||
//iteration through tree
|
//iteration through tree
|
||||||
if( current->v_next )
|
if( current->v_next )
|
||||||
{
|
{
|
||||||
//goto child
|
//goto child
|
||||||
current = current->v_next;
|
current = current->v_next;
|
||||||
level++;
|
level++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//go parent
|
//go parent
|
||||||
while( !current->h_next )
|
while( !current->h_next )
|
||||||
@ -105,7 +106,7 @@ CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be
|
|||||||
level--;
|
level--;
|
||||||
if( !level ) break;
|
if( !level ) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( current ) //go brother
|
if( current ) //go brother
|
||||||
current = current->h_next;
|
current = current->h_next;
|
||||||
}
|
}
|
||||||
@ -114,25 +115,25 @@ CvSeq* cvExtractSingleEdges( IplImage* image, //bw image - it's content will be
|
|||||||
//free temporary memstorage with initial contours
|
//free temporary memstorage with initial contours
|
||||||
cvReleaseMemStorage( &tmp_storage );
|
cvReleaseMemStorage( &tmp_storage );
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
//makes vertical list of segments for 1 contour
|
//makes vertical list of segments for 1 contour
|
||||||
CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* image /*tmp image*/)
|
CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* image /*tmp image*/)
|
||||||
{
|
{
|
||||||
//iplSet(image, 0 ); // this can cause double edges if two contours have common edge
|
//iplSet(image, 0 ); // this can cause double edges if two contours have common edge
|
||||||
// for example if object is circle with 1 pixel width
|
// for example if object is circle with 1 pixel width
|
||||||
// to remove such problem - remove this iplSet
|
// to remove such problem - remove this iplSet
|
||||||
|
|
||||||
//approx contour by single edges
|
//approx contour by single edges
|
||||||
CvSeqReader reader;
|
CvSeqReader reader;
|
||||||
CvSeqWriter writer;
|
CvSeqWriter writer;
|
||||||
|
|
||||||
int writing = 0;
|
int writing = 0;
|
||||||
cvStartReadSeq( current, &reader, 0 );
|
cvStartReadSeq( current, &reader, 0 );
|
||||||
//below line just to avoid warning
|
//below line just to avoid warning
|
||||||
cvStartWriteSeq( current->flags, sizeof(CvContour), sizeof(CvPoint), storage, &writer );
|
cvStartWriteSeq( current->flags, sizeof(CvContour), sizeof(CvPoint), storage, &writer );
|
||||||
|
|
||||||
CvSeq* output = 0;
|
CvSeq* output = 0;
|
||||||
CvSeq* tail = 0;
|
CvSeq* tail = 0;
|
||||||
|
|
||||||
@ -147,7 +148,7 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
|
|||||||
//mark point
|
//mark point
|
||||||
((uchar*)image->imageData)[image->widthStep * cur.y + cur.x]++;
|
((uchar*)image->imageData)[image->widthStep * cur.y + cur.x]++;
|
||||||
assert( ((uchar*)image->imageData)[image->widthStep * cur.y + cur.x] != 255 );
|
assert( ((uchar*)image->imageData)[image->widthStep * cur.y + cur.x] != 255 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//second pass - create separate edges
|
//second pass - create separate edges
|
||||||
@ -161,22 +162,22 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
|
|||||||
uchar flag = image->imageData[image->widthStep * cur.y + cur.x];
|
uchar flag = image->imageData[image->widthStep * cur.y + cur.x];
|
||||||
if( flag != 255 && flag < 3) //
|
if( flag != 255 && flag < 3) //
|
||||||
{
|
{
|
||||||
if(!writing)
|
if(!writing)
|
||||||
{
|
{
|
||||||
cvStartWriteSeq( current->flags, sizeof(CvContour), sizeof(CvPoint), storage, &writer );
|
cvStartWriteSeq( current->flags, sizeof(CvContour), sizeof(CvPoint), storage, &writer );
|
||||||
writing = 1 ;
|
writing = 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//mark point
|
//mark point
|
||||||
if( flag < 3 ) ((uchar*)image->imageData)[image->widthStep * cur.y + cur.x] = 255;
|
if( flag < 3 ) ((uchar*)image->imageData)[image->widthStep * cur.y + cur.x] = 255;
|
||||||
//add it to another seq
|
//add it to another seq
|
||||||
CV_WRITE_SEQ_ELEM( cur, writer );
|
CV_WRITE_SEQ_ELEM( cur, writer );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//exclude this point from contour
|
//exclude this point from contour
|
||||||
if( writing )
|
if( writing )
|
||||||
{
|
{
|
||||||
CvSeq* newseq = cvEndWriteSeq( &writer );
|
CvSeq* newseq = cvEndWriteSeq( &writer );
|
||||||
writing = 0;
|
writing = 0;
|
||||||
@ -191,7 +192,7 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
|
|||||||
{
|
{
|
||||||
output = tail = newseq;
|
output = tail = newseq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +212,7 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
|
|||||||
{
|
{
|
||||||
output = tail = newseq;
|
output = tail = newseq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
@ -224,12 +225,12 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
|
|||||||
//approx contour by single edges
|
//approx contour by single edges
|
||||||
CvSeqReader reader;
|
CvSeqReader reader;
|
||||||
CvSeqReader rev_reader;
|
CvSeqReader rev_reader;
|
||||||
|
|
||||||
cvStartReadSeq( current, &reader, 0 );
|
cvStartReadSeq( current, &reader, 0 );
|
||||||
|
|
||||||
int64* cur_pt = (int64*)reader.ptr;
|
int64* cur_pt = (int64*)reader.ptr;
|
||||||
int64* prev_pt = (int64*)reader.prev_elem;
|
int64* prev_pt = (int64*)reader.prev_elem;
|
||||||
|
|
||||||
//search for point a in aba position
|
//search for point a in aba position
|
||||||
for( int i = 0; i < current->total; i++ )
|
for( int i = 0; i < current->total; i++ )
|
||||||
{
|
{
|
||||||
@ -240,7 +241,7 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
|
|||||||
{
|
{
|
||||||
//return to prev pos
|
//return to prev pos
|
||||||
CV_PREV_SEQ_ELEM( sizeof(int64), reader );
|
CV_PREV_SEQ_ELEM( sizeof(int64), reader );
|
||||||
|
|
||||||
|
|
||||||
//this point is end of edge
|
//this point is end of edge
|
||||||
//start going both directions and collect edge
|
//start going both directions and collect edge
|
||||||
@ -248,7 +249,7 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
|
|||||||
|
|
||||||
int pos = cvGetSeqReaderPos( &reader );
|
int pos = cvGetSeqReaderPos( &reader );
|
||||||
cvSetSeqReaderPos( &rev_reader, pos );
|
cvSetSeqReaderPos( &rev_reader, pos );
|
||||||
|
|
||||||
//walk in both directions
|
//walk in both directions
|
||||||
while(1);
|
while(1);
|
||||||
|
|
||||||
@ -259,10 +260,10 @@ CvSeq* icvCutContourRaster( CvSeq* current, CvMemStorage* storage, IplImage* ima
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -446,15 +446,15 @@ static int getPathOfFeaturePyramid(IplImage * image,
|
|||||||
CvLSVMFeatureMap *map;
|
CvLSVMFeatureMap *map;
|
||||||
IplImage *scaleTmp;
|
IplImage *scaleTmp;
|
||||||
float scale;
|
float scale;
|
||||||
int i, err;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < numStep; i++)
|
for(i = 0; i < numStep; i++)
|
||||||
{
|
{
|
||||||
scale = 1.0f / powf(step, (float)i);
|
scale = 1.0f / powf(step, (float)i);
|
||||||
scaleTmp = resize_opencv (image, scale);
|
scaleTmp = resize_opencv (image, scale);
|
||||||
err = getFeatureMaps(scaleTmp, sideLength, &map);
|
getFeatureMaps(scaleTmp, sideLength, &map);
|
||||||
err = normalizeAndTruncate(map, VAL_OF_TRUNCATE);
|
normalizeAndTruncate(map, VAL_OF_TRUNCATE);
|
||||||
err = PCAFeatureMaps(map);
|
PCAFeatureMaps(map);
|
||||||
(*maps)->pyramid[startIndex + i] = map;
|
(*maps)->pyramid[startIndex + i] = map;
|
||||||
cvReleaseImage(&scaleTmp);
|
cvReleaseImage(&scaleTmp);
|
||||||
}/*for(i = 0; i < numStep; i++)*/
|
}/*for(i = 0; i < numStep; i++)*/
|
||||||
|
@ -560,7 +560,7 @@ int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H,
|
|||||||
float **score, int *kPoints,
|
float **score, int *kPoints,
|
||||||
int numThreads)
|
int numThreads)
|
||||||
{
|
{
|
||||||
int error = 0;
|
//int error = 0;
|
||||||
int i, j, s, f, componentIndex;
|
int i, j, s, f, componentIndex;
|
||||||
unsigned int maxXBorder, maxYBorder;
|
unsigned int maxXBorder, maxYBorder;
|
||||||
CvPoint **pointsArr, **oppPointsArr, ***partsDisplacementArr;
|
CvPoint **pointsArr, **oppPointsArr, ***partsDisplacementArr;
|
||||||
@ -576,14 +576,14 @@ int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H,
|
|||||||
partsDisplacementArr = (CvPoint ***)malloc(sizeof(CvPoint **) * kComponents);
|
partsDisplacementArr = (CvPoint ***)malloc(sizeof(CvPoint **) * kComponents);
|
||||||
|
|
||||||
// Getting maximum filter dimensions
|
// Getting maximum filter dimensions
|
||||||
error = getMaxFilterDims(filters, kComponents, kPartFilters, &maxXBorder, &maxYBorder);
|
/*error = */getMaxFilterDims(filters, kComponents, kPartFilters, &maxXBorder, &maxYBorder);
|
||||||
componentIndex = 0;
|
componentIndex = 0;
|
||||||
*kPoints = 0;
|
*kPoints = 0;
|
||||||
// For each component perform searching
|
// For each component perform searching
|
||||||
for (i = 0; i < kComponents; i++)
|
for (i = 0; i < kComponents; i++)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_TBB
|
#ifdef HAVE_TBB
|
||||||
error = searchObjectThreshold(H, &(filters[componentIndex]), kPartFilters[i],
|
/*error = */searchObjectThreshold(H, &(filters[componentIndex]), kPartFilters[i],
|
||||||
b[i], maxXBorder, maxYBorder, scoreThreshold,
|
b[i], maxXBorder, maxYBorder, scoreThreshold,
|
||||||
&(pointsArr[i]), &(levelsArr[i]), &(kPointsArr[i]),
|
&(pointsArr[i]), &(levelsArr[i]), &(kPointsArr[i]),
|
||||||
&(scoreArr[i]), &(partsDisplacementArr[i]), numThreads);
|
&(scoreArr[i]), &(partsDisplacementArr[i]), numThreads);
|
||||||
|
@ -534,12 +534,12 @@ void parserPFilterS (FILE * xmlf, int p, CvLSVMFilterObject *** model, int *last
|
|||||||
int tag;
|
int tag;
|
||||||
int tagVal;
|
int tagVal;
|
||||||
char ch;
|
char ch;
|
||||||
int i,j;
|
int /*i,*/j;
|
||||||
char buf[1024];
|
//char buf[1024];
|
||||||
char tagBuf[1024];
|
char tagBuf[1024];
|
||||||
//printf("<PartFilters>\n");
|
//printf("<PartFilters>\n");
|
||||||
|
|
||||||
i = 0;
|
//i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
st = 0;
|
st = 0;
|
||||||
tag = 0;
|
tag = 0;
|
||||||
@ -566,10 +566,10 @@ void parserPFilterS (FILE * xmlf, int p, CvLSVMFilterObject *** model, int *last
|
|||||||
N_path++;
|
N_path++;
|
||||||
}
|
}
|
||||||
tag = 0;
|
tag = 0;
|
||||||
i = 0;
|
//i = 0;
|
||||||
}else{
|
}else{
|
||||||
if((tag == 0)&& (st == 1)){
|
if((tag == 0)&& (st == 1)){
|
||||||
buf[i] = ch; i++;
|
//buf[i] = ch; i++;
|
||||||
}else{
|
}else{
|
||||||
tagBuf[j] = ch; j++;
|
tagBuf[j] = ch; j++;
|
||||||
}
|
}
|
||||||
@ -582,12 +582,12 @@ void parserComp (FILE * xmlf, int p, int *N_comp, CvLSVMFilterObject *** model,
|
|||||||
int tag;
|
int tag;
|
||||||
int tagVal;
|
int tagVal;
|
||||||
char ch;
|
char ch;
|
||||||
int i,j;
|
int /*i,*/j;
|
||||||
char buf[1024];
|
//char buf[1024];
|
||||||
char tagBuf[1024];
|
char tagBuf[1024];
|
||||||
//printf("<Component> %d\n", *N_comp);
|
//printf("<Component> %d\n", *N_comp);
|
||||||
|
|
||||||
i = 0;
|
//i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
st = 0;
|
st = 0;
|
||||||
tag = 0;
|
tag = 0;
|
||||||
@ -616,10 +616,10 @@ void parserComp (FILE * xmlf, int p, int *N_comp, CvLSVMFilterObject *** model,
|
|||||||
parserPFilterS (xmlf, p, model, last, max);
|
parserPFilterS (xmlf, p, model, last, max);
|
||||||
}
|
}
|
||||||
tag = 0;
|
tag = 0;
|
||||||
i = 0;
|
//i = 0;
|
||||||
}else{
|
}else{
|
||||||
if((tag == 0)&& (st == 1)){
|
if((tag == 0)&& (st == 1)){
|
||||||
buf[i] = ch; i++;
|
//buf[i] = ch; i++;
|
||||||
}else{
|
}else{
|
||||||
tagBuf[j] = ch; j++;
|
tagBuf[j] = ch; j++;
|
||||||
}
|
}
|
||||||
@ -726,12 +726,12 @@ void parserModel(FILE * xmlf, CvLSVMFilterObject *** model, int *last, int *max,
|
|||||||
}//namespace
|
}//namespace
|
||||||
|
|
||||||
int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){
|
int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){
|
||||||
int st = 0;
|
//int st = 0;
|
||||||
int tag;
|
int tag;
|
||||||
char ch;
|
char ch;
|
||||||
int i,j;
|
int /*i,*/j;
|
||||||
FILE *xmlf;
|
FILE *xmlf;
|
||||||
char buf[1024];
|
//char buf[1024];
|
||||||
char tagBuf[1024];
|
char tagBuf[1024];
|
||||||
|
|
||||||
(*max) = 10;
|
(*max) = 10;
|
||||||
@ -744,9 +744,9 @@ int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, i
|
|||||||
if(xmlf == NULL)
|
if(xmlf == NULL)
|
||||||
return LSVM_PARSER_FILE_NOT_FOUND;
|
return LSVM_PARSER_FILE_NOT_FOUND;
|
||||||
|
|
||||||
i = 0;
|
//i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
st = 0;
|
//st = 0;
|
||||||
tag = 0;
|
tag = 0;
|
||||||
while(!feof(xmlf)){
|
while(!feof(xmlf)){
|
||||||
ch = (char)fgetc( xmlf );
|
ch = (char)fgetc( xmlf );
|
||||||
@ -757,7 +757,7 @@ int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, i
|
|||||||
}else {
|
}else {
|
||||||
if(ch == '>'){
|
if(ch == '>'){
|
||||||
tag = 0;
|
tag = 0;
|
||||||
i = 0;
|
//i = 0;
|
||||||
tagBuf[j ] = ch;
|
tagBuf[j ] = ch;
|
||||||
tagBuf[j + 1] = '\0';
|
tagBuf[j + 1] = '\0';
|
||||||
if(getTeg(tagBuf) == MODEL){
|
if(getTeg(tagBuf) == MODEL){
|
||||||
@ -765,7 +765,7 @@ int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, i
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(tag == 0){
|
if(tag == 0){
|
||||||
buf[i] = ch; i++;
|
//buf[i] = ch; i++;
|
||||||
}else{
|
}else{
|
||||||
tagBuf[j] = ch; j++;
|
tagBuf[j] = ch; j++;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
int convolution(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap *map, float *f)
|
int convolution(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap *map, float *f)
|
||||||
{
|
{
|
||||||
int n1, m1, n2, m2, p, size, diff1, diff2;
|
int n1, m1, n2, m2, p, /*size,*/ diff1, diff2;
|
||||||
int i1, i2, j1, j2, k;
|
int i1, i2, j1, j2, k;
|
||||||
float tmp_f1, tmp_f2, tmp_f3, tmp_f4;
|
float tmp_f1, tmp_f2, tmp_f3, tmp_f4;
|
||||||
float *pMap = NULL;
|
float *pMap = NULL;
|
||||||
@ -37,7 +37,7 @@ int convolution(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap *map, float
|
|||||||
|
|
||||||
diff1 = n1 - n2 + 1;
|
diff1 = n1 - n2 + 1;
|
||||||
diff2 = m1 - m2 + 1;
|
diff2 = m1 - m2 + 1;
|
||||||
size = diff1 * diff2;
|
//size = diff1 * diff2;
|
||||||
for (j1 = diff2 - 1; j1 >= 0; j1--)
|
for (j1 = diff2 - 1; j1 >= 0; j1--)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ int filterDispositionLevel(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap
|
|||||||
float **scoreFi,
|
float **scoreFi,
|
||||||
int **pointsX, int **pointsY)
|
int **pointsX, int **pointsY)
|
||||||
{
|
{
|
||||||
int n1, m1, n2, m2, p, size, diff1, diff2;
|
int n1, m1, n2, m2, /*p,*/ size, diff1, diff2;
|
||||||
float *f;
|
float *f;
|
||||||
int i1, j1;
|
int i1, j1;
|
||||||
int res;
|
int res;
|
||||||
@ -342,7 +342,7 @@ int filterDispositionLevel(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap
|
|||||||
m1 = pyramid->sizeX;
|
m1 = pyramid->sizeX;
|
||||||
n2 = Fi->sizeY;
|
n2 = Fi->sizeY;
|
||||||
m2 = Fi->sizeX;
|
m2 = Fi->sizeX;
|
||||||
p = pyramid->numFeatures;
|
//p = pyramid->numFeatures;
|
||||||
(*scoreFi) = NULL;
|
(*scoreFi) = NULL;
|
||||||
(*pointsX) = NULL;
|
(*pointsX) = NULL;
|
||||||
(*pointsY) = NULL;
|
(*pointsY) = NULL;
|
||||||
@ -418,7 +418,7 @@ int filterDispositionLevelFFT(const CvLSVMFilterObject *Fi, const CvLSVMFftImage
|
|||||||
float **scoreFi,
|
float **scoreFi,
|
||||||
int **pointsX, int **pointsY)
|
int **pointsX, int **pointsY)
|
||||||
{
|
{
|
||||||
int n1, m1, n2, m2, p, size, diff1, diff2;
|
int n1, m1, n2, m2, /*p,*/ size, diff1, diff2;
|
||||||
float *f;
|
float *f;
|
||||||
int i1, j1;
|
int i1, j1;
|
||||||
int res;
|
int res;
|
||||||
@ -428,7 +428,7 @@ int filterDispositionLevelFFT(const CvLSVMFilterObject *Fi, const CvLSVMFftImage
|
|||||||
m1 = featMapImage->dimX;
|
m1 = featMapImage->dimX;
|
||||||
n2 = Fi->sizeY;
|
n2 = Fi->sizeY;
|
||||||
m2 = Fi->sizeX;
|
m2 = Fi->sizeX;
|
||||||
p = featMapImage->numFeatures;
|
//p = featMapImage->numFeatures;
|
||||||
(*scoreFi) = NULL;
|
(*scoreFi) = NULL;
|
||||||
(*pointsX) = NULL;
|
(*pointsX) = NULL;
|
||||||
(*pointsY) = NULL;
|
(*pointsY) = NULL;
|
||||||
@ -611,7 +611,7 @@ int maxFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n,
|
|||||||
float *score, CvPoint **points,
|
float *score, CvPoint **points,
|
||||||
int *kPoints, CvPoint ***partsDisplacement)
|
int *kPoints, CvPoint ***partsDisplacement)
|
||||||
{
|
{
|
||||||
int i, j, k, dimX, dimY, nF0, mF0, p;
|
int i, j, k, dimX, dimY, nF0, mF0/*, p*/;
|
||||||
int diff1, diff2, index, last, partsLevel;
|
int diff1, diff2, index, last, partsLevel;
|
||||||
CvLSVMFilterDisposition **disposition;
|
CvLSVMFilterDisposition **disposition;
|
||||||
float *f;
|
float *f;
|
||||||
@ -639,7 +639,7 @@ int maxFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n,
|
|||||||
dimY = H->pyramid[level]->sizeY;
|
dimY = H->pyramid[level]->sizeY;
|
||||||
|
|
||||||
// Number of features
|
// Number of features
|
||||||
p = H->pyramid[level]->numFeatures;
|
//p = H->pyramid[level]->numFeatures;
|
||||||
|
|
||||||
// Getting dimension of root filter
|
// Getting dimension of root filter
|
||||||
nF0 = all_F[0]->sizeY;
|
nF0 = all_F[0]->sizeY;
|
||||||
@ -860,7 +860,7 @@ int thresholdFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n,
|
|||||||
float **score, CvPoint **points, int *kPoints,
|
float **score, CvPoint **points, int *kPoints,
|
||||||
CvPoint ***partsDisplacement)
|
CvPoint ***partsDisplacement)
|
||||||
{
|
{
|
||||||
int i, j, k, dimX, dimY, nF0, mF0, p;
|
int i, j, k, dimX, dimY, nF0, mF0/*, p*/;
|
||||||
int diff1, diff2, index, last, partsLevel;
|
int diff1, diff2, index, last, partsLevel;
|
||||||
CvLSVMFilterDisposition **disposition;
|
CvLSVMFilterDisposition **disposition;
|
||||||
float *f;
|
float *f;
|
||||||
@ -887,7 +887,7 @@ int thresholdFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n,
|
|||||||
dimY = H->pyramid[level]->sizeY;
|
dimY = H->pyramid[level]->sizeY;
|
||||||
|
|
||||||
// Number of features
|
// Number of features
|
||||||
p = H->pyramid[level]->numFeatures;
|
//p = H->pyramid[level]->numFeatures;
|
||||||
|
|
||||||
// Getting dimension of root filter
|
// Getting dimension of root filter
|
||||||
nF0 = all_F[0]->sizeY;
|
nF0 = all_F[0]->sizeY;
|
||||||
|
@ -56,12 +56,12 @@ class CV_EXPORTS Estimator
|
|||||||
public:
|
public:
|
||||||
virtual ~Estimator() {}
|
virtual ~Estimator() {}
|
||||||
|
|
||||||
void operator ()(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
|
void operator ()(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
|
||||||
std::vector<CameraParams> &cameras)
|
std::vector<CameraParams> &cameras)
|
||||||
{ estimate(features, pairwise_matches, cameras); }
|
{ estimate(features, pairwise_matches, cameras); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void estimate(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
|
virtual void estimate(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
|
||||||
std::vector<CameraParams> &cameras) = 0;
|
std::vector<CameraParams> &cameras) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -72,8 +72,8 @@ public:
|
|||||||
HomographyBasedEstimator(bool is_focals_estimated = false)
|
HomographyBasedEstimator(bool is_focals_estimated = false)
|
||||||
: is_focals_estimated_(is_focals_estimated) {}
|
: is_focals_estimated_(is_focals_estimated) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void estimate(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
|
void estimate(const std::vector<ImageFeatures> &features, const std::vector<MatchesInfo> &pairwise_matches,
|
||||||
std::vector<CameraParams> &cameras);
|
std::vector<CameraParams> &cameras);
|
||||||
|
|
||||||
bool is_focals_estimated_;
|
bool is_focals_estimated_;
|
||||||
@ -84,10 +84,10 @@ class CV_EXPORTS BundleAdjusterBase : public Estimator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const Mat refinementMask() const { return refinement_mask_.clone(); }
|
const Mat refinementMask() const { return refinement_mask_.clone(); }
|
||||||
void setRefinementMask(const Mat &mask)
|
void setRefinementMask(const Mat &mask)
|
||||||
{
|
{
|
||||||
CV_Assert(mask.type() == CV_8U && mask.size() == Size(3, 3));
|
CV_Assert(mask.type() == CV_8U && mask.size() == Size(3, 3));
|
||||||
refinement_mask_ = mask.clone();
|
refinement_mask_ = mask.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
double confThresh() const { return conf_thresh_; }
|
double confThresh() const { return conf_thresh_; }
|
||||||
@ -97,17 +97,17 @@ public:
|
|||||||
void setTermCriteria(const CvTermCriteria& term_criteria) { term_criteria_ = term_criteria; }
|
void setTermCriteria(const CvTermCriteria& term_criteria) { term_criteria_ = term_criteria; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement)
|
BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement)
|
||||||
: num_params_per_cam_(num_params_per_cam),
|
: num_params_per_cam_(num_params_per_cam),
|
||||||
num_errs_per_measurement_(num_errs_per_measurement)
|
num_errs_per_measurement_(num_errs_per_measurement)
|
||||||
{
|
{
|
||||||
setRefinementMask(Mat::ones(3, 3, CV_8U));
|
setRefinementMask(Mat::ones(3, 3, CV_8U));
|
||||||
setConfThresh(1.);
|
setConfThresh(1.);
|
||||||
setTermCriteria(cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 1000, DBL_EPSILON));
|
setTermCriteria(cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 1000, DBL_EPSILON));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs bundle adjustment
|
// Runs bundle adjustment
|
||||||
virtual void estimate(const std::vector<ImageFeatures> &features,
|
virtual void estimate(const std::vector<ImageFeatures> &features,
|
||||||
const std::vector<MatchesInfo> &pairwise_matches,
|
const std::vector<MatchesInfo> &pairwise_matches,
|
||||||
std::vector<CameraParams> &cameras);
|
std::vector<CameraParams> &cameras);
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
// Minimizes reprojection error.
|
// Minimizes reprojection error.
|
||||||
// It can estimate focal length, aspect ratio, principal point.
|
// It can estimate focal length, aspect ratio, principal point.
|
||||||
// You can affect only on them via the refinement mask.
|
// You can affect only on them via the refinement mask.
|
||||||
class CV_EXPORTS BundleAdjusterReproj : public BundleAdjusterBase
|
class CV_EXPORTS BundleAdjusterReproj : public BundleAdjusterBase
|
||||||
{
|
{
|
||||||
@ -177,7 +177,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum CV_EXPORTS WaveCorrectKind
|
enum WaveCorrectKind
|
||||||
{
|
{
|
||||||
WAVE_CORRECT_HORIZ,
|
WAVE_CORRECT_HORIZ,
|
||||||
WAVE_CORRECT_VERT
|
WAVE_CORRECT_VERT
|
||||||
@ -193,10 +193,10 @@ void CV_EXPORTS waveCorrect(std::vector<Mat> &rmats, WaveCorrectKind kind);
|
|||||||
std::string CV_EXPORTS matchesGraphAsString(std::vector<std::string> &pathes, std::vector<MatchesInfo> &pairwise_matches,
|
std::string CV_EXPORTS matchesGraphAsString(std::vector<std::string> &pathes, std::vector<MatchesInfo> &pairwise_matches,
|
||||||
float conf_threshold);
|
float conf_threshold);
|
||||||
|
|
||||||
std::vector<int> CV_EXPORTS leaveBiggestComponent(std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
|
std::vector<int> CV_EXPORTS leaveBiggestComponent(std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
|
||||||
float conf_threshold);
|
float conf_threshold);
|
||||||
|
|
||||||
void CV_EXPORTS findMaxSpanningTree(int num_images, const std::vector<MatchesInfo> &pairwise_matches,
|
void CV_EXPORTS findMaxSpanningTree(int num_images, const std::vector<MatchesInfo> &pairwise_matches,
|
||||||
Graph &span_tree, std::vector<int> ¢ers);
|
Graph &span_tree, std::vector<int> ¢ers);
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
@ -33,7 +33,6 @@ PERF_TEST_P(stitch, a123, TEST_DETECTORS)
|
|||||||
imgs.push_back( imread( getDataPath("stitching/a2.jpg") ) );
|
imgs.push_back( imread( getDataPath("stitching/a2.jpg") ) );
|
||||||
imgs.push_back( imread( getDataPath("stitching/a3.jpg") ) );
|
imgs.push_back( imread( getDataPath("stitching/a3.jpg") ) );
|
||||||
|
|
||||||
Stitcher::Status status;
|
|
||||||
Ptr<detail::FeaturesFinder> featuresFinder = GetParam() == "orb"
|
Ptr<detail::FeaturesFinder> featuresFinder = GetParam() == "orb"
|
||||||
? (detail::FeaturesFinder*)new detail::OrbFeaturesFinder()
|
? (detail::FeaturesFinder*)new detail::OrbFeaturesFinder()
|
||||||
: (detail::FeaturesFinder*)new detail::SurfFeaturesFinder();
|
: (detail::FeaturesFinder*)new detail::SurfFeaturesFinder();
|
||||||
@ -53,7 +52,7 @@ PERF_TEST_P(stitch, a123, TEST_DETECTORS)
|
|||||||
stitcher.setRegistrationResol(WORK_MEGAPIX);
|
stitcher.setRegistrationResol(WORK_MEGAPIX);
|
||||||
|
|
||||||
startTimer();
|
startTimer();
|
||||||
status = stitcher.stitch(imgs, pano);
|
stitcher.stitch(imgs, pano);
|
||||||
stopTimer();
|
stopTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,7 +65,6 @@ PERF_TEST_P(stitch, b12, TEST_DETECTORS)
|
|||||||
imgs.push_back( imread( getDataPath("stitching/b1.jpg") ) );
|
imgs.push_back( imread( getDataPath("stitching/b1.jpg") ) );
|
||||||
imgs.push_back( imread( getDataPath("stitching/b2.jpg") ) );
|
imgs.push_back( imread( getDataPath("stitching/b2.jpg") ) );
|
||||||
|
|
||||||
Stitcher::Status status;
|
|
||||||
Ptr<detail::FeaturesFinder> featuresFinder = GetParam() == "orb"
|
Ptr<detail::FeaturesFinder> featuresFinder = GetParam() == "orb"
|
||||||
? (detail::FeaturesFinder*)new detail::OrbFeaturesFinder()
|
? (detail::FeaturesFinder*)new detail::OrbFeaturesFinder()
|
||||||
: (detail::FeaturesFinder*)new detail::SurfFeaturesFinder();
|
: (detail::FeaturesFinder*)new detail::SurfFeaturesFinder();
|
||||||
@ -86,7 +84,7 @@ PERF_TEST_P(stitch, b12, TEST_DETECTORS)
|
|||||||
stitcher.setRegistrationResol(WORK_MEGAPIX);
|
stitcher.setRegistrationResol(WORK_MEGAPIX);
|
||||||
|
|
||||||
startTimer();
|
startTimer();
|
||||||
status = stitcher.stitch(imgs, pano);
|
stitcher.stitch(imgs, pano);
|
||||||
stopTimer();
|
stopTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ void GainCompensator::feed(const vector<Point> &corners, const vector<Mat> &imag
|
|||||||
Mat_<int> N(num_images, num_images); N.setTo(0);
|
Mat_<int> N(num_images, num_images); N.setTo(0);
|
||||||
Mat_<double> I(num_images, num_images); I.setTo(0);
|
Mat_<double> I(num_images, num_images); I.setTo(0);
|
||||||
|
|
||||||
Rect dst_roi = resultRoi(corners, images);
|
//Rect dst_roi = resultRoi(corners, images);
|
||||||
Mat subimg1, subimg2;
|
Mat subimg1, subimg2;
|
||||||
Mat_<uchar> submask1, submask2, intersect;
|
Mat_<uchar> submask1, submask2, intersect;
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ void BlocksGainCompensator::feed(const vector<Point> &corners, const vector<Mat>
|
|||||||
|
|
||||||
block_corners.push_back(corners[img_idx] + bl_tl);
|
block_corners.push_back(corners[img_idx] + bl_tl);
|
||||||
block_images.push_back(images[img_idx](Rect(bl_tl, bl_br)));
|
block_images.push_back(images[img_idx](Rect(bl_tl, bl_br)));
|
||||||
block_masks.push_back(make_pair(masks[img_idx].first(Rect(bl_tl, bl_br)),
|
block_masks.push_back(make_pair(masks[img_idx].first(Rect(bl_tl, bl_br)),
|
||||||
masks[img_idx].second));
|
masks[img_idx].second));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ void BlocksGainCompensator::feed(const vector<Point> &corners, const vector<Mat>
|
|||||||
vector<double> gains = compensator.gains();
|
vector<double> gains = compensator.gains();
|
||||||
gain_maps_.resize(num_images);
|
gain_maps_.resize(num_images);
|
||||||
|
|
||||||
Mat_<float> ker(1, 3);
|
Mat_<float> ker(1, 3);
|
||||||
ker(0,0) = 0.25; ker(0,1) = 0.5; ker(0,2) = 0.25;
|
ker(0,0) = 0.25; ker(0,1) = 0.5; ker(0,2) = 0.25;
|
||||||
|
|
||||||
int bl_idx = 0;
|
int bl_idx = 0;
|
||||||
@ -213,7 +213,7 @@ void BlocksGainCompensator::feed(const vector<Point> &corners, const vector<Mat>
|
|||||||
for (int by = 0; by < bl_per_img.height; ++by)
|
for (int by = 0; by < bl_per_img.height; ++by)
|
||||||
for (int bx = 0; bx < bl_per_img.width; ++bx, ++bl_idx)
|
for (int bx = 0; bx < bl_per_img.width; ++bx, ++bl_idx)
|
||||||
gain_maps_[img_idx](by, bx) = static_cast<float>(gains[bl_idx]);
|
gain_maps_[img_idx](by, bx) = static_cast<float>(gains[bl_idx]);
|
||||||
|
|
||||||
sepFilter2D(gain_maps_[img_idx], gain_maps_[img_idx], CV_32F, ker, ker);
|
sepFilter2D(gain_maps_[img_idx], gain_maps_[img_idx], CV_32F, ker, ker);
|
||||||
sepFilter2D(gain_maps_[img_idx], gain_maps_[img_idx], CV_32F, ker, ker);
|
sepFilter2D(gain_maps_[img_idx], gain_maps_[img_idx], CV_32F, ker, ker);
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
|
|||||||
Mat img_warped, img_warped_s;
|
Mat img_warped, img_warped_s;
|
||||||
Mat dilated_mask, seam_mask, mask, mask_warped;
|
Mat dilated_mask, seam_mask, mask, mask_warped;
|
||||||
|
|
||||||
double compose_seam_aspect = 1;
|
//double compose_seam_aspect = 1;
|
||||||
double compose_work_aspect = 1;
|
double compose_work_aspect = 1;
|
||||||
bool is_blender_prepared = false;
|
bool is_blender_prepared = false;
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
|
|||||||
is_compose_scale_set = true;
|
is_compose_scale_set = true;
|
||||||
|
|
||||||
// Compute relative scales
|
// Compute relative scales
|
||||||
compose_seam_aspect = compose_scale / seam_scale_;
|
//compose_seam_aspect = compose_scale / seam_scale_;
|
||||||
compose_work_aspect = compose_scale / work_scale_;
|
compose_work_aspect = compose_scale / work_scale_;
|
||||||
|
|
||||||
// Update warped image scale
|
// Update warped image scale
|
||||||
|
@ -38,6 +38,9 @@
|
|||||||
#ifndef GTEST_USES_SIMPLE_RE
|
#ifndef GTEST_USES_SIMPLE_RE
|
||||||
# define GTEST_USES_SIMPLE_RE 0
|
# define GTEST_USES_SIMPLE_RE 0
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef GTEST_USES_POSIX_RE
|
||||||
|
# define GTEST_USES_POSIX_RE 0
|
||||||
|
#endif
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||||
#endif
|
#endif
|
||||||
|
@ -412,19 +412,22 @@
|
|||||||
// <stddef.h>.
|
// <stddef.h>.
|
||||||
# include <regex.h> // NOLINT
|
# include <regex.h> // NOLINT
|
||||||
|
|
||||||
# define GTEST_USES_POSIX_RE 1
|
# define GTEST_USES_POSIX_RE 1
|
||||||
|
# define GTEST_USES_SIMPLE_RE 0
|
||||||
|
|
||||||
#elif GTEST_OS_WINDOWS
|
#elif GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// <regex.h> is not available on Windows. Use our own simple regex
|
// <regex.h> is not available on Windows. Use our own simple regex
|
||||||
// implementation instead.
|
// implementation instead.
|
||||||
# define GTEST_USES_SIMPLE_RE 1
|
# define GTEST_USES_SIMPLE_RE 1
|
||||||
|
# define GTEST_USES_POSIX_RE 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// <regex.h> may not be available on this platform. Use our own
|
// <regex.h> may not be available on this platform. Use our own
|
||||||
// simple regex implementation instead.
|
// simple regex implementation instead.
|
||||||
# define GTEST_USES_SIMPLE_RE 1
|
# define GTEST_USES_SIMPLE_RE 1
|
||||||
|
# define GTEST_USES_POSIX_RE 0
|
||||||
|
|
||||||
#endif // GTEST_HAS_POSIX_RE
|
#endif // GTEST_HAS_POSIX_RE
|
||||||
|
|
||||||
@ -1678,6 +1681,8 @@ inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
|
|||||||
// Determines whether test results can be streamed to a socket.
|
// Determines whether test results can be streamed to a socket.
|
||||||
#if GTEST_OS_LINUX
|
#if GTEST_OS_LINUX
|
||||||
# define GTEST_CAN_STREAM_RESULTS_ 1
|
# define GTEST_CAN_STREAM_RESULTS_ 1
|
||||||
|
#else
|
||||||
|
# define GTEST_CAN_STREAM_RESULTS_ 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Defines some utility macros.
|
// Defines some utility macros.
|
||||||
|
@ -371,7 +371,7 @@ int main(int argc, char* argv[])
|
|||||||
CvBlobTrackerAutoParam1 param = {0};
|
CvBlobTrackerAutoParam1 param = {0};
|
||||||
CvBlobTrackerAuto* pTracker = NULL;
|
CvBlobTrackerAuto* pTracker = NULL;
|
||||||
|
|
||||||
float scale = 1;
|
//float scale = 1;
|
||||||
const char* scale_name = NULL;
|
const char* scale_name = NULL;
|
||||||
char* yml_name = NULL;
|
char* yml_name = NULL;
|
||||||
char** yml_video_names = NULL;
|
char** yml_video_names = NULL;
|
||||||
@ -387,7 +387,7 @@ int main(int argc, char* argv[])
|
|||||||
const char* bta_name = NULL;
|
const char* bta_name = NULL;
|
||||||
char* bta_data_name = NULL;
|
char* bta_data_name = NULL;
|
||||||
char* track_name = NULL;
|
char* track_name = NULL;
|
||||||
char* comment_name = NULL;
|
//char* comment_name = NULL;
|
||||||
char* FGTrainFrames = NULL;
|
char* FGTrainFrames = NULL;
|
||||||
char* log_name = NULL;
|
char* log_name = NULL;
|
||||||
char* savestate_name = NULL;
|
char* savestate_name = NULL;
|
||||||
@ -462,7 +462,7 @@ int main(int argc, char* argv[])
|
|||||||
RO("bta_data=",bta_data_name);
|
RO("bta_data=",bta_data_name);
|
||||||
RO("btgen=",btgen_name);
|
RO("btgen=",btgen_name);
|
||||||
RO("track=",track_name);
|
RO("track=",track_name);
|
||||||
RO("comment=",comment_name);
|
//RO("comment=",comment_name);
|
||||||
RO("FGTrainFrames=",FGTrainFrames);
|
RO("FGTrainFrames=",FGTrainFrames);
|
||||||
RO("log=",log_name);
|
RO("log=",log_name);
|
||||||
RO("savestate=",savestate_name);
|
RO("savestate=",savestate_name);
|
||||||
@ -512,8 +512,8 @@ int main(int argc, char* argv[])
|
|||||||
if(!scale_name) scale_name = "1";
|
if(!scale_name) scale_name = "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(scale_name)
|
// if(scale_name)
|
||||||
scale = (float)atof(scale_name);
|
// scale = (float)atof(scale_name);
|
||||||
|
|
||||||
for(pFGModule=FGDetector_Modules; pFGModule->nickname; ++pFGModule)
|
for(pFGModule=FGDetector_Modules; pFGModule->nickname; ++pFGModule)
|
||||||
if( fg_name && MY_STRICMP(fg_name,pFGModule->nickname)==0 ) break;
|
if( fg_name && MY_STRICMP(fg_name,pFGModule->nickname)==0 ) break;
|
||||||
|
@ -112,12 +112,11 @@ int main(int argc, const char ** argv)
|
|||||||
|
|
||||||
vector<Point2f> mpts_1, mpts_2;
|
vector<Point2f> mpts_1, mpts_2;
|
||||||
matches2points(matches_popcount, kpts_1, kpts_2, mpts_1, mpts_2); //Extract a list of the (x,y) location of the matches
|
matches2points(matches_popcount, kpts_1, kpts_2, mpts_1, mpts_2); //Extract a list of the (x,y) location of the matches
|
||||||
vector<uchar> outlier_mask;
|
vector<char> outlier_mask;
|
||||||
Mat H = findHomography(mpts_2, mpts_1, RANSAC, 1, outlier_mask);
|
Mat H = findHomography(mpts_2, mpts_1, RANSAC, 1, outlier_mask);
|
||||||
|
|
||||||
Mat outimg;
|
Mat outimg;
|
||||||
drawMatches(im2, kpts_2, im1, kpts_1, matches_popcount, outimg, Scalar::all(-1), Scalar::all(-1),
|
drawMatches(im2, kpts_2, im1, kpts_1, matches_popcount, outimg, Scalar::all(-1), Scalar::all(-1), outlier_mask);
|
||||||
*(const vector<char>*)(void*)(&outlier_mask));
|
|
||||||
imshow("matches - popcount - outliers removed", outimg);
|
imshow("matches - popcount - outliers removed", outimg);
|
||||||
|
|
||||||
Mat warped;
|
Mat warped;
|
||||||
|
@ -164,7 +164,7 @@ static void findConstrainedCorrespondences(const Mat& _F,
|
|||||||
{
|
{
|
||||||
Point2f p1 = keypoints1[i].pt;
|
Point2f p1 = keypoints1[i].pt;
|
||||||
double bestDist1 = DBL_MAX, bestDist2 = DBL_MAX;
|
double bestDist1 = DBL_MAX, bestDist2 = DBL_MAX;
|
||||||
int bestIdx1 = -1, bestIdx2 = -1;
|
int bestIdx1 = -1;//, bestIdx2 = -1;
|
||||||
const float* d1 = descriptors1.ptr<float>(i);
|
const float* d1 = descriptors1.ptr<float>(i);
|
||||||
|
|
||||||
for( int j = 0; j < (int)keypoints2.size(); j++ )
|
for( int j = 0; j < (int)keypoints2.size(); j++ )
|
||||||
@ -203,14 +203,14 @@ static void findConstrainedCorrespondences(const Mat& _F,
|
|||||||
if( dist < bestDist1 )
|
if( dist < bestDist1 )
|
||||||
{
|
{
|
||||||
bestDist2 = bestDist1;
|
bestDist2 = bestDist1;
|
||||||
bestIdx2 = bestIdx1;
|
//bestIdx2 = bestIdx1;
|
||||||
bestDist1 = dist;
|
bestDist1 = dist;
|
||||||
bestIdx1 = (int)j;
|
bestIdx1 = (int)j;
|
||||||
}
|
}
|
||||||
else if( dist < bestDist2 )
|
else if( dist < bestDist2 )
|
||||||
{
|
{
|
||||||
bestDist2 = dist;
|
bestDist2 = dist;
|
||||||
bestIdx2 = (int)j;
|
//bestIdx2 = (int)j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -632,7 +632,7 @@ int main(int argc, char* argv[])
|
|||||||
Mat img_warped, img_warped_s;
|
Mat img_warped, img_warped_s;
|
||||||
Mat dilated_mask, seam_mask, mask, mask_warped;
|
Mat dilated_mask, seam_mask, mask, mask_warped;
|
||||||
Ptr<Blender> blender;
|
Ptr<Blender> blender;
|
||||||
double compose_seam_aspect = 1;
|
//double compose_seam_aspect = 1;
|
||||||
double compose_work_aspect = 1;
|
double compose_work_aspect = 1;
|
||||||
|
|
||||||
for (int img_idx = 0; img_idx < num_images; ++img_idx)
|
for (int img_idx = 0; img_idx < num_images; ++img_idx)
|
||||||
@ -648,7 +648,7 @@ int main(int argc, char* argv[])
|
|||||||
is_compose_scale_set = true;
|
is_compose_scale_set = true;
|
||||||
|
|
||||||
// Compute relative scales
|
// Compute relative scales
|
||||||
compose_seam_aspect = compose_scale / seam_scale;
|
//compose_seam_aspect = compose_scale / seam_scale;
|
||||||
compose_work_aspect = compose_scale / work_scale;
|
compose_work_aspect = compose_scale / work_scale;
|
||||||
|
|
||||||
// Update warped image scale
|
// Update warped image scale
|
||||||
|
Loading…
x
Reference in New Issue
Block a user