opencv: allow per feature registration

Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2038>
This commit is contained in:
Stéphane Cerveau 2021-02-18 13:34:54 +01:00 committed by GStreamer Marge Bot
parent bc17c7ba3a
commit 63e2705e97
43 changed files with 178 additions and 404 deletions

View file

@ -157,8 +157,13 @@ camera_calibration_pattern_get_type (void)
return camera_calibration_pattern_type;
}
G_DEFINE_TYPE (GstCameraCalibrate, gst_camera_calibrate,
GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstCameraCalibrate, gst_camera_calibrate,
GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_camera_calibrate_debug, "cameracalibrate", 0,
"Performs camera calibration");
);
GST_ELEMENT_REGISTER_DEFINE (cameracalibrate, "cameracalibrate", GST_RANK_NONE,
GST_TYPE_CAMERA_CALIBRATE);
static void gst_camera_calibrate_dispose (GObject * object);
static void gst_camera_calibrate_set_property (GObject * object, guint prop_id,
@ -290,7 +295,8 @@ gst_camera_calibrate_class_init (GstCameraCalibrateClass * klass)
templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
gst_element_class_add_pad_template (element_class, templ);
gst_type_mark_as_plugin_api (GST_TYPE_CAMERA_CALIBRATION_PATTERN, (GstPluginAPIFlags) 0);
gst_type_mark_as_plugin_api (GST_TYPE_CAMERA_CALIBRATION_PATTERN,
(GstPluginAPIFlags) 0);
}
/* initialize the new element
@ -325,8 +331,8 @@ gst_camera_calibrate_init (GstCameraCalibrate * calib)
calib->flags =
cv::fisheye::CALIB_FIX_SKEW | cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC |
/*cv::fisheye::CALIB_FIX_K1 | */
cv::fisheye::CALIB_FIX_K2 | cv::fisheye::CALIB_FIX_K3 | cv::
fisheye::CALIB_FIX_K4;
cv::fisheye::CALIB_FIX_K2 | cv::fisheye::CALIB_FIX_K3 | cv::fisheye::
CALIB_FIX_K4;
}
calib->mode = CAPTURING; //DETECTION;
@ -753,18 +759,3 @@ camera_calibrate_calibrate (GstCameraCalibrate * calib,
return ok;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_camera_calibrate_plugin_init (GstPlugin * plugin)
{
/* debug category for filtering log messages */
GST_DEBUG_CATEGORY_INIT (gst_camera_calibrate_debug, "cameracalibrate",
0, "Performs camera calibration");
return gst_element_register (plugin, "cameracalibrate", GST_RANK_NONE,
GST_TYPE_CAMERA_CALIBRATE);
}

View file

@ -107,7 +107,7 @@ struct _GstCameraCalibrateClass
GType gst_camera_calibrate_get_type (void);
gboolean gst_camera_calibrate_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (cameracalibrate);
G_END_DECLS
#endif /* __GST_CAMERA_CALIBRATE_H__ */

View file

@ -97,8 +97,13 @@ enum
PROP_SETTINGS
};
G_DEFINE_TYPE (GstCameraUndistort, gst_camera_undistort,
GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstCameraUndistort, gst_camera_undistort,
GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_camera_undistort_debug, "cameraundistort", 0,
"Performs camera undistortion");
);
GST_ELEMENT_REGISTER_DEFINE (cameraundistort, "cameraundistort", GST_RANK_NONE,
GST_TYPE_CAMERA_UNDISTORT);
static void gst_camera_undistort_dispose (GObject * object);
static void gst_camera_undistort_set_property (GObject * object, guint prop_id,
@ -403,18 +408,3 @@ gst_camera_undistort_src_event (GstBaseTransform * trans, GstEvent * event)
GST_BASE_TRANSFORM_CLASS (gst_camera_undistort_parent_class)->src_event
(trans, event);
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_camera_undistort_plugin_init (GstPlugin * plugin)
{
/* debug category for filtering log messages */
GST_DEBUG_CATEGORY_INIT (gst_camera_undistort_debug, "cameraundistort",
0, "Performs camera undistortion");
return gst_element_register (plugin, "cameraundistort", GST_RANK_NONE,
GST_TYPE_CAMERA_UNDISTORT);
}

View file

@ -97,7 +97,7 @@ struct _GstCameraUndistortClass
GType gst_camera_undistort_get_type (void);
gboolean gst_camera_undistort_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (cameraundistort);
G_END_DECLS

View file

@ -64,7 +64,11 @@
GST_DEBUG_CATEGORY_STATIC (gst_cv_dilate_debug);
#define GST_CAT_DEFAULT gst_cv_dilate_debug
G_DEFINE_TYPE (GstCvDilate, gst_cv_dilate, GST_TYPE_CV_DILATE_ERODE);
G_DEFINE_TYPE_WITH_CODE (GstCvDilate, gst_cv_dilate, GST_TYPE_CV_DILATE_ERODE,
GST_DEBUG_CATEGORY_INIT (gst_cv_dilate_debug, "cvdilate", 0, "cvdilate");
);
GST_ELEMENT_REGISTER_DEFINE (cvdilate, "cvdilate", GST_RANK_NONE,
GST_TYPE_CV_DILATE);
static GstFlowReturn gst_cv_dilate_transform_ip (GstOpencvVideoFilter *
filter, GstBuffer * buf, cv::Mat img);
@ -106,12 +110,3 @@ gst_cv_dilate_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
return GST_FLOW_OK;
}
gboolean
gst_cv_dilate_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_cv_dilate_debug, "cvdilate", 0, "cvdilate");
return gst_element_register (plugin, "cvdilate", GST_RANK_NONE,
GST_TYPE_CV_DILATE);
}

View file

@ -77,7 +77,7 @@ struct _GstCvDilateClass
GType gst_cv_dilate_get_type (void);
gboolean gst_cv_dilate_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (cvdilate);
G_END_DECLS

View file

@ -75,8 +75,13 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("GRAY8")));
G_DEFINE_TYPE (GstCvEqualizeHist, gst_cv_equalize_hist,
GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstCvEqualizeHist, gst_cv_equalize_hist,
GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_cv_equalize_hist_debug, "cvequalizehist", 0,
"cvequalizehist");
);
GST_ELEMENT_REGISTER_DEFINE (cvequalizehist, "cvequalizehist", GST_RANK_NONE,
GST_TYPE_CV_EQUALIZE_HIST);
static GstFlowReturn gst_cv_equalize_hist_transform (GstOpencvVideoFilter *
filter, GstBuffer * buf, cv::Mat img, GstBuffer * outbuf, cv::Mat outimg);
@ -115,12 +120,3 @@ gst_cv_equalize_hist_transform (GstOpencvVideoFilter * base,
cv::equalizeHist (img, outimg);
return GST_FLOW_OK;
}
gboolean
gst_cv_equalize_hist_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_cv_equalize_hist_debug, "cvequalizehist", 0,
"cvequalizehist");
return gst_element_register (plugin, "cvequalizehist", GST_RANK_NONE,
GST_TYPE_CV_EQUALIZE_HIST);
}

View file

@ -75,7 +75,7 @@ struct _GstCvEqualizeHistClass
GType gst_cv_equalize_hist_get_type (void);
gboolean gst_cv_equalize_hist_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (cvequalizehist);
G_END_DECLS

View file

@ -64,7 +64,11 @@
GST_DEBUG_CATEGORY_STATIC (gst_cv_erode_debug);
#define GST_CAT_DEFAULT gst_cv_erode_debug
G_DEFINE_TYPE (GstCvErode, gst_cv_erode, GST_TYPE_CV_DILATE_ERODE);
G_DEFINE_TYPE_WITH_CODE (GstCvErode, gst_cv_erode, GST_TYPE_CV_DILATE_ERODE,
GST_DEBUG_CATEGORY_INIT (gst_cv_erode_debug, "cverode", 0, "cverode");
);
GST_ELEMENT_REGISTER_DEFINE (cverode, "cverode", GST_RANK_NONE,
GST_TYPE_CV_ERODE);
static GstFlowReturn gst_cv_erode_transform_ip (GstOpencvVideoFilter *
filter, GstBuffer * buf, cv::Mat img);
@ -106,12 +110,3 @@ gst_cv_erode_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
return GST_FLOW_OK;
}
gboolean
gst_cv_erode_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_cv_erode_debug, "cverode", 0, "cverode");
return gst_element_register (plugin, "cverode", GST_RANK_NONE,
GST_TYPE_CV_ERODE);
}

View file

@ -77,7 +77,7 @@ struct _GstCvErodeClass
GType gst_cv_erode_get_type (void);
gboolean gst_cv_erode_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (cverode);
G_END_DECLS

View file

@ -96,8 +96,12 @@ enum
#define DEFAULT_SHIFT 0.0
#define DEFAULT_MASK TRUE
G_DEFINE_TYPE (GstCvLaplace, gst_cv_laplace, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstCvLaplace, gst_cv_laplace,
GST_TYPE_OPENCV_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_cv_laplace_debug,
"cvlaplace", 0, "cvlaplace");
);
GST_ELEMENT_REGISTER_DEFINE (cvlaplace, "cvlaplace", GST_RANK_NONE,
GST_TYPE_CV_LAPLACE);
static void gst_cv_laplace_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_cv_laplace_get_property (GObject * object, guint prop_id,
@ -274,12 +278,3 @@ gst_cv_laplace_transform (GstOpencvVideoFilter * base, GstBuffer * buf,
return GST_FLOW_OK;
}
gboolean
gst_cv_laplace_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_cv_laplace_debug, "cvlaplace", 0, "cvlaplace");
return gst_element_register (plugin, "cvlaplace", GST_RANK_NONE,
GST_TYPE_CV_LAPLACE);
}

View file

@ -84,7 +84,7 @@ struct _GstCvLaplaceClass
GType gst_cv_laplace_get_type (void);
gboolean gst_cv_laplace_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (cvlaplace);
G_END_DECLS

View file

@ -135,7 +135,12 @@ gst_cv_smooth_type_get_type (void)
#define DEFAULT_WIDTH G_MAXINT
#define DEFAULT_HEIGHT G_MAXINT
G_DEFINE_TYPE (GstCvSmooth, gst_cv_smooth, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstCvSmooth, gst_cv_smooth,
GST_TYPE_OPENCV_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_cv_smooth_debug,
"cvsmooth", 0, "cvsmooth");
);
GST_ELEMENT_REGISTER_DEFINE (cvsmooth, "cvsmooth", GST_RANK_NONE,
GST_TYPE_CV_SMOOTH);
static void gst_cv_smooth_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -423,12 +428,3 @@ gst_cv_smooth_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
return GST_FLOW_OK;
}
gboolean
gst_cv_smooth_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_cv_smooth_debug, "cvsmooth", 0, "cvsmooth");
return gst_element_register (plugin, "cvsmooth", GST_RANK_NONE,
GST_TYPE_CV_SMOOTH);
}

View file

@ -88,7 +88,7 @@ struct _GstCvSmoothClass
GType gst_cv_smooth_get_type (void);
gboolean gst_cv_smooth_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (cvsmooth);
G_END_DECLS

View file

@ -95,7 +95,11 @@ enum
#define DEFAULT_APERTURE_SIZE 3
#define DEFAULT_MASK TRUE
G_DEFINE_TYPE (GstCvSobel, gst_cv_sobel, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstCvSobel, gst_cv_sobel, GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_cv_sobel_debug, "cvsobel", 0, "cvsobel");
);
GST_ELEMENT_REGISTER_DEFINE (cvsobel, "cvsobel", GST_RANK_NONE,
GST_TYPE_CV_SOBEL);
static void gst_cv_sobel_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -269,12 +273,3 @@ gst_cv_sobel_transform (GstOpencvVideoFilter * base, GstBuffer * buf,
return GST_FLOW_OK;
}
gboolean
gst_cv_sobel_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_cv_sobel_debug, "cvsobel", 0, "cvsobel");
return gst_element_register (plugin, "cvsobel", GST_RANK_NONE,
GST_TYPE_CV_SOBEL);
}

View file

@ -83,7 +83,7 @@ struct _GstCvSobelClass
GType gst_cv_sobel_get_type (void);
gboolean gst_cv_sobel_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (cvsobel);
G_END_DECLS

View file

@ -129,7 +129,11 @@ dewarp_interpolation_mode_get_type (void)
return dewarp_interpolation_mode_type;
}
G_DEFINE_TYPE (GstDewarp, gst_dewarp, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstDewarp, gst_dewarp, GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_dewarp_debug, "dewarp", 0,
"Dewarp fisheye images");
);
GST_ELEMENT_REGISTER_DEFINE (dewarp, "dewarp", GST_RANK_NONE, GST_TYPE_DEWARP);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
@ -714,13 +718,3 @@ gst_dewarp_transform_frame (GstOpencvVideoFilter * btrans, GstBuffer * buffer,
return ret;
}
gboolean
gst_dewarp_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_dewarp_debug, "dewarp",
0, "Dewarp fisheye images");
return gst_element_register (plugin, "dewarp", GST_RANK_NONE,
GST_TYPE_DEWARP);
}

View file

@ -106,7 +106,7 @@ struct _GstDewarpClass
GType gst_dewarp_get_type (void);
gboolean gst_dewarp_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (dewarp);
G_END_DECLS
#endif /* __GST_DEWARP_H__ */

View file

@ -176,7 +176,12 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB"))
);
G_DEFINE_TYPE (GstDisparity, gst_disparity, GST_TYPE_ELEMENT);
G_DEFINE_TYPE_WITH_CODE (GstDisparity, gst_disparity, GST_TYPE_ELEMENT,
GST_DEBUG_CATEGORY_INIT (gst_disparity_debug, "disparity", 0,
"Stereo image disparity (depth) map calculation");
);
GST_ELEMENT_REGISTER_DEFINE (disparity, "disparity", GST_RANK_NONE,
GST_TYPE_DISPARITY);
static void gst_disparity_finalize (GObject * object);
static void gst_disparity_set_property (GObject * object, guint prop_id,
@ -585,24 +590,6 @@ gst_disparity_chain_right (GstPad * pad, GstObject * parent, GstBuffer * buffer)
return ret;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_disparity_plugin_init (GstPlugin * disparity)
{
GST_DEBUG_CATEGORY_INIT (gst_disparity_debug, "disparity", 0,
"Stereo image disparity (depth) map calculation");
return gst_element_register (disparity, "disparity", GST_RANK_NONE,
GST_TYPE_DISPARITY);
}
static void
initialise_disparity (GstDisparity * fs, int width, int height, int nchannels)
{

View file

@ -108,7 +108,7 @@ struct _GstDisparityClass
GType gst_disparity_get_type (void);
gboolean gst_disparity_plugin_init (GstPlugin * disparity);
GST_ELEMENT_REGISTER_DECLARE (disparity);
G_END_DECLS
#endif /* __GST_DISPARITY_H__ */

View file

@ -97,7 +97,12 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB"))
);
G_DEFINE_TYPE (GstEdgeDetect, gst_edge_detect, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstEdgeDetect, gst_edge_detect,
GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_edge_detect_debug, "edgedetect", 0,
"Performs canny edge detection on videos and images"););
GST_ELEMENT_REGISTER_DEFINE (edgedetect, "edgedetect", GST_RANK_NONE,
GST_TYPE_EDGE_DETECT);
static void gst_edge_detect_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -269,18 +274,3 @@ gst_edge_detect_transform (GstOpencvVideoFilter * base, GstBuffer * buf,
return GST_FLOW_OK;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_edge_detect_plugin_init (GstPlugin * plugin)
{
/* debug category for fltering log messages */
GST_DEBUG_CATEGORY_INIT (gst_edge_detect_debug, "edgedetect",
0, "Performs canny edge detection on videos and images");
return gst_element_register (plugin, "edgedetect", GST_RANK_NONE,
GST_TYPE_EDGE_DETECT);
}

View file

@ -86,7 +86,7 @@ struct _GstEdgeDetectClass
GType gst_edge_detect_get_type (void);
gboolean gst_edge_detect_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (edgedetect);
G_END_DECLS
#endif /* __GST_EDGE_DETECT_H__ */

View file

@ -143,7 +143,11 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB"))
);
G_DEFINE_TYPE (GstFaceBlur, gst_face_blur, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstFaceBlur, gst_face_blur,
GST_TYPE_OPENCV_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_face_blur_debug,
"faceblur", 0, "Blurs faces in images and videos"););
GST_ELEMENT_REGISTER_DEFINE (faceblur, "faceblur", GST_RANK_NONE,
GST_TYPE_FACE_BLUR);
static void gst_face_blur_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -386,19 +390,3 @@ gst_face_blur_load_profile (GstFaceBlur * filter, gchar * profile)
}
return cascade;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_face_blur_plugin_init (GstPlugin * plugin)
{
/* debug category for filtering log messages */
GST_DEBUG_CATEGORY_INIT (gst_face_blur_debug, "faceblur",
0, "Blurs faces in images and videos");
return gst_element_register (plugin, "faceblur", GST_RANK_NONE,
GST_TYPE_FACE_BLUR);
}

View file

@ -93,7 +93,7 @@ struct _GstFaceBlurClass
GType gst_face_blur_get_type (void);
gboolean gst_face_blur_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (faceblur);
G_END_DECLS
#endif /* __GST_FACE_BLUR_H__ */

View file

@ -225,7 +225,12 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB"))
);
G_DEFINE_TYPE (GstFaceDetect, gst_face_detect, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstFaceDetect, gst_face_detect,
GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_face_detect_debug, "facedetect", 0,
"Performs face detection on videos and images, providing detected positions via bus messages"););
GST_ELEMENT_REGISTER_DEFINE (facedetect, "facedetect", GST_RANK_NONE,
GST_TYPE_FACE_DETECT);
static void gst_face_detect_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -789,20 +794,3 @@ gst_face_detect_load_profile (GstFaceDetect * filter, gchar * profile)
return cascade;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_face_detect_plugin_init (GstPlugin * plugin)
{
/* debug category for fltering log messages */
GST_DEBUG_CATEGORY_INIT (gst_face_detect_debug, "facedetect",
0,
"Performs face detection on videos and images, providing detected positions via bus messages");
return gst_element_register (plugin, "facedetect", GST_RANK_NONE,
GST_TYPE_FACE_DETECT);
}

View file

@ -117,7 +117,7 @@ struct _GstFaceDetectClass
GType gst_face_detect_get_type (void);
gboolean gst_face_detect_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (facedetect);
G_END_DECLS
#endif /* __GST_FACE_DETECT_H__ */

View file

@ -107,7 +107,12 @@ enum
#define DEFAULT_TEST_MODE FALSE
#define DEFAULT_SCALE 1.6
G_DEFINE_TYPE (GstGrabcut, gst_grabcut, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstGrabcut, gst_grabcut, GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_grabcut_debug, "grabcut", 0,
"Grabcut image segmentation on either input alpha or input bounding box"););
GST_ELEMENT_REGISTER_DEFINE (grabcut, "grabcut", GST_RANK_NONE,
GST_TYPE_GRABCUT);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
@ -353,23 +358,6 @@ gst_grabcut_transform_ip (GstOpencvVideoFilter * filter, GstBuffer * buffer,
return GST_FLOW_OK;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_grabcut_plugin_init (GstPlugin * plugin)
{
/* debug category for fltering log messages
*
*/
GST_DEBUG_CATEGORY_INIT (gst_grabcut_debug, "grabcut",
0,
"Grabcut image segmentation on either input alpha or input bounding box");
return gst_element_register (plugin, "grabcut", GST_RANK_NONE,
GST_TYPE_GRABCUT);
}
void
compose_matrix_from_image (Mat output, Mat input)

View file

@ -93,7 +93,7 @@ struct _GstGrabcutClass
GType gst_grabcut_get_type (void);
gboolean gst_grabcut_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (grabcut);
G_END_DECLS
#endif /* __GST_GRABCUT_H__ */

View file

@ -127,7 +127,11 @@ static void gst_handdetect_navigation_send_event (GstNavigation * navigation,
G_DEFINE_TYPE_WITH_CODE (GstHanddetect, gst_handdetect,
GST_TYPE_OPENCV_VIDEO_FILTER,
G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION,
gst_handdetect_navigation_interface_init););
gst_handdetect_navigation_interface_init);
GST_DEBUG_CATEGORY_INIT (gst_handdetect_debug,
"handdetect", 0, "opencv hand gesture detection"));
GST_ELEMENT_REGISTER_DEFINE (handdetect, "handdetect", GST_RANK_NONE,
GST_TYPE_HANDDETECT);
static void
gst_handdetect_navigation_interface_init (GstNavigationInterface * iface)
@ -624,16 +628,3 @@ gst_handdetect_load_profile (GstHanddetect * filter, gchar * profile)
return cascade;
}
/* Entry point to initialize the plug-in
* Initialize the plug-in itself
* Register the element factories and other features
*/
gboolean
gst_handdetect_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_handdetect_debug,
"handdetect", 0, "opencv hand gesture detection");
return gst_element_register (plugin, "handdetect", GST_RANK_NONE,
GST_TYPE_HANDDETECT);
}

View file

@ -95,7 +95,7 @@ struct _GstHanddetectClass
GType gst_handdetect_get_type (void);
gboolean gst_handdetect_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (handdetect);
G_END_DECLS
#endif /* __GST_HANDDETECT_H__ */

View file

@ -140,7 +140,12 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB")));
G_DEFINE_TYPE (GstMotioncells, gst_motion_cells, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstMotioncells, gst_motion_cells,
GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_motion_cells_debug, "motioncells", 0,
"Performs motion detection on videos, providing detected positions via bus messages"););
GST_ELEMENT_REGISTER_DEFINE (motioncells, "motioncells", GST_RANK_NONE,
GST_TYPE_MOTIONCELLS);
static void gst_motion_cells_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -1118,20 +1123,3 @@ gst_motion_cells_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
}
return GST_FLOW_OK;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_motion_cells_plugin_init (GstPlugin * plugin)
{
/* debug category for fltering log messages */
GST_DEBUG_CATEGORY_INIT (gst_motion_cells_debug,
"motioncells",
0,
"Performs motion detection on videos, providing detected positions via bus messages");
return gst_element_register (plugin, "motioncells", GST_RANK_NONE,
GST_TYPE_MOTIONCELLS);
}

View file

@ -99,7 +99,7 @@ struct _GstMotioncellsClass
GType gst_motion_cells_get_type (void);
gboolean gst_motion_cells_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (motioncells);
G_END_DECLS
#endif /* __GST_MOTION_CELLS_H__ */

View file

@ -45,73 +45,35 @@
#include "gstcameracalibrate.h"
#include "gstcameraundistort.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_cv_dilate_plugin_init (plugin))
return FALSE;
gboolean ret = FALSE;
if (!gst_cv_equalize_hist_plugin_init (plugin))
return FALSE;
ret |= GST_ELEMENT_REGISTER (cvdilate, plugin);
ret |= GST_ELEMENT_REGISTER (cvequalizehist, plugin);
ret |= GST_ELEMENT_REGISTER (cverode, plugin);
ret |= GST_ELEMENT_REGISTER (cvlaplace, plugin);
ret |= GST_ELEMENT_REGISTER (cvsmooth, plugin);
ret |= GST_ELEMENT_REGISTER (cvsobel, plugin);
ret |= GST_ELEMENT_REGISTER (edgedetect, plugin);
ret |= GST_ELEMENT_REGISTER (faceblur, plugin);
ret |= GST_ELEMENT_REGISTER (facedetect, plugin);
ret |= GST_ELEMENT_REGISTER (motioncells, plugin);
ret |= GST_ELEMENT_REGISTER (templatematch, plugin);
ret |= GST_ELEMENT_REGISTER (opencvtextoverlay, plugin);
ret |= GST_ELEMENT_REGISTER (handdetect, plugin);
ret |= GST_ELEMENT_REGISTER (skindetect, plugin);
ret |= GST_ELEMENT_REGISTER (retinex, plugin);
ret |= GST_ELEMENT_REGISTER (segmentation, plugin);
ret |= GST_ELEMENT_REGISTER (grabcut, plugin);
ret |= GST_ELEMENT_REGISTER (disparity, plugin);
ret |= GST_ELEMENT_REGISTER (dewarp, plugin);
ret |= GST_ELEMENT_REGISTER (cameracalibrate, plugin);
ret |= GST_ELEMENT_REGISTER (cameraundistort, plugin);
if (!gst_cv_erode_plugin_init (plugin))
return FALSE;
if (!gst_cv_laplace_plugin_init (plugin))
return FALSE;
if (!gst_cv_smooth_plugin_init (plugin))
return FALSE;
if (!gst_cv_sobel_plugin_init (plugin))
return FALSE;
if (!gst_edge_detect_plugin_init (plugin))
return FALSE;
if (!gst_face_blur_plugin_init (plugin))
return FALSE;
if (!gst_face_detect_plugin_init (plugin))
return FALSE;
if (!gst_motion_cells_plugin_init (plugin))
return FALSE;
if (!gst_template_match_plugin_init (plugin))
return FALSE;
if (!gst_opencv_text_overlay_plugin_init (plugin))
return FALSE;
if (!gst_handdetect_plugin_init (plugin))
return FALSE;
if (!gst_skin_detect_plugin_init (plugin))
return FALSE;
if (!gst_retinex_plugin_init (plugin))
return FALSE;
if (!gst_segmentation_plugin_init (plugin))
return FALSE;
if (!gst_grabcut_plugin_init (plugin))
return FALSE;
if (!gst_disparity_plugin_init (plugin))
return FALSE;
if (!gst_dewarp_plugin_init (plugin))
return FALSE;
if (!gst_camera_calibrate_plugin_init (plugin))
return FALSE;
if (!gst_camera_undistort_plugin_init (plugin))
return FALSE;
return TRUE;
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -112,7 +112,13 @@ gst_retinex_method_get_type (void)
return etype;
}
G_DEFINE_TYPE (GstRetinex, gst_retinex, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstRetinex, gst_retinex, GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_retinex_debug, "retinex", 0,
"Multiscale retinex for colour image enhancement");
);
GST_ELEMENT_REGISTER_DEFINE (retinex, "retinex", GST_RANK_NONE,
GST_TYPE_RETINEX);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
@ -404,20 +410,3 @@ gst_retinex_transform_ip (GstOpencvVideoFilter * filter, GstBuffer * buf,
return GST_FLOW_OK;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_retinex_plugin_init (GstPlugin * plugin)
{
/* debug category for fltering log messages
*
*/
GST_DEBUG_CATEGORY_INIT (gst_retinex_debug, "retinex",
0, "Multiscale retinex for colour image enhancement");
return gst_element_register (plugin, "retinex", GST_RANK_NONE,
GST_TYPE_RETINEX);
}

View file

@ -88,7 +88,7 @@ struct _GstRetinexClass
GType gst_retinex_get_type (void);
gboolean gst_retinex_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (retinex);
G_END_DECLS
#endif /* __GST_RETINEX_H__ */

View file

@ -139,7 +139,13 @@ gst_segmentation_method_get_type (void)
return etype;
}
G_DEFINE_TYPE (GstSegmentation, gst_segmentation, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstSegmentation, gst_segmentation,
GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_segmentation_debug, "segmentation", 0,
"Performs Foreground/Background segmentation in video sequences");
);
GST_ELEMENT_REGISTER_DEFINE (segmentation, "segmentation", GST_RANK_NONE,
GST_TYPE_SEGMENTATION);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
@ -450,21 +456,6 @@ gst_segmentation_transform_ip (GstOpencvVideoFilter * cvfilter,
return GST_FLOW_OK;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_segmentation_plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_segmentation_debug, "segmentation",
0, "Performs Foreground/Background segmentation in video sequences");
return gst_element_register (plugin, "segmentation", GST_RANK_NONE,
GST_TYPE_SEGMENTATION);
}
#ifdef CODE_FROM_OREILLY_BOOK /* See license at the beginning of the page */
/*

View file

@ -118,7 +118,7 @@ struct _GstSegmentationClass
GType gst_segmentation_get_type (void);
gboolean gst_segmentation_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (segmentation);
G_END_DECLS
#endif /* __GST_SEGMENTATION_H__ */

View file

@ -99,7 +99,14 @@ gst_skin_detect_method_get_type (void)
return etype;
}
G_DEFINE_TYPE (GstSkinDetect, gst_skin_detect, GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstSkinDetect, gst_skin_detect,
GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_skin_detect_debug, "skindetect", 0,
"Performs skin detection on videos and images");
);
GST_ELEMENT_REGISTER_DEFINE (skindetect, "skindetect", GST_RANK_NONE,
GST_TYPE_SKIN_DETECT);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
@ -385,20 +392,3 @@ gst_skin_detect_transform (GstOpencvVideoFilter * base, GstBuffer * buf,
return GST_FLOW_OK;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_skin_detect_plugin_init (GstPlugin * plugin)
{
/* debug category for fltering log messages
*
*/
GST_DEBUG_CATEGORY_INIT (gst_skin_detect_debug, "skindetect",
0, "Performs skin detection on videos and images");
return gst_element_register (plugin, "skindetect", GST_RANK_NONE,
GST_TYPE_SKIN_DETECT);
}

View file

@ -84,7 +84,7 @@ struct _GstSkinDetectClass
GType gst_skin_detect_get_type (void);
gboolean gst_skin_detect_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (skindetect);
G_END_DECLS
#endif /* __GST_SKIN_DETECT_H__ */

View file

@ -99,8 +99,13 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("BGR"))
);
G_DEFINE_TYPE (GstTemplateMatch, gst_template_match,
GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstTemplateMatch, gst_template_match,
GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_template_match_debug, "templatematch", 0,
"Performs template matching on videos and images, providing detected positions via bus messages");
);
GST_ELEMENT_REGISTER_DEFINE (templatematch, "templatematch",
GST_RANK_NONE, GST_TYPE_TEMPLATE_MATCH);
static void gst_template_match_finalize (GObject * object);
static void gst_template_match_set_property (GObject * object, guint prop_id,
@ -379,19 +384,3 @@ gst_template_match_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
}
return GST_FLOW_OK;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_template_match_plugin_init (GstPlugin * templatematch)
{
/* debug category for fltering log messages */
GST_DEBUG_CATEGORY_INIT (gst_template_match_debug, "templatematch",
0,
"Performs template matching on videos and images, providing detected positions via bus messages");
return gst_element_register (templatematch, "templatematch", GST_RANK_NONE,
GST_TYPE_TEMPLATE_MATCH);
}

View file

@ -83,7 +83,7 @@ struct _GstTemplateMatchClass
GType gst_template_match_get_type (void);
gboolean gst_template_match_plugin_init (GstPlugin * templatematch);
GST_ELEMENT_REGISTER_DECLARE (templatematch);
G_END_DECLS
#endif /* __GST_TEMPLATE_MATCH_H__ */

View file

@ -111,8 +111,13 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGB"))
);
G_DEFINE_TYPE (GstOpencvTextOverlay, gst_opencv_text_overlay,
GST_TYPE_OPENCV_VIDEO_FILTER);
G_DEFINE_TYPE_WITH_CODE (GstOpencvTextOverlay, gst_opencv_text_overlay,
GST_TYPE_OPENCV_VIDEO_FILTER,
GST_DEBUG_CATEGORY_INIT (gst_opencv_text_overlay_debug, "opencvtextoverlay",
0, "Template opencvtextoverlay");
);
GST_ELEMENT_REGISTER_DEFINE (opencvtextoverlay, "opencvtextoverlay",
GST_RANK_NONE, GST_TYPE_OPENCV_TEXT_OVERLAY);
static void gst_opencv_text_overlay_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
@ -336,22 +341,3 @@ gst_opencv_text_overlay_transform_ip (GstOpencvVideoFilter * base,
return GST_FLOW_OK;
}
/* entry point to initialize the plug-in
* initialize the plug-in itself
* register the element factories and other features
*/
gboolean
gst_opencv_text_overlay_plugin_init (GstPlugin * plugin)
{
/* debug category for fltering log messages
*
* exchange the string 'Template opencvtextoverlay' with your description
*/
GST_DEBUG_CATEGORY_INIT (gst_opencv_text_overlay_debug, "opencvtextoverlay",
0, "Template opencvtextoverlay");
return gst_element_register (plugin, "opencvtextoverlay", GST_RANK_NONE,
GST_TYPE_OPENCV_TEXT_OVERLAY);
}

View file

@ -87,7 +87,7 @@ struct _GstOpencvTextOverlayClass
};
GType gst_opencv_text_overlay_get_type (void);
gboolean gst_opencv_text_overlay_plugin_init (GstPlugin * plugin);
GST_ELEMENT_REGISTER_DECLARE (opencvtextoverlay);
G_END_DECLS