Ask Your Question
1

Opencv 3.0.0 build winder Windows 8 with Gstreamer1.0 support

asked 2015-06-28 16:01:40 -0600

afanasjev gravatar image

Hello!

I'm trying to build application which uses gstreamer as videoinput; GStreamer 1.0 support is included in opencv 3.0.0. Im using smake to build sources for Visual Studio 2013 compiler... but cmake could not generate sources wirh GStreamer 1.0 support properly:

Video I/O:

Video for Windows:           YES
DC1394 1.x:                  NO
DC1394 2.x:                  NO
FFMPEG:                      YES (prebuilt binaries)
  codec:                     YES (ver 55.18.102)
  format:                    YES (ver 55.12.100)
  util:                      YES (ver 52.38.100)
  swscale:                   YES (ver 2.3.100)
  resample:                  NO
  gentoo-style:              YES
**GStreamer:                   NO**
OpenNI:                      NO
OpenNI PrimeSensor Modules:  NO
OpenNI2:                     NO
PvAPI:                       NO
GigEVisionSDK:               NO
DirectShow:                  YES
Media Foundation:            NO
XIMEA:                       NO
Intel PerC:                  NO

In CmakeLists.txt the following line exists:

OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT ANDROID) )

so gStreamer1.0 is supported only under UNIX. Why? if I simply remove windows from "blacklist" cmake will not find gstreamer libs. But I have gstreamer1.0 and gstreamer1.0-dev packages installed.

Is there any way to build OpenCV with Gstreamer1.0 support under Windows? Maybe is there any way to grab opencv from gstreamer pipline? OpenCV with Gstreamer1.0 support has current functionality out-of-the-box by useinf

cv::VideoCapture cap("videotestsrc ! videconvert ! appsink")

Why OpenCV prebuilt binaries for Windows does not have GStreamer support! Please help!

edit retag flag offensive close merge delete

Comments

Hello, I'm running into the same problem and it looks like no one bothered to make scripts for finding gstreamer. I'm currently working on editing OpenCVFindLibsVideo.cmake to find gstreamer properly on windows. I wanted to check if you came to the same conclusion and thus have already done this.

dtmoodie gravatar imagedtmoodie ( 2015-08-08 11:03:12 -0600 )edit
1

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()

Armin gravatar imageArmin ( 2015-08-28 13:06:51 -0600 )edit

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()

Armin gravatar imageArmin ( 2015-08-28 13:09:50 -0600 )edit

May be you can have a look in cmake gui and give path in GIGEAPI

LBerger gravatar imageLBerger ( 2015-08-28 13:54:38 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-08-28 13:37:38 -0600

Armin gravatar image

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

edit flag offensive delete link more

Comments

i can't understand where i shoud enter part

if defined(WIN32)
define strcasecmp _stricmp
define strncasecmp _strnicmp
endif

...
if defined(WIN32)

_fullpath(uri, filename, _MAX_PATH);
else

uri = realpath(filename, NULL);
endif

and after using cmake there is an error: cant find pkgconifg

blacksailer gravatar imageblacksailer ( 2015-12-10 03:10:49 -0600 )edit

@blacksailer & @afanasjev i did all things but in build step have error about find libs and gst/gst.h can you give me some advice?

sabra gravatar imagesabra ( 2017-07-04 02:09:25 -0600 )edit

@Armin Hi , did you able to capture from camera using Gstreamer in Opencv?

DarkKnight gravatar imageDarkKnight ( 2018-11-27 23:39:45 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-06-28 16:01:40 -0600

Seen: 4,008 times

Last updated: Aug 28 '15