opencv: Add 'kernel' prefix to width/height

Rename width to kernel-width, and height to kernel-height to avoid
ambiguity in the name.

https://bugzilla.gnome.org/show_bug.cgi?id=788567
This commit is contained in:
Michał Górny 2017-10-11 22:03:24 +02:00 committed by Thibault Saunier
parent ef4d6b93e6
commit 798d899a25
2 changed files with 27 additions and 27 deletions

View file

@ -77,8 +77,8 @@ enum
{ {
PROP_0, PROP_0,
PROP_SMOOTH_TYPE, PROP_SMOOTH_TYPE,
PROP_WIDTH, PROP_KERNELWIDTH,
PROP_HEIGHT, PROP_KERNELHEIGHT,
PROP_COLORSIGMA, PROP_COLORSIGMA,
PROP_SPATIALSIGMA PROP_SPATIALSIGMA
}; };
@ -114,8 +114,8 @@ gst_cv_smooth_type_get_type (void)
} }
#define DEFAULT_CV_SMOOTH_TYPE CV_GAUSSIAN #define DEFAULT_CV_SMOOTH_TYPE CV_GAUSSIAN
#define DEFAULT_WIDTH 3 #define DEFAULT_KERNELWIDTH 3
#define DEFAULT_HEIGHT 3 #define DEFAULT_KERNELHEIGHT 3
#define DEFAULT_COLORSIGMA 0.0 #define DEFAULT_COLORSIGMA 0.0
#define DEFAULT_SPATIALSIGMA 0.0 #define DEFAULT_SPATIALSIGMA 0.0
@ -155,18 +155,18 @@ gst_cv_smooth_class_init (GstCvSmoothClass * klass)
DEFAULT_CV_SMOOTH_TYPE, DEFAULT_CV_SMOOTH_TYPE,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)) (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))
); );
g_object_class_install_property (gobject_class, PROP_WIDTH, g_object_class_install_property (gobject_class, PROP_KERNELWIDTH,
g_param_spec_int ("width", "width (kernel width)", g_param_spec_int ("kernel-width", "kernel width",
"The gaussian kernel width (must be positive and odd)." "The gaussian kernel width (must be positive and odd)."
"If type is median, this means the aperture linear size." "If type is median, this means the aperture linear size."
"Check OpenCV docs: http://docs.opencv.org" "Check OpenCV docs: http://docs.opencv.org"
"/2.4/modules/imgproc/doc/filtering.htm", "/2.4/modules/imgproc/doc/filtering.htm",
1, G_MAXINT, DEFAULT_WIDTH, 1, G_MAXINT, DEFAULT_KERNELWIDTH,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_HEIGHT, g_object_class_install_property (gobject_class, PROP_KERNELHEIGHT,
g_param_spec_int ("height", "height (kernel height)", g_param_spec_int ("kernel-height", "kernel height",
"The gaussian kernel height (must be positive and odd).", "The gaussian kernel height (must be positive and odd).",
0, G_MAXINT, DEFAULT_HEIGHT, 0, G_MAXINT, DEFAULT_KERNELHEIGHT,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_COLORSIGMA, g_object_class_install_property (gobject_class, PROP_COLORSIGMA,
g_param_spec_double ("color", "color (gaussian standard deviation or " g_param_spec_double ("color", "color (gaussian standard deviation or "
@ -208,8 +208,8 @@ static void
gst_cv_smooth_init (GstCvSmooth * filter) gst_cv_smooth_init (GstCvSmooth * filter)
{ {
filter->type = DEFAULT_CV_SMOOTH_TYPE; filter->type = DEFAULT_CV_SMOOTH_TYPE;
filter->width = DEFAULT_WIDTH; filter->kernelwidth = DEFAULT_KERNELWIDTH;
filter->height = DEFAULT_HEIGHT; filter->kernelheight = DEFAULT_KERNELHEIGHT;
filter->colorsigma = DEFAULT_COLORSIGMA; filter->colorsigma = DEFAULT_COLORSIGMA;
filter->spatialsigma = DEFAULT_SPATIALSIGMA; filter->spatialsigma = DEFAULT_SPATIALSIGMA;
@ -248,24 +248,24 @@ gst_cv_smooth_set_property (GObject * object, guint prop_id,
case PROP_SMOOTH_TYPE: case PROP_SMOOTH_TYPE:
gst_cv_smooth_change_type (filter, g_value_get_enum (value)); gst_cv_smooth_change_type (filter, g_value_get_enum (value));
break; break;
case PROP_WIDTH:{ case PROP_KERNELWIDTH:{
gint prop = g_value_get_int (value); gint prop = g_value_get_int (value);
if (prop % 2 == 1) { if (prop % 2 == 1) {
filter->width = prop; filter->kernelwidth = prop;
} else { } else {
GST_WARNING_OBJECT (filter, "Ignoring value for width, not odd" GST_WARNING_OBJECT (filter, "Ignoring value for kernel-width, not odd"
"(%d)", prop); "(%d)", prop);
} }
} }
break; break;
case PROP_HEIGHT:{ case PROP_KERNELHEIGHT:{
gint prop = g_value_get_int (value); gint prop = g_value_get_int (value);
if (prop % 2 == 1) { if (prop % 2 == 1) {
filter->height = prop; filter->kernelheight = prop;
} else { } else {
GST_WARNING_OBJECT (filter, "Ignoring value for height, not odd" GST_WARNING_OBJECT (filter, "Ignoring value for kernel-height, not odd"
" nor zero (%d)", prop); " nor zero (%d)", prop);
} }
} }
@ -292,11 +292,11 @@ gst_cv_smooth_get_property (GObject * object, guint prop_id,
case PROP_SMOOTH_TYPE: case PROP_SMOOTH_TYPE:
g_value_set_enum (value, filter->type); g_value_set_enum (value, filter->type);
break; break;
case PROP_WIDTH: case PROP_KERNELWIDTH:
g_value_set_int (value, filter->width); g_value_set_int (value, filter->kernelwidth);
break; break;
case PROP_HEIGHT: case PROP_KERNELHEIGHT:
g_value_set_int (value, filter->height); g_value_set_int (value, filter->kernelheight);
break; break;
case PROP_COLORSIGMA: case PROP_COLORSIGMA:
g_value_set_double (value, filter->colorsigma); g_value_set_double (value, filter->colorsigma);
@ -318,15 +318,15 @@ gst_cv_smooth_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
switch (filter->type) { switch (filter->type) {
case CV_BLUR: case CV_BLUR:
blur (cvarrToMat(img), cvarrToMat(img), Size (filter->width, filter->height), blur (cvarrToMat(img), cvarrToMat(img), Size (filter->kernelwidth, filter->kernelheight),
Point (-1, -1)); Point (-1, -1));
break; break;
case CV_GAUSSIAN: case CV_GAUSSIAN:
GaussianBlur (cvarrToMat(img), cvarrToMat(img), Size (filter->width, filter->height), GaussianBlur (cvarrToMat(img), cvarrToMat(img), Size (filter->kernelwidth, filter->kernelheight),
filter->colorsigma, filter->colorsigma); filter->colorsigma, filter->colorsigma);
break; break;
case CV_MEDIAN: case CV_MEDIAN:
medianBlur (cvarrToMat(img), cvarrToMat(img), filter->width); medianBlur (cvarrToMat(img), cvarrToMat(img), filter->kernelwidth);
break; break;
case CV_BILATERAL: case CV_BILATERAL:
bilateralFilter (cvarrToMat(img), cvarrToMat(img), -1, filter->colorsigma, 0.0); bilateralFilter (cvarrToMat(img), cvarrToMat(img), -1, filter->colorsigma, 0.0);

View file

@ -69,8 +69,8 @@ struct _GstCvSmooth
gint type; gint type;
gint width; gint kernelwidth;
gint height; gint kernelheight;
gdouble colorsigma; gdouble colorsigma;
gdouble spatialsigma; gdouble spatialsigma;
}; };