Skip to content

Commit a442f0b

Browse files
c-trejosCarlos Rodriguez
authored and
Carlos Rodriguez
committed
Merge branch 'dev-0.7'
2 parents 7d64646 + 1b836bc commit a442f0b

File tree

96 files changed

+5604
-926
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+5604
-926
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ m4/
2626
.libs/
2727
stamp-h*
2828
autoregen.sh
29-
gstinference-*.pc
29+
gst-inference-*.pc
3030

3131
# Build outputs
3232
.deps/

COPYING

-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
GstInference copyright (C) 2019 RidgeRun LLC
2-
3-
This GStreamer plug-in is free software; you can redistribute it
4-
and/or modify it under the terms of the GNU Lesser General Public
5-
License version 2.1 as published by the Free Software Foundation.
6-
7-
This GStreamer plug-in is distributed in the hope that it will be
8-
useful, but WITHOUT ANY WARRANTY; without even the implied
9-
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10-
See the GNU Lesser General Public License below for more details.
11-
12-
----------------------------------------------------------------------
13-
141
GNU LESSER GENERAL PUBLIC LICENSE
152
Version 2.1, February 1999
163

Makefile.am

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
22

33
ALWAYS_SUBDIRS = \
44
gst-libs \
5+
gst \
56
ext \
67
tests \
78
common \
@@ -54,3 +55,8 @@ CRUFT_DIRS =
5455
include $(top_srcdir)/common/cruft.mak
5556

5657
all-local: check-cruft
58+
59+
pkgconfigdir = $(libdir)/pkgconfig
60+
pkgconfig_DATA = gst-inference-@[email protected]
61+
62+
EXTRA_DIST = gst-inference.pc.in

configure.ac

+12-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dnl please read gstreamer/docs/random/autotools before changing this file
55
dnl initialize autoconf
66
dnl releases only do -Wall, git and prerelease does -Werror too
77
dnl use a three digit version number for releases, and four for git/pre
8-
AC_INIT([GStreamer Inference],[0.6.1.1],[https://github.com/RidgeRun/gst-inference/issues],[gst-inference])
8+
AC_INIT([GStreamer Inference],[0.7.0.1],[https://github.com/RidgeRun/gst-inference/issues],[gst-inference])
99

1010
AG_GST_INIT
1111

@@ -20,7 +20,6 @@ AS_NANO(GST_GIT="no", GST_GIT="yes")
2020

2121
dnl can autoconf find the source ?
2222
AC_CONFIG_SRCDIR([ext/r2inference/gstinference.c])
23-
AC_CONFIG_SRCDIR([ext/opencv/gstinferenceoverlay.c])
2423

2524
dnl define the output header for config
2625
AC_CONFIG_HEADERS([config.h])
@@ -195,7 +194,7 @@ AC_ARG_ENABLE(Bsymbolic,
195194
dnl *** set variables based on configure arguments ***
196195

197196
dnl set license and copyright notice
198-
GST_LICENSE="Proprietary"
197+
GST_LICENSE="LGPL"
199198
AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer Inference license])
200199
AC_SUBST(GST_LICENSE)
201200

@@ -289,8 +288,9 @@ if test "$USE_OPENCV" = "yes"; then
289288
fi
290289

291290
dnl *** r2inference ***
291+
R2INFERENCE_REQ=0.4.0
292292
AG_GST_CHECK_FEATURE(R2INFERENCE, [RidgeRun\'s Inference Framework], r2inference, [
293-
AG_GST_PKG_CHECK_MODULES(R2INFERENCE, r2inference-0.0)
293+
AG_GST_PKG_CHECK_MODULES(R2INFERENCE, r2inference-0.0 >= $R2INFERENCE_REQ)
294294
],[],[],[
295295
AC_MSG_ERROR([Please install R2Inference from https://github.com/RidgeRun/r2inference.git])
296296
])
@@ -367,6 +367,9 @@ AC_SUBST(GST_PLUGIN_LDFLAGS)
367367

368368
dnl *** output files ***
369369

370+
# Our Include path, to be shared in multiple makefiles
371+
AC_SUBST([GSTINCLUDEDIR],[$includedir/gstreamer-1.0])
372+
370373
dnl keep this alphabetic per directory, please
371374
AC_CONFIG_FILES(
372375
Makefile
@@ -378,12 +381,17 @@ docs/version.entities
378381
ext/Makefile
379382
ext/opencv/Makefile
380383
ext/r2inference/Makefile
384+
gst/Makefile
385+
gst/inferencecrop/Makefile
386+
gst/inferencefilter/Makefile
387+
gst/inferencedebug/Makefile
381388
gst-libs/Makefile
382389
gst-libs/gst/Makefile
383390
gst-libs/gst/opencv/Makefile
384391
gst-libs/gst/r2inference/Makefile
385392
m4/Makefile
386393
tests/check/Makefile
394+
gst-inference-${GST_API_VERSION}.pc:gst-inference.pc.in
387395
tests/Makefile
388396
tests/examples/classification/Makefile
389397
tests/examples/detection/Makefile
@@ -394,4 +402,3 @@ tests/files/Makefile
394402
AC_OUTPUT
395403

396404
AG_GST_OUTPUT_PLUGINS
397-

ext/opencv/Makefile.am

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
plugin_LTLIBRARIES = libgstinferenceoverlay.la
1+
plugin_LTLIBRARIES = libgstinferenceoverlayplugin.la
22

3-
libgstinferenceoverlay_la_SOURCES = \
3+
libgstinferenceoverlayplugin_la_SOURCES = \
44
gstclassificationoverlay.cc \
55
gstdetectionoverlay.cc \
6-
gstinferenceoverlay.c \
6+
gstplugin.cc \
7+
gstinferenceoverlay.cc \
78
gstembeddingoverlay.cc
89

9-
libgstinferenceoverlay_la_CFLAGS = \
10+
libgstinferenceoverlayplugin_la_CFLAGS = \
1011
$(GST_CFLAGS) \
1112
$(GST_BASE_CFLAGS) \
1213
$(GST_PLUGINS_BASE_CFLAGS) \
@@ -15,7 +16,7 @@ libgstinferenceoverlay_la_CFLAGS = \
1516
-I$(top_srcdir)/gst-libs
1617

1718

18-
libgstinferenceoverlay_la_CXXFLAGS = \
19+
libgstinferenceoverlayplugin_la_CXXFLAGS = \
1920
$(GST_CXXFLAGS) \
2021
$(GST_BASE_CFLAGS) \
2122
$(GST_PLUGINS_BASE_CFLAGS) \
@@ -25,23 +26,24 @@ libgstinferenceoverlay_la_CXXFLAGS = \
2526
-std=c++11
2627

2728

28-
libgstinferenceoverlay_la_LIBADD = \
29+
libgstinferenceoverlayplugin_la_LIBADD = \
2930
$(GST_LIBS) \
3031
$(GST_BASE_LIBS) \
3132
$(GST_PLUGINS_BASE_LIBS) \
3233
$(GST_VIDEO_LIBS) \
3334
$(OPENCV_LIBS) \
3435
$(R2INFERENCE_LIBS) \
3536
$(top_builddir)/gst-libs/gst/r2inference/libgstinference-@[email protected] \
36-
$(top_builddir)/gst-libs/gst/opencv/libgstinferenceoverlay-@[email protected]
37+
$(top_builddir)/gst-libs/gst/opencv/libgstinferencebaseoverlay-@[email protected]
3738

38-
libgstinferenceoverlay_la_LDFLAGS = \
39+
libgstinferenceoverlayplugin_la_LDFLAGS = \
3940
$(GST_PLUGIN_LDFLAGS)
4041

41-
libgstinferenceoverlay_la_LIBTOOLFLAGS = \
42+
libgstinferenceoverlayplugin_la_LIBTOOLFLAGS = \
4243
$(GST_PLUGIN_LIBTOOLFLAGS)
4344

4445
noinst_HEADERS = \
4546
gstclassificationoverlay.h \
4647
gstdetectionoverlay.h \
48+
gstinferenceoverlay.h \
4749
gstembeddingoverlay.h
+23-37
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* GStreamer
3-
* Copyright (C) 2018 RidgeRun
3+
* Copyright (C) 2018-2020 RidgeRun <[email protected]>
44
*
55
* This library is free software; you can redistribute it and/or
66
* modify it under the terms of the GNU Library General Public
@@ -18,30 +18,28 @@
1818
* Boston, MA 02111-1307, USA.
1919
*
2020
*/
21+
2122
#ifdef HAVE_CONFIG_H
2223
#include "config.h"
2324
#endif
2425

2526
#include "gstclassificationoverlay.h"
2627
#include "gst/r2inference/gstinferencemeta.h"
27-
#ifdef OCV_VERSION_LT_3_2
28-
#include "opencv2/highgui/highgui.hpp"
29-
#else
30-
#include "opencv2/imgproc.hpp"
31-
#include "opencv2/highgui.hpp"
32-
#endif
3328

29+
/* *INDENT-OFF* */
3430
static const cv::Scalar black = cv::Scalar (0, 0, 0, 0);
3531
static const cv::Scalar white = cv::Scalar (255, 255, 255, 255);
32+
/* *INDENT-ON* */
3633

3734
GST_DEBUG_CATEGORY_STATIC (gst_classification_overlay_debug_category);
3835
#define GST_CAT_DEFAULT gst_classification_overlay_debug_category
3936

4037
/* prototypes */
4138
static GstFlowReturn
42-
gst_classification_overlay_process_meta (GstInferenceOverlay *
43-
inference_overlay, GstVideoFrame * frame, GstMeta * meta,
44-
gdouble font_scale, gint thickness, gchar ** labels_list, gint num_labels);
39+
gst_classification_overlay_process_meta (GstInferenceBaseOverlay *
40+
inference_overlay, cv::Mat & cv_mat, GstVideoFrame * frame, GstMeta * meta,
41+
gdouble font_scale, gint thickness, gchar ** labels_list, gint num_labels,
42+
LineStyleBoundingBox style);
4543

4644
enum
4745
{
@@ -50,26 +48,27 @@ enum
5048

5149
struct _GstClassificationOverlay
5250
{
53-
GstInferenceOverlay parent;
51+
GstInferenceBaseOverlay parent;
5452
};
5553

5654
struct _GstClassificationOverlayClass
5755
{
58-
GstInferenceOverlay parent;
56+
GstInferenceBaseOverlay parent;
5957
};
6058

6159
/* class initialization */
6260

6361
G_DEFINE_TYPE_WITH_CODE (GstClassificationOverlay, gst_classification_overlay,
64-
GST_TYPE_INFERENCE_OVERLAY,
62+
GST_TYPE_INFERENCE_BASE_OVERLAY,
6563
GST_DEBUG_CATEGORY_INIT (gst_classification_overlay_debug_category,
6664
"classificationoverlay", 0,
6765
"debug category for classification_overlay element"));
6866

6967
static void
7068
gst_classification_overlay_class_init (GstClassificationOverlayClass * klass)
7169
{
72-
GstInferenceOverlayClass *io_class = GST_INFERENCE_OVERLAY_CLASS (klass);
70+
GstInferenceBaseOverlayClass *io_class =
71+
GST_INFERENCE_BASE_OVERLAY_CLASS (klass);
7372

7473
gst_element_class_set_static_metadata (GST_ELEMENT_CLASS (klass),
7574
"classificationoverlay", "Filter",
@@ -93,29 +92,17 @@ gst_classification_overlay_init (GstClassificationOverlay *
9392
}
9493

9594
static GstFlowReturn
96-
gst_classification_overlay_process_meta (GstInferenceOverlay *
97-
inference_overlay, GstVideoFrame * frame, GstMeta * meta,
98-
gdouble font_scale, gint thickness, gchar ** labels_list, gint num_labels)
95+
gst_classification_overlay_process_meta (GstInferenceBaseOverlay *
96+
inference_overlay, cv::Mat & cv_mat, GstVideoFrame * frame, GstMeta * meta,
97+
gdouble font_scale, gint thickness, gchar ** labels_list, gint num_labels,
98+
LineStyleBoundingBox style)
9999
{
100100
GstClassificationMeta *class_meta;
101-
gint index, i, width, height, channels;
101+
gint index, i;
102102
gdouble max, current;
103-
cv::Mat cv_mat;
104103
cv::String str;
105104
cv::Size size;
106105

107-
switch (GST_VIDEO_FRAME_FORMAT (frame)) {
108-
case GST_VIDEO_FORMAT_RGB:
109-
case GST_VIDEO_FORMAT_BGR:
110-
channels = 3;
111-
break;
112-
default:
113-
channels = 4;
114-
break;
115-
}
116-
width = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0) / channels;
117-
height = GST_VIDEO_FRAME_HEIGHT (frame);
118-
119106
class_meta = (GstClassificationMeta *) meta;
120107

121108
/* Get the most probable label */
@@ -133,16 +120,15 @@ gst_classification_overlay_process_meta (GstInferenceOverlay *
133120
} else {
134121
str = cv::format ("Label #%d prob:%f", index, max);
135122
}
136-
cv_mat = cv::Mat (height, width, CV_MAKETYPE (CV_8U, channels),
137-
(char *) frame->data[0]);
123+
138124
/* Put string on screen
139125
* 10*font_scale+16 aproximates text's rendered size on screen as a
140126
* lineal function to avoid using cv::getTextSize
141127
*/
142-
cv::putText (cv_mat, str, cv::Point (0, 10*font_scale+16), cv::FONT_HERSHEY_PLAIN,
143-
font_scale, white, thickness + (thickness*0.5));
144-
cv::putText (cv_mat, str, cv::Point (0, 10*font_scale+16), cv::FONT_HERSHEY_PLAIN,
145-
font_scale, black, thickness);
128+
cv::putText (cv_mat, str, cv::Point (0, 10 * font_scale + 16),
129+
cv::FONT_HERSHEY_PLAIN, font_scale, white, thickness + (thickness * 0.5));
130+
cv::putText (cv_mat, str, cv::Point (0, 10 * font_scale + 16),
131+
cv::FONT_HERSHEY_PLAIN, font_scale, black, thickness);
146132

147133
return GST_FLOW_OK;
148134
}

ext/opencv/gstclassificationoverlay.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* GStreamer
3-
* Copyright (C) 2019 RidgeRun
3+
* Copyright (C) 2018-2020 RidgeRun <[email protected]>
44
*
55
* This library is free software; you can redistribute it and/or
66
* modify it under the terms of the GNU Library General Public
@@ -22,12 +22,12 @@
2222
#ifndef _GST_CLASSIFICATION_OVERLAY_H_
2323
#define _GST_CLASSIFICATION_OVERLAY_H_
2424

25-
#include <gst/opencv/gstinferenceoverlay.h>
25+
#include <gst/opencv/gstinferencebaseoverlay.h>
2626

2727
G_BEGIN_DECLS
2828

2929
#define GST_TYPE_CLASSIFICATION_OVERLAY (gst_classification_overlay_get_type())
30-
G_DECLARE_FINAL_TYPE (GstClassificationOverlay, gst_classification_overlay, GST, CLASSIFICATION_OVERLAY, GstInferenceOverlay)
30+
G_DECLARE_FINAL_TYPE (GstClassificationOverlay, gst_classification_overlay, GST, CLASSIFICATION_OVERLAY, GstInferenceBaseOverlay)
3131

3232
G_END_DECLS
3333

0 commit comments

Comments
 (0)