From 9bb76699e04cd612ae8ef3d7e2b8e9918d1778f7 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Tue, 29 Sep 2015 17:00:22 +0100 Subject: [PATCH] handdetect: check for haar cascade files path When running GStreamer from uninstalled sources, the location of the haar cascade files will be local. Check if running in uninstalled and set the file paths accordingly. --- ext/opencv/gsthanddetect.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ext/opencv/gsthanddetect.c b/ext/opencv/gsthanddetect.c index c4dd390..86fb881 100644 --- a/ext/opencv/gsthanddetect.c +++ b/ext/opencv/gsthanddetect.c @@ -261,8 +261,17 @@ gst_handdetect_class_init (GstHanddetectClass * klass) static void gst_handdetect_init (GstHanddetect * filter) { - filter->profile_fist = g_strdup (HAAR_FILE_FIST); - filter->profile_palm = g_strdup (HAAR_FILE_PALM); + const gchar *haar_path; + + haar_path = g_getenv ("GST_HAAR_CASCADES_PATH"); + if (haar_path) { + filter->profile_fist = g_build_filename (haar_path, "fist.xml", NULL); + filter->profile_palm = g_build_filename (haar_path, "palm.xml", NULL); + } else { + filter->profile_fist = g_strdup (HAAR_FILE_FIST); + filter->profile_palm = g_strdup (HAAR_FILE_PALM); + } + filter->roi_x = 0; filter->roi_y = 0; filter->roi_width = 0; -- 2.7.4