Commit b33224f0 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

merged the latest fixes in 2.3 to trunk

parent 55ba0af2
......@@ -13,3 +13,6 @@ endif()
if(WITH_TIFF AND NOT TIFF_FOUND)
add_subdirectory(libtiff)
endif()
if(WIN32)
add_subdirectory(ffmpeg)
endif()
project(opencv_ffmpeg)
if(MSVC64 OR MINGW64)
set(FFMPEG_SUFFIX _64)
endif()
set(module_bare_name "opencv_ffmpeg${FFMPEG_SUFFIX}.dll")
set(module_name "${CMAKE_CURRENT_SOURCE_DIR}/${module_bare_name}")
get_target_property(bin_dir opencv_traincascade LOCATION)
get_filename_component(bin_dir ${bin_dir} PATH)
message(STATUS "ffmpeg output dir: ${bin_dir}")
add_custom_target(opencv_ffmpeg ALL
COMMAND ${CMAKE_COMMAND} -E copy
${module_name} ${bin_dir}/${module_bare_name}
COMMENT "Copying ${module_name} to the output directory")
install(FILES ${module_name} DESTINATION bin COMPONENT main)
#include "cap_ffmpeg_impl.hpp"
gcc -Wall -shared -o opencv_ffmpeg.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat -lavcodec -lavdevice -lswscale -lavutil -lwsock32
set path=c:\apps\mingw64\bin;%path% & gcc -Wall -shared -o opencv_ffmpeg_64.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat64 -lavcodec64 -lavdevice64 -lswscale64 -lavutil64 -lavcore64 -lwsock32
\ No newline at end of file
The build script is to be fixed.
Right now it assumes that 32-bit MinGW is in the system path and
64-bit mingw is installed to c:\Apps\MinGW64.
It is important that gcc is used, not g++!
Otherwise the produced DLL will likely be dependent on libgcc_s_dw2-1.dll or similar DLL.
While we want to make the DLLs with minimum dependencies: Win32 libraries + msvcrt.dll.
ffopencv.c is really a C++ source, hence -x c++ is used.
......@@ -59,6 +59,12 @@ if(CMAKE_VERBOSE)
set(CMAKE_VERBOSE_MAKEFILE 1)
endif()
if (WIN32)
if(${CMAKE_GENERATOR} MATCHES "(MinGW)|(MSYS)")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG" CACHE STRING "")
endif()
endif()
# --------------------------------------------------------------
# Indicate CMake 2.7 and above that we don't want to mix relative
# and absolute paths in linker lib lists.
......@@ -74,6 +80,12 @@ endif()
# ----------------------------------------------------------------------------
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)")
# ----------------------------------------------------------------------------
# Include debug info into debug libs?
# Default: yes
# ----------------------------------------------------------------------------
set(BUILD_WITH_DEBUG_INFO ON CACHE BOOL "Include debug info into debug libs")
# ----------------------------------------------------------------------------
# Get actual OpenCV version number from sources
# ----------------------------------------------------------------------------
......@@ -144,8 +156,8 @@ endif()
# Use statically or dynamically linked CRT?
# Default: dynamic
# ----------------------------------------------------------------------------
if(MSVC AND NOT BUILD_SHARED_LIBS)
option (BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT" OFF)
if(WIN32 AND NOT BUILD_SHARED_LIBS)
option (BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT" ON)
endif()
if(MSVC)
......@@ -180,6 +192,27 @@ if(MSVC)
endif()
endforeach(flag_var)
endif(BUILD_WITH_STATIC_CRT)
if(NOT BUILD_WITH_DEBUG_INFO)
string(REPLACE "/debug" "" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
string(REPLACE "/DEBUG" "" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
string(REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
string(REPLACE "/debug" "" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
string(REPLACE "/DEBUG" "" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
string(REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
string(REPLACE "/debug" "" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
string(REPLACE "/DEBUG" "" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
string(REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
string(REPLACE "/Zi" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
endif()
endif(MSVC)
# ----------------------------------------------------------------------------
......@@ -790,10 +823,9 @@ if (WITH_TBB)
else()
get_filename_component(_TBB_LIB_PATH "${TBB_INCLUDE_DIR}/../lib" ABSOLUTE)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*|x86_64*)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64*|x86_64* OR MSVC64)
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64")
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86*|i386*|i686*)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86*|i386*|i686*)
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/ia32")
endif()
......@@ -1022,17 +1054,25 @@ if(MSVC)
# set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /D _BIND_TO_CURRENT_CRT_VERSION=1 /D _BIND_TO_CURRENT_VCLIBS_VERSION=1")
#endif()
if(BUILD_WITH_DEBUG_INFO)
set(EXTRA_EXE_LINKER_FLAGS_RELEASE "${EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
endif()
# Remove unreferenced functions: function level linking
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /Gy")
if(BUILD_WITH_DEBUG_INFO)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Zi")
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
# High level of warnings.
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall")
if(BUILD_WITH_STATIC_CRT)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -static-libstdc++")
endif()
# The -Wno-long-long is required in 64bit systems when including sytem headers.
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64*)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-long-long")
......@@ -1113,16 +1153,22 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -DNDEBUG")
set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -O0 -ggdb3 -DDEBUG -D_DEBUG")
set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -O0 -DDEBUG -D_DEBUG")
if(BUILD_WITH_DEBUG_INFO)
set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -ggdb3")
endif()
endif()
if(MSVC)
# 64-bit MSVC compiler uses SSE/SSE2 by default
if(NOT MSVC64)
if(ENABLE_SSE)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE")
endif()
if(ENABLE_SSE2)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE2")
endif()
endif()
if(ENABLE_SSE3)
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /arch:SSE3")
endif()
......@@ -1365,7 +1411,7 @@ ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/c
# CPack target
# ----------------------------------------------------------------------------
set(BUILD_PACKAGE OFF CACHE BOOL "Build a installer with the SDK")
set(BUILD_PACKAGE ON CACHE BOOL "Enables 'make package_source' command")
if(BUILD_PACKAGE)
configure_file(
......@@ -1376,7 +1422,7 @@ if(BUILD_PACKAGE)
include(${CMAKE_BINARY_DIR}/.cpack/Package.cmake)
set(root_files README)
file(GLOB root_src_files *.in *.cmake CMakeLists.txt)
file(GLOB root_src_files *.in *.cmake *.rst CMakeLists.txt)
if (NOT WIN32)
install(FILES ${root_files}
......@@ -1401,27 +1447,8 @@ if(BUILD_PACKAGE)
COMPONENT src
)
if(CMAKE_INSTALL_DEBUG_LIBRARIES)
foreach(m calib3d core contrib features2d ffmpeg flann gpu highgui imgproc legacy ml objdetect video)
install(FILES ${EXECUTABLE_OUTPUT_PATH}/Debug/opencv_${m}${OPENCV_DLLVERSION}d.dll
DESTINATION bin COMPONENT main)
install(FILES ${LIBRARY_OUTPUT_PATH}/Debug/opencv_${m}${OPENCV_DLLVERSION}d.lib
DESTINATION lib COMPONENT main)
endforeach()
endif()
install(DIRECTORY data samples DESTINATION "." COMPONENT main PATTERN ".svn" EXCLUDE)
install(DIRECTORY 3rdparty android modules doc DESTINATION "." COMPONENT src PATTERN ".svn" EXCLUDE)
#install(DIRECTORY doc DESTINATION doc COMPONENT src FILES_MATCHING PATTERN "*.rst" "*.tex")
#install(DIRECTORY doc/pics DESTINATION doc COMPONENT src PATTERN ".svn" EXCLUDE)
#install(DIRECTORY doc/latex2sphinx DESTINATION doc COMPONENT src PATTERN ".svn" EXCLUDE)
# install TBB dlls
if(WIN32 AND HAVE_TBB)
string(REGEX REPLACE "/lib" "/bin" TBB_DLL_DIR "${TBB_LIB_DIR}")
install(PROGRAMS "${TBB_DLL_DIR}/tbb.dll" DESTINATION bin COMPONENT main)
install(PROGRAMS "${TBB_DLL_DIR}/tbb_debug.dll" DESTINATION bin COMPONENT main)
endif()
endif()
endif()
......
......@@ -4,20 +4,11 @@
# (c) Copyrights 2008 Hartmut Seichter, HIT Lab NZ
#
if(MSVC)
set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
endif()
#if(ENABLE_OPENMP)
# set(CMAKE_INSTALL_OPENMP_LIBRARIES 1)
#endif()
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_NAME "OpenCV")
set(CPACK_PACKAGE_VENDOR "OpenCV project opencvlibrary.sourceforge.net")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenCV SDK for ${CMAKE_GENERATOR} is an All-In-One package for developing computer vision applications")
#set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/doc/license.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${OPENCV_VERSION_MAJOR}")
......@@ -32,13 +23,11 @@ set(CPACK_COMPONENTS_ALL main src Unspecified)
set(CPACK_COMPONENT_main_DISPLAY_NAME "Binaries and the Documentation")
set(CPACK_COMPONENT_src_DISPLAY_NAME "The source code")
#set(CPACK_COMPONENT_py_DISPLAY_NAME "Python Bindings")
set(CPACK_ALL_INSTALL_TYPES Full)
set(CPACK_COMPONENT_MAIN_INSTALL_TYPES Full)
set(CPACK_COMPONENT_SRC_INSTALL_TYPES Full)
#set(CPACK_COMPONENT_py_INSTALL_TYPES Full)
set(CPACK_SOURCE_IGNORE_FILES
"/\\\\.svn/"
......@@ -67,6 +56,7 @@ set(CPACK_SOURCE_IGNORE_FILES
if(NOT WIN32)
set(CPACK_SOURCE_IGNORE_FILES
"/lib/"
"\\\\.dll$"
"${CPACK_SOURCE_IGNORE_FILES}")
endif()
......
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -14,10 +14,6 @@ add_subdirectory(core)
add_subdirectory(features2d)
add_subdirectory(flann)
if(MSVC OR MINGW)
add_subdirectory(ffmpeg)
endif()
if(BUILD_TESTS)
add_subdirectory(ts)
endif()
......
......@@ -579,7 +579,7 @@ Copy
----
Copies one array to another.
.. cfunction:: void cvCopy(const CvArr* src, CvArr* dst, const CvArr* mask=NULL)
.. ocv:cfunction:: void cvCopy(const CvArr* src, CvArr* dst, const CvArr* mask=NULL)
.. ocv:pyoldfunction:: cv.Copy(src, dst, mask=None)-> None
:param src: The source array
......@@ -1635,7 +1635,7 @@ SetIPLAllocators
----------------
Makes OpenCV use IPL functions for allocating IplImage and IplROI structures.
.. cfunction:: void cvSetIPLAllocators( Cv_iplCreateImageHeader create_header, Cv_iplAllocateImageData allocate_data, Cv_iplDeallocate deallocate, Cv_iplCreateROI create_roi, Cv_iplCloneImage clone_image )
.. ocv:cfunction:: void cvSetIPLAllocators( Cv_iplCreateImageHeader create_header, Cv_iplAllocateImageData allocate_data, Cv_iplDeallocate deallocate, Cv_iplCreateROI create_roi, Cv_iplCloneImage clone_image )
Normally, the function is not called directly. Instead, a simple macro ``CV_TURN_ON_IPL_COMPATIBILITY()`` is used that calls ``cvSetIPLAllocators`` and passes there pointers to IPL allocation functions. ::
......
project(opencv_ffmpeg)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
include_directories(
"${CMAKE_SOURCE_DIR}/3rdparty/include"
"${CMAKE_SOURCE_DIR}/3rdparty/include/ffmpeg_"
)
include_directories(
"${CMAKE_SOURCE_DIR}/modules/highgui/src"
"${CMAKE_SOURCE_DIR}/modules/core/include"
"${CMAKE_SOURCE_DIR}/modules/imgproc/include"
"${CMAKE_SOURCE_DIR}/modules/highgui/include"
)
link_directories("${CMAKE_SOURCE_DIR}/3rdparty/lib")
set(the_target opencv_ffmpeg)
add_library(${the_target} SHARED ffopencv.cpp ffopencv.h)
add_dependencies(${the_target} opencv_core)
target_link_libraries(${the_target} opencv_core)
if (NOT MSVC)
#target_link_libraries(${the_target}
# ${CMAKE_SOURCE_DIR}/3rdparty/lib/libgcc_.a
# ${CMAKE_SOURCE_DIR}/3rdparty/lib/libmingwex_.a)
if(WIN32 AND MINGW64)
target_link_libraries(${the_target} ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavformat64.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libavcodec64.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libavdevice64.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libavutil64.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libswscale64.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libavcore64.a
libws2_32.a)
else()
target_link_libraries(${the_target} ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavformat.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libavcodec.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libavutil.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libswscale.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libwsock32_.a)
endif()
endif ()
set_target_properties(${the_target} PROPERTIES
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
VERSION ${OPENCV_VERSION}
OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}"
DEFINE_SYMBOL "CVAPI_EXPORTS"
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
)
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "modules")
endif()
if (MSVC)
set_target_properties(${the_target} PROPERTIES
LINK_FLAGS "/NODEFAULTLIB:libc /DEBUG"
)
endif ()
install(TARGETS ${the_target}
RUNTIME DESTINATION bin COMPONENT main
ARCHIVE DESTINATION lib COMPONENT main
LIBRARY DESTINATION lib COMPONENT main
)
This diff is collapsed.
This diff is collapsed.
......@@ -82,6 +82,7 @@ source_group("Src\\grfmts" FILES ${grfmt_hdrs} ${grfmt_srcs})
set(highgui_srcs
src/cap.cpp
src/cap_images.cpp
src/cap_ffmpeg.cpp
src/loadsave.cpp
src/precomp.cpp
src/utils.cpp
......@@ -118,7 +119,7 @@ if(WIN32)
if(NOT HAVE_QT)
set(highgui_srcs ${highgui_srcs} src/window_w32.cpp)
endif()
set(highgui_srcs ${highgui_srcs} src/cap_vfw.cpp src/cap_cmu.cpp src/cap_w32.cpp src/cap_dshow.cpp)
set(highgui_srcs ${highgui_srcs} src/cap_vfw.cpp src/cap_cmu.cpp src/cap_dshow.cpp)
if(HAVE_MIL)
set(highgui_srcs ${highgui_srcs} src/cap_mil.cpp)
endif()
......@@ -144,7 +145,6 @@ if(UNIX)
endif()
if(HAVE_FFMPEG)
set(highgui_srcs ${highgui_srcs} src/cap_ffmpeg.cpp)
if(BZIP2_LIBRARIES)
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${BZIP2_LIBRARIES})
endif()
......
......@@ -283,15 +283,8 @@ CV_IMPL CvCapture * cvCreateFileCapture (const char * filename)
{
CvCapture * result = 0;
#ifdef WIN32
if (! result)
result = cvCreateFileCapture_Win32 (filename);
#endif
#ifdef HAVE_FFMPEG
if (! result)
result = cvCreateFileCapture_FFMPEG (filename);
#endif
result = cvCreateFileCapture_FFMPEG_proxy (filename);
#ifdef HAVE_XINE
if (! result)
......@@ -328,20 +321,14 @@ CV_IMPL CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc,
if(!fourcc || !fps)
result = cvCreateVideoWriter_Images(filename);
#ifdef WIN32
if(!result)
result = cvCreateVideoWriter_Win32(filename, fourcc, fps, frameSize, is_color);
#endif
result = cvCreateVideoWriter_FFMPEG_proxy (filename, fourcc, fps, frameSize, is_color);
/* #ifdef HAVE_XINE
if(!result)
result = cvCreateVideoWriter_XINE(filename, fourcc, fps, frameSize, is_color);
#endif
*/
#ifdef HAVE_FFMPEG
if(!result)
result = cvCreateVideoWriter_FFMPEG(filename, fourcc, fps, frameSize, is_color);
#endif
#ifdef HAVE_QUICKTIME
if(!result)
......
This diff is collapsed.
#ifndef __OPENCV_FFMPEG_H__
#define __OPENCV_FFMPEG_H__
#ifdef __cplusplus
extern "C"
{
#endif
#if defined WIN32 || defined _WIN32
#define OPENCV_FFMPEG_API __declspec(dllexport)
#else
#define OPENCV_FFMPEG_API
#endif
enum
{
CV_FFMPEG_CAP_PROP_POS_MSEC=0,
CV_FFMPEG_CAP_PROP_POS_FRAMES=1,
CV_FFMPEG_CAP_PROP_POS_AVI_RATIO=2,
CV_FFMPEG_CAP_PROP_FRAME_WIDTH=3,
CV_FFMPEG_CAP_PROP_FRAME_HEIGHT=4,
CV_FFMPEG_CAP_PROP_FPS=5,
CV_FFMPEG_CAP_PROP_FOURCC=6,
CV_FFMPEG_CAP_PROP_FRAME_COUNT=7
};
OPENCV_FFMPEG_API struct CvCapture_FFMPEG* cvCreateFileCapture_FFMPEG(const char* filename);
OPENCV_FFMPEG_API int cvSetCaptureProperty_FFMPEG(struct CvCapture_FFMPEG* cap,
int prop, double value);
OPENCV_FFMPEG_API double cvGetCaptureProperty_FFMPEG(struct CvCapture_FFMPEG* cap, int prop);
OPENCV_FFMPEG_API int cvGrabFrame_FFMPEG(struct CvCapture_FFMPEG* cap);
OPENCV_FFMPEG_API int cvRetrieveFrame_FFMPEG(CvCapture_FFMPEG* capture, unsigned char** data,
int* step, int* width, int* height, int* cn);
OPENCV_FFMPEG_API void cvReleaseCapture_FFMPEG(struct CvCapture_FFMPEG** cap);
OPENCV_FFMPEG_API struct CvVideoWriter_FFMPEG* cvCreateVideoWriter_FFMPEG(const char* filename,
int fourcc, double fps, int width, int height, int isColor );
OPENCV_FFMPEG_API int cvWriteFrame_FFMPEG(struct CvVideoWriter_FFMPEG* writer, const unsigned char* data,
int step, int width, int height, int cn, int origin);
OPENCV_FFMPEG_API void cvReleaseVideoWriter_FFMPEG(struct CvVideoWriter_FFMPEG** writer);
typedef void* (*CvCreateFileCapture_Plugin)( const char* filename );
typedef void* (*CvCreateCameraCapture_Plugin)( int index );
typedef int (*CvGrabFrame_Plugin)( void* capture_handle );
typedef int (*CvRetrieveFrame_Plugin)( void* capture_handle, unsigned char** data, int* step,
int* width, int* height, int* cn );
typedef int (*CvSetCaptureProperty_Plugin)( void* capture_handle, int prop_id, double value );
typedef double (*CvGetCaptureProperty_Plugin)( void* capture_handle, int prop_id );
typedef void (*CvReleaseCapture_Plugin)( void** capture_handle );
typedef void* (*CvCreateVideoWriter_Plugin)( const char* filename, int fourcc,
double fps, int width, int height, int iscolor );
typedef int (*CvWriteFrame_Plugin)( void* writer_handle, const unsigned char* data, int step,
int width, int height, int cn, int origin);
typedef void (*CvReleaseVideoWriter_Plugin)( void** writer );
#ifdef __cplusplus
}
#endif
#endif
This diff is collapsed.
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
extern "C"
{
typedef void* (*CvCreateFileCapture_Plugin)( const char* filename );
typedef void* (*CvCreateCameraCapture_Plugin)( int index );
typedef int (*CvGrabFrame_Plugin)( void* capture_handle );
typedef IplImage* (*CvRetrieveFrame_Plugin)( void* capture_handle, int );
typedef int (*CvSetCaptureProperty_Plugin)( void* capture_handle, int prop_id, double value );
typedef double (*CvGetCaptureProperty_Plugin)( void* capture_handle, int prop_id );
typedef void (*CvReleaseCapture_Plugin)( void** capture_handle );
typedef void* (*CvCreateVideoWriter_Plugin)( const char* filename, int fourcc,
double fps, CvSize frameSize, int isColor );
typedef int (*CvWriteFrame_Plugin)( void* writer_handle, const IplImage* frame );
typedef void (*CvReleaseVideoWriter_Plugin)( void** writer );
}
static HMODULE icvFFOpenCV = 0;
static CvCreateFileCapture_Plugin icvCreateFileCapture_FFMPEG_p = 0;
static CvReleaseCapture_Plugin icvReleaseCapture_FFMPEG_p = 0;
static CvGrabFrame_Plugin icvGrabFrame_FFMPEG_p = 0;
static CvRetrieveFrame_Plugin icvRetrieveFrame_FFMPEG_p = 0;
static CvSetCaptureProperty_Plugin icvSetCaptureProperty_FFMPEG_p = 0;
static CvGetCaptureProperty_Plugin icvGetCaptureProperty_FFMPEG_p = 0;
static CvCreateVideoWriter_Plugin icvCreateVideoWriter_FFMPEG_p = 0;
static CvReleaseVideoWriter_Plugin icvReleaseVideoWriter_FFMPEG_p = 0;
static CvWriteFrame_Plugin icvWriteFrame_FFMPEG_p = 0;
static void
icvInitFFMPEG(void)
{
static int ffmpegInitialized = 0;
if( !ffmpegInitialized )
{
#ifdef __MINGW32__
#define ffopencv_prefix "lib"
#else
#define ffopencv_prefix ""
#endif
#if defined(_DEBUG)
#define ffopencv_suffix_dbg "d"
#else
#define ffopencv_suffix_dbg ""
#endif
#if defined EM64T
#define ffopencv_suffix "_64"
#else
#define ffopencv_suffix ""
#endif
#define ffopencv_name_m2(a,b,c) ffopencv_prefix "opencv_ffmpeg" #a #b #c ffopencv_suffix ffopencv_suffix_dbg ".dll"
#define ffopencv_name_m(a,b,c) ffopencv_name_m2(a,b,c)
const char* ffopencv_name =
ffopencv_name_m(CV_MAJOR_VERSION,CV_MINOR_VERSION,CV_SUBMINOR_VERSION);
icvFFOpenCV = LoadLibrary( ffopencv_name );
if( icvFFOpenCV )
{
icvCreateFileCapture_FFMPEG_p =
(CvCreateFileCapture_Plugin)GetProcAddress(icvFFOpenCV, "cvCreateFileCapture_FFMPEG");
icvReleaseCapture_FFMPEG_p =
(CvReleaseCapture_Plugin)GetProcAddress(icvFFOpenCV, "cvReleaseCapture_FFMPEG");
icvGrabFrame_FFMPEG_p =
(CvGrabFrame_Plugin)GetProcAddress(icvFFOpenCV, "cvGrabFrame_FFMPEG");
icvRetrieveFrame_FFMPEG_p =
(CvRetrieveFrame_Plugin)GetProcAddress(icvFFOpenCV, "cvRetrieveFrame_FFMPEG");
icvSetCaptureProperty_FFMPEG_p =
(CvSetCaptureProperty_Plugin)GetProcAddress(icvFFOpenCV, "cvSetCaptureProperty_FFMPEG");
icvGetCaptureProperty_FFMPEG_p =
(CvGetCaptureProperty_Plugin)GetProcAddress(icvFFOpenCV, "cvGetCaptureProperty_FFMPEG");
icvCreateVideoWriter_FFMPEG_p =
(CvCreateVideoWriter_Plugin)GetProcAddress(icvFFOpenCV, "cvCreateVideoWriter_FFMPEG");
icvReleaseVideoWriter_FFMPEG_p =
(CvReleaseVideoWriter_Plugin)GetProcAddress(icvFFOpenCV, "cvReleaseVideoWriter_FFMPEG");
icvWriteFrame_FFMPEG_p =
(CvWriteFrame_Plugin)GetProcAddress(icvFFOpenCV, "cvWriteFrame_FFMPEG");
}
ffmpegInitialized = 1;
}
}
class CvCapture_FFMPEG_proxy : public CvCapture
{
public:
CvCapture_FFMPEG_proxy() { ffmpegCapture = 0; }
virtual ~CvCapture_FFMPEG_proxy() { close(); }
virtual double getProperty(int propId)
{
return ffmpegCapture ? icvGetCaptureProperty_FFMPEG_p(ffmpegCapture, propId) : 0;
}
virtual bool setProperty(int propId, double value)
{
return ffmpegCapture ? icvSetCaptureProperty_FFMPEG_p(ffmpegCapture, propId, value)!=0 : false;
}
virtual bool grabFrame()
{
return ffmpegCapture ? icvGrabFrame_FFMPEG_p(ffmpegCapture)!=0 : false;
}
virtual IplImage* retrieveFrame(int)
{
return ffmpegCapture ? icvRetrieveFrame_FFMPEG_p(ffmpegCapture,0) : 0;
}
virtual bool open( const char* filename )
{
close();
icvInitFFMPEG();
if( !icvCreateFileCapture_FFMPEG_p )
return false;
ffmpegCapture = icvCreateFileCapture_FFMPEG_p( filename );
return ffmpegCapture != 0;
}
virtual void close()
{
if( ffmpegCapture && icvReleaseCapture_FFMPEG_p )
icvReleaseCapture_FFMPEG_p( &ffmpegCapture );
assert( ffmpegCapture == 0 );
ffmpegCapture = 0;
}
protected:
void* ffmpegCapture;
};
CvCapture* cvCreateFileCapture_Win32(const char * filename)
{
CvCapture_FFMPEG_proxy* result = new CvCapture_FFMPEG_proxy;
if( result->open( filename ))
return result;
delete result;
return cvCreateFileCapture_VFW(filename);
}
class CvVideoWriter_FFMPEG_proxy : public CvVideoWriter
{
public:
CvVideoWriter_FFMPEG_proxy() { ffmpegWriter = 0; }
virtual ~CvVideoWriter_FFMPEG_proxy() { close(); }
virtual bool writeFrame( const IplImage* image )
{
return ffmpegWriter ? icvWriteFrame_FFMPEG_p(ffmpegWriter, image)!=0 : false;
}
virtual bool open( const char* filename, int fourcc, double fps, CvSize frameSize, bool isColor )
{
close();
icvInitFFMPEG();
if( !icvCreateVideoWriter_FFMPEG_p )
return false;
ffmpegWriter = icvCreateVideoWriter_FFMPEG_p( filename, fourcc, fps, frameSize, isColor );
return ffmpegWriter != 0;
}
virtual void close()
{
if( ffmpegWriter && icvReleaseVideoWriter_FFMPEG_p )
icvReleaseVideoWriter_FFMPEG_p( &ffmpegWriter );
assert( ffmpegWriter == 0 );
ffmpegWriter = 0;
}
protected:
void* ffmpegWriter;
};
CvVideoWriter* cvCreateVideoWriter_Win32( const char* filename, int fourcc,
double fps, CvSize frameSize, int isColor )
{
CvVideoWriter_FFMPEG_proxy* result = new CvVideoWriter_FFMPEG_proxy;
if( result->open( filename, fourcc, fps, frameSize, isColor != 0 ))
return result;
delete result;
return cvCreateVideoWriter_VFW(filename, fourcc, fps, frameSize, isColor);
}
......@@ -147,11 +147,11 @@ CvCapture* cvCreateFileCapture_XINE (const char* filename);
#define CV_CAP_GSTREAMER_V4L2 2
#define CV_CAP_GSTREAMER_FILE 3
CvCapture * cvCreateCapture_GStreamer(int type, const char *filename);
CVAPI(CvCapture*) cvCreateFileCapture_FFMPEG (const char* filename);
CvCapture* cvCreateCapture_GStreamer(int type, const char *filename);
CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char* filename);
CVAPI(CvVideoWriter*) cvCreateVideoWriter_FFMPEG ( const char* filename, int fourcc,
CvVideoWriter* cvCreateVideoWriter_FFMPEG_proxy( const char* filename, int fourcc,
double fps, CvSize frameSize, int is_color );
CvCapture * cvCreateFileCapture_QT (const char * filename);
......
This diff is collapsed.
This diff is collapsed.
......@@ -462,7 +462,7 @@ gives more accurate results). For ``a``,``b`` , and ``c`` , OpenCV uses the valu
``CV_DIST_L2`` :math:`(5\times 5)` a=1, b=1.4, c=2.1969 \
============== =================== ======================
Typically, for a fast, coarse distance estimation ``CV_DIST_L2``,a
Typically, for a fast, coarse distance estimation ``CV_DIST_L2``, a
:math:`3\times 3` mask is used. For a more accurate distance estimation ``CV_DIST_L2`` , a
:math:`5\times 5` mask or the precise algorithm is used.
Note that both the precise and the approximate algorithms are linear on the number of pixels.
......@@ -498,7 +498,9 @@ Fills a connected component with the given color.
:param mask: (For the second function only) Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of initializing the ``mask`` content. Flood-filling cannot go across non-zero pixels in the mask. For example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area does not overlap.
**Note** : Since the mask is larger than the filled image, a pixel :math:`(x, y)` in ``image`` corresponds to the pixel :math:`(x+1, y+1)` in the ``mask`` .
.. note::
Since the mask is larger than the filled image, a pixel :math:`(x, y)` in ``image`` corresponds to the pixel :math:`(x+1, y+1)` in the ``mask`` .
:param seed: Starting point.
:param newVal: New value of the repainted domain pixels.
......@@ -780,7 +782,7 @@ should be set to 0's. In the function output, each pixel in
markers is set to a value of the "seed" components or to -1 at
boundaries between the regions.
**Note**: Every two neighbor connected
.. note:: Every two neighbor connected
components are not necessarily separated by a watershed boundary (-1's pixels); for
example, when such tangent components exist in the initial
marker image. Visual demonstration and usage example of the function
......
......@@ -252,7 +252,7 @@ Returns the location of a point within a Delaunay triangulation.
:param pt: Point to locate.
:param edge: Output edge the point falls onto or right to.
:param edge: Output edge that the point belongs to or is located to the right of it.
:param vertex: Optional output vertex double pointer the input point coinsides with.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment