Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think I solved it.
Download pkg-config-lite-0.28-1_bin-win32
Add following system paths

C:\Program Files (x86)\pkg-config-lite-0.28-1\bin
C:\Gstreamer\1.0\x86_64\lib\gstreamer-1.0
C:\Gstreamer\1.0\x86_64\lib

Add Environment Variable
PKG_CONFIG_PATH C:\Gstreamer\1.0\x86_64\lib\pkgconfig

Edit opencv\sources\CMakeLists.txt
...
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (WIN32 OR UNIX AND NOT ANDROID) )
...

----------------------------------------------------------------------------

CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..

----------------------------------------------------------------------------

...
if(WIN32)
find_package(PKGConfig QUIET)
include(CheckFunctionExists)
include(CheckIncludeFile)
endif()

Edit opencv\sources\modules\highgui\CMakeLists.txt
...
if(UNIX)
#these variables are set by CHECK_MODULE macro
foreach(P ${HIGHGUI_INCLUDE_DIRS})
ocv_include_directories(${P})
endforeach()

foreach(P ${HIGHGUI_LIBRARY_DIRS})
link_directories(${P})
endforeach()
endif()

if(WIN32 AND HAVE_GSTREAMER)
#these variables are set by CHECK_MODULE macro
foreach(P ${HIGHGUI_INCLUDE_DIRS})
ocv_include_directories(${P})
endforeach()

foreach(P ${HIGHGUI_LIBRARY_DIRS})
link_directories(${P})
endforeach()
endif()

Edit opencv\sources\modules\videoio\CMakeLists.txt
if(UNIX)
#these variables are set by CHECK_MODULE macro
foreach(P ${VIDEOIO_INCLUDE_DIRS})
ocv_include_directories(${P})
endforeach()

foreach(P ${VIDEOIO_LIBRARY_DIRS})
link_directories(${P})
endforeach()
endif()

if(WIN32 AND HAVE_GSTREAMER)
#these variables are set by CHECK_MODULE macro
foreach(P ${VIDEOIO_INCLUDE_DIRS})
ocv_include_directories(${P})
endforeach()

foreach(P ${VIDEOIO_LIBRARY_DIRS})
link_directories(${P})
endforeach()
endif()

And edit cap_gstreamer.cpp in modules/videoio
...

if defined(WIN32)

include <stdlib.h>

else

include <unistd.h>

endif


...

define VERSION_NUM(major, minor, micro) (major * 1000000 + minor * 1000 + micro)

define FULL_GST_VERSION VERSION_NUM(GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO)


if defined(WIN32)

define strcasecmp _stricmp

define strncasecmp _strnicmp

endif

...

if defined(WIN32)

_fullpath(uri, filename, _MAX_PATH);

else

uri = realpath(filename, NULL);

endif

Worked for me