opencv: use pkgdatadir locally to construct path for custom haar cascades

https://bugzilla.gnome.org/show_bug.cgi?id=685655
This commit is contained in:
Tim-Philipp Müller 2013-03-01 00:10:46 +00:00
parent 757e7c25bf
commit dec865b2ff
3 changed files with 13 additions and 14 deletions

View file

@ -33,10 +33,6 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
[AM_DEFAULT_VERBOSITY=1
AC_SUBST(AM_DEFAULT_VERBOSITY)])
dnl define GST_DATADIR
AS_AC_EXPAND(DATADIR, $datadir)
AC_DEFINE_UNQUOTED(GST_DATADIR, "$DATADIR", [data dir])
dnl our libraries and install dirs use GST_API_VERSION in the filename
dnl to allow side-by-side installation of different API versions
GST_API_VERSION=1.0

View file

@ -30,7 +30,9 @@ libgstopencv_la_CXXFLAGS = $(GST_CXXFLAGS) $(OPENCV_CFLAGS)
# override CV_INLINE: GLib will take care of defining 'inline' sufficiently and
# OpenCV's define isn't good enough to avoid 'unused' gcc warnings (at v2.1.0)
libgstopencv_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(OPENCV_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) -DCV_INLINE="static inline" \
$(GST_PLUGINS_BASE_CFLAGS) \
-DGST_HAAR_CASCADES_DIR=\"$(pkgdatadir)/@GST_API_VERSION@/opencv_haarcascades\" \
-DCV_INLINE="static inline" \
-DCV_NO_BACKWARD_COMPATIBILITY
libgstopencv_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(OPENCV_LIBS) \
@ -59,7 +61,7 @@ noinst_HEADERS = gstopencvvideofilter.h gstopencvutils.h \
motioncells_wrapper.h \
MotionCells.h
opencv_haarcascadesdir = $(datadir)/gstreamer-$(GST_API_VERSION)/opencv_haarcascades
opencv_haarcascadesdir = $(pkgdatadir)/$(GST_API_VERSION)/opencv_haarcascades
opencv_haarcascades_DATA = fist.xml palm.xml
EXTRA_DIST = $(opencv_haarcascades_DATA)

View file

@ -50,8 +50,8 @@
* <refsect2>
* <title>Example launch line</title>
* |[
* gst-launch autovideosrc ! videoconvert ! "video/x-raw, formt=RGB, width=320, height=240" ! \
videoscale ! handdetect ! videoconvert ! xvimagesink
* gst-launch-1.0 autovideosrc ! videoconvert ! "video/x-raw, formt=RGB, width=320, height=240" ! \
* videoscale ! handdetect ! videoconvert ! xvimagesink
* ]|
* </refsect2>
*/
@ -68,9 +68,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_handdetect_debug);
#define GST_CAT_DEFAULT gst_handdetect_debug
/* define HAAR files */
#define HAAR_CASCADES_DIR GST_DATADIR "/gstreamer-"GST_API_VERSION"/opencv_haarcascades/"
#define HAAR_FILE_FIST HAAR_CASCADES_DIR "fist.xml"
#define HAAR_FILE_PALM HAAR_CASCADES_DIR "palm.xml"
#define HAAR_FILE_FIST GST_HAAR_CASCADES_DIR G_DIR_SEPARATOR_S "fist.xml"
#define HAAR_FILE_PALM GST_HAAR_CASCADES_DIR G_DIR_SEPARATOR_S "palm.xml"
/* Filter signals and args */
enum
@ -206,6 +205,7 @@ gst_handdetect_class_init (GstHanddetectClass * klass)
"Location of HAAR cascade file (palm gesture)",
HAAR_FILE_PALM, G_PARAM_READWRITE)
);
/* FIXME: property name needs fixing */
g_object_class_install_property (gobject_class,
PROP_ROI_X,
g_param_spec_uint ("ROI_X",
@ -213,6 +213,7 @@ gst_handdetect_class_init (GstHanddetectClass * klass)
"X of left-top pointer in region of interest \nGestures in the defined region of interest will emit messages",
0, UINT_MAX, 0, G_PARAM_READWRITE)
);
/* FIXME: property name needs fixing */
g_object_class_install_property (gobject_class,
PROP_ROI_Y,
g_param_spec_uint ("ROI_Y",
@ -220,6 +221,7 @@ gst_handdetect_class_init (GstHanddetectClass * klass)
"Y of left-top pointer in region of interest \nGestures in the defined region of interest will emit messages",
0, UINT_MAX, 0, G_PARAM_READWRITE)
);
/* FIXME: property name needs fixing */
g_object_class_install_property (gobject_class,
PROP_ROI_WIDTH,
g_param_spec_uint ("ROI_WIDTH",
@ -227,6 +229,7 @@ gst_handdetect_class_init (GstHanddetectClass * klass)
"WIDTH of left-top pointer in region of interest \nGestures in the defined region of interest will emit messages",
0, UINT_MAX, 0, G_PARAM_READWRITE)
);
/* FIXME: property name needs fixing */
g_object_class_install_property (gobject_class,
PROP_ROI_HEIGHT,
g_param_spec_uint ("ROI_HEIGHT",
@ -642,9 +645,7 @@ gboolean
gst_handdetect_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_handdetect_debug,
"handdetect",
0,
"Performs hand gesture detection (fist and palm), providing detected hand positions via bus messages/navigation events, and dealing with hand events");
"handdetect", 0, "opencv hand gesture detection");
return gst_element_register (plugin, "handdetect", GST_RANK_NONE,
GST_TYPE_HANDDETECT);
}