2018-12-17 18:58:52 +00:00
|
|
|
if get_option('opencv').disabled()
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
2016-11-28 20:11:28 +00:00
|
|
|
gstopencv_sources = [
|
2016-11-15 16:57:20 +00:00
|
|
|
'gstcvdilate.cpp',
|
|
|
|
'gstcvdilateerode.cpp',
|
|
|
|
'gstcvequalizehist.cpp',
|
|
|
|
'gstcverode.cpp',
|
|
|
|
'gstcvlaplace.cpp',
|
|
|
|
'gstcvsmooth.cpp',
|
|
|
|
'gstcvsobel.cpp',
|
|
|
|
'gstdisparity.cpp',
|
|
|
|
'gstedgedetect.cpp',
|
|
|
|
'gstfaceblur.cpp',
|
|
|
|
'gstfacedetect.cpp',
|
|
|
|
'gstgrabcut.cpp',
|
|
|
|
'gsthanddetect.cpp',
|
|
|
|
'gstmotioncells.cpp',
|
|
|
|
'gstopencv.cpp',
|
|
|
|
'gstretinex.cpp',
|
|
|
|
'gstsegmentation.cpp',
|
|
|
|
'gstskindetect.cpp',
|
|
|
|
'gsttemplatematch.cpp',
|
|
|
|
'gsttextoverlay.cpp',
|
|
|
|
'MotionCells.cpp',
|
2016-12-14 09:37:14 +00:00
|
|
|
'motioncells_wrapper.cpp',
|
2017-10-16 20:29:01 +00:00
|
|
|
'gstdewarp.cpp',
|
|
|
|
'camerautils.cpp',
|
|
|
|
'cameraevent.cpp',
|
|
|
|
'gstcameracalibrate.cpp',
|
|
|
|
'gstcameraundistort.cpp'
|
2016-11-15 16:57:20 +00:00
|
|
|
]
|
|
|
|
|
2018-08-02 14:39:14 +00:00
|
|
|
libopencv_headers = [
|
2016-12-02 03:02:51 +00:00
|
|
|
'opencv2/bgsegm.hpp',
|
2018-08-02 15:19:07 +00:00
|
|
|
'opencv2/calib3d.hpp',
|
|
|
|
'opencv2/core.hpp',
|
|
|
|
'opencv2/imgproc.hpp',
|
|
|
|
'opencv2/objdetect.hpp',
|
|
|
|
'opencv2/opencv.hpp',
|
|
|
|
'opencv2/video.hpp',
|
2016-11-28 20:11:28 +00:00
|
|
|
]
|
|
|
|
|
2018-11-25 15:13:28 +00:00
|
|
|
libopencv4_headers = [
|
|
|
|
'opencv4/opencv2/bgsegm.hpp',
|
|
|
|
'opencv4/opencv2/calib3d.hpp',
|
|
|
|
'opencv4/opencv2/core.hpp',
|
|
|
|
'opencv4/opencv2/imgproc.hpp',
|
|
|
|
'opencv4/opencv2/objdetect.hpp',
|
|
|
|
'opencv4/opencv2/opencv.hpp',
|
|
|
|
'opencv4/opencv2/video.hpp',
|
|
|
|
]
|
|
|
|
|
2016-11-28 20:11:28 +00:00
|
|
|
gstopencv_cargs = ['-DGST_HAAR_CASCADES_DIR="@0@"']
|
2016-11-15 16:57:20 +00:00
|
|
|
|
2018-08-02 14:39:14 +00:00
|
|
|
opencv_dep = dependency('opencv', version : ['>= 3.0.0', '< 3.5.0'], required : false)
|
2017-05-09 19:06:52 +00:00
|
|
|
opencv_found = opencv_dep.found()
|
2016-11-28 20:11:28 +00:00
|
|
|
|
2017-05-09 19:06:52 +00:00
|
|
|
if opencv_found
|
2018-08-02 14:39:14 +00:00
|
|
|
foreach h : libopencv_headers
|
2016-11-28 20:11:28 +00:00
|
|
|
if not cxx.has_header(h)
|
|
|
|
message('Needed header "' + h + '" not found')
|
2017-05-09 17:16:50 +00:00
|
|
|
opencv_found = false
|
2016-11-28 20:11:28 +00:00
|
|
|
endif
|
|
|
|
endforeach
|
2018-11-25 15:13:28 +00:00
|
|
|
else
|
2019-12-26 21:43:35 +00:00
|
|
|
opencv_dep = dependency('opencv4', version : ['>= 4.0.0', '< 4.3.0'], required : false)
|
2018-11-25 15:13:28 +00:00
|
|
|
opencv_found = opencv_dep.found()
|
|
|
|
if opencv_found
|
|
|
|
foreach h : libopencv4_headers
|
|
|
|
if not cxx.has_header(h)
|
|
|
|
message('Needed header "' + h + '" not found')
|
|
|
|
opencv_found = false
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
endif
|
2016-11-15 16:57:20 +00:00
|
|
|
endif
|
|
|
|
|
2017-05-09 17:16:50 +00:00
|
|
|
if opencv_found
|
|
|
|
opencv_prefix = opencv_dep.get_pkgconfig_variable('prefix')
|
|
|
|
gstopencv_cargs += ['-DOPENCV_PREFIX="' + opencv_prefix + '"']
|
2016-11-28 20:11:28 +00:00
|
|
|
|
|
|
|
# Check the data dir used by opencv for its xml data files
|
|
|
|
# Use prefix from pkg-config to be compatible with cross-compilation
|
2017-05-09 17:16:50 +00:00
|
|
|
r = run_command('test', '-d', opencv_prefix + '/share/opencv')
|
2016-11-28 20:11:28 +00:00
|
|
|
if r.returncode() == 0
|
|
|
|
gstopencv_cargs += '-DOPENCV_PATH_NAME="opencv"'
|
|
|
|
else
|
2017-05-09 17:16:50 +00:00
|
|
|
r = run_command('test', '-d', opencv_prefix + '/share/OpenCV')
|
2016-11-28 20:11:28 +00:00
|
|
|
if r.returncode() == 0
|
2018-02-06 10:36:27 +00:00
|
|
|
gstopencv_cargs += '-DOPENCV_PATH_NAME="OpenCV"'
|
2016-11-28 20:11:28 +00:00
|
|
|
else
|
2018-11-25 15:13:28 +00:00
|
|
|
r = run_command('test', '-d', opencv_prefix + '/share/opencv4')
|
|
|
|
if r.returncode() == 0
|
|
|
|
gstopencv_cargs += '-DOPENCV_PATH_NAME="opencv4"'
|
|
|
|
else
|
2019-10-24 13:40:25 +00:00
|
|
|
message('Unable to detect OpenCV data directory')
|
|
|
|
opencv_found = false
|
2018-11-25 15:13:28 +00:00
|
|
|
endif
|
2016-11-28 20:11:28 +00:00
|
|
|
endif
|
|
|
|
endif
|
2019-10-24 13:40:25 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if opencv_found
|
2016-11-15 16:57:20 +00:00
|
|
|
gstopencv = library('gstopencv',
|
2016-11-28 20:11:28 +00:00
|
|
|
gstopencv_sources,
|
|
|
|
cpp_args : gst_plugins_bad_args + gstopencv_cargs + [ '-DGST_USE_UNSTABLE_API' ],
|
2016-11-15 16:57:20 +00:00
|
|
|
link_args : noseh_link_args,
|
2018-12-17 10:30:27 +00:00
|
|
|
include_directories : [configinc, libsinc],
|
2017-05-09 17:16:50 +00:00
|
|
|
dependencies : [gstbase_dep, gstvideo_dep, opencv_dep, gstopencv_dep],
|
2016-11-15 16:57:20 +00:00
|
|
|
install : true,
|
|
|
|
install_dir : plugins_install_dir,
|
|
|
|
)
|
2018-04-24 18:05:30 +00:00
|
|
|
pkgconfig.generate(gstopencv, install_dir : plugins_pkgconfig_install_dir)
|
2018-10-22 09:30:45 +00:00
|
|
|
plugins += [gstopencv]
|
2018-12-17 18:58:52 +00:00
|
|
|
elif get_option('opencv').enabled()
|
|
|
|
error('OpenCV support enabled but required dependencies were not found.')
|
2016-11-15 16:57:20 +00:00
|
|
|
endif
|