templatematch: Produce a warning message if we can't load a template image

This commit is contained in:
William Manley 2012-06-25 20:37:01 +01:00 committed by Thiago Santos
parent 88cb33a1dc
commit 1b5483eef9

View file

@ -63,6 +63,7 @@
#include <gst/gst.h>
#include "../../gst-libs/gst/gst-i18n-plugin.h"
#include "gstopencvutils.h"
#include "gsttemplatematch.h"
@ -432,8 +433,13 @@ gst_template_match_load_template (GstTemplateMatch * filter, gchar * template)
if (template) {
newTemplateImage = cvLoadImage (template, CV_LOAD_IMAGE_COLOR);
if (!newTemplateImage) {
GST_WARNING ("Couldn't load template image: %s. error: %s",
template, g_strerror (errno));
/* Unfortunately OpenCV doesn't seem to provide any way of finding out
why the image load failed, so we can't be more specific than FAILED: */
GST_ELEMENT_WARNING (filter, RESOURCE, FAILED,
(_("OpenCV failed to load template image")),
("While attempting to load template '%s'", template));
g_free (template);
template = NULL;
}
}