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.
This commit is contained in:
Luis de Bethencourt 2015-09-29 17:00:22 +01:00
parent 40a63d27d8
commit 9bb76699e0

View file

@ -261,8 +261,17 @@ gst_handdetect_class_init (GstHanddetectClass * klass)
static void static void
gst_handdetect_init (GstHanddetect * filter) gst_handdetect_init (GstHanddetect * filter)
{ {
filter->profile_fist = g_strdup (HAAR_FILE_FIST); const gchar *haar_path;
filter->profile_palm = g_strdup (HAAR_FILE_PALM);
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_x = 0;
filter->roi_y = 0; filter->roi_y = 0;
filter->roi_width = 0; filter->roi_width = 0;