Added the property for setting the "thickness" of font
modified: ext/opencv/textwrite/gsttextwrite.c modified: ext/opencv/textwrite/gsttextwrite.h
This commit is contained in:
parent
ce5eb639cd
commit
6d4f9ceeb5
@ -71,6 +71,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_textwrite_debug);
|
|||||||
#define DEFAULT_PROP_HEIGHT 1
|
#define DEFAULT_PROP_HEIGHT 1
|
||||||
#define DEFAULT_PROP_XPOS 50
|
#define DEFAULT_PROP_XPOS 50
|
||||||
#define DEFAULT_PROP_YPOS 50
|
#define DEFAULT_PROP_YPOS 50
|
||||||
|
#define DEFAULT_PROP_THICKNESS 2
|
||||||
|
|
||||||
/* Filter signals and args */
|
/* Filter signals and args */
|
||||||
enum
|
enum
|
||||||
@ -85,6 +86,7 @@ enum
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_XPOS,
|
PROP_XPOS,
|
||||||
PROP_YPOS,
|
PROP_YPOS,
|
||||||
|
PROP_THICKNESS,
|
||||||
PROP_TEXT,
|
PROP_TEXT,
|
||||||
PROP_HEIGHT,
|
PROP_HEIGHT,
|
||||||
PROP_WIDTH
|
PROP_WIDTH
|
||||||
@ -184,6 +186,11 @@ gst_textwrite_class_init (GsttextwriteClass * klass)
|
|||||||
"Sets the Vertical position", 0, G_MAXINT,
|
"Sets the Vertical position", 0, G_MAXINT,
|
||||||
DEFAULT_PROP_YPOS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
DEFAULT_PROP_YPOS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_THICKNESS,
|
||||||
|
g_param_spec_int ("thickness", "font thickness",
|
||||||
|
"Sets the Thickness of Font", 0, G_MAXINT,
|
||||||
|
DEFAULT_PROP_THICKNESS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_HEIGHT,
|
g_object_class_install_property (gobject_class, PROP_HEIGHT,
|
||||||
g_param_spec_double ("height", "Height",
|
g_param_spec_double ("height", "Height",
|
||||||
"Sets the height of fonts",1.0,5.0,
|
"Sets the height of fonts",1.0,5.0,
|
||||||
@ -223,7 +230,8 @@ gst_textwrite_init (Gsttextwrite * filter,
|
|||||||
filter->width = DEFAULT_PROP_WIDTH;
|
filter->width = DEFAULT_PROP_WIDTH;
|
||||||
filter->height = DEFAULT_PROP_HEIGHT;
|
filter->height = DEFAULT_PROP_HEIGHT;
|
||||||
filter->xpos = DEFAULT_PROP_XPOS;
|
filter->xpos = DEFAULT_PROP_XPOS;
|
||||||
filter->ypos=DEFAULT_PROP_XPOS;
|
filter->ypos = DEFAULT_PROP_YPOS;
|
||||||
|
filter->thickness = DEFAULT_PROP_THICKNESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,6 +252,9 @@ gst_textwrite_set_property (GObject * object, guint prop_id,
|
|||||||
case PROP_YPOS:
|
case PROP_YPOS:
|
||||||
filter->ypos = g_value_get_int(value);
|
filter->ypos = g_value_get_int(value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_THICKNESS:
|
||||||
|
filter->thickness = g_value_get_int(value);
|
||||||
|
break;
|
||||||
case PROP_HEIGHT:
|
case PROP_HEIGHT:
|
||||||
filter->height = g_value_get_double(value);
|
filter->height = g_value_get_double(value);
|
||||||
break;
|
break;
|
||||||
@ -272,6 +283,9 @@ gst_textwrite_get_property (GObject * object, guint prop_id,
|
|||||||
case PROP_YPOS:
|
case PROP_YPOS:
|
||||||
g_value_set_int (value, filter->ypos);
|
g_value_set_int (value, filter->ypos);
|
||||||
break;
|
break;
|
||||||
|
case PROP_THICKNESS:
|
||||||
|
g_value_set_int (value, filter->thickness);
|
||||||
|
break;
|
||||||
case PROP_HEIGHT:
|
case PROP_HEIGHT:
|
||||||
g_value_set_double (value, filter->height);
|
g_value_set_double (value, filter->height);
|
||||||
break;
|
break;
|
||||||
@ -322,16 +336,13 @@ gst_textwrite_chain (GstPad * pad, GstBuffer * buf)
|
|||||||
filter = GST_textwrite (GST_OBJECT_PARENT (pad));
|
filter = GST_textwrite (GST_OBJECT_PARENT (pad));
|
||||||
|
|
||||||
filter->cvImage->imageData = (char *) GST_BUFFER_DATA (buf);
|
filter->cvImage->imageData = (char *) GST_BUFFER_DATA (buf);
|
||||||
int lineWidth=1;
|
|
||||||
cvInitFont(&(filter->font),CV_FONT_VECTOR0, filter->width,filter->height,0,lineWidth,0);
|
|
||||||
|
|
||||||
|
cvInitFont(&(filter->font),CV_FONT_VECTOR0, filter->width,filter->height,0,filter->thickness,0);
|
||||||
|
|
||||||
cvPutText (filter->cvImage,filter->textbuf,cvPoint(filter->xpos,filter->ypos), &(filter->font), cvScalar(165,14,14,0));
|
cvPutText (filter->cvImage,filter->textbuf,cvPoint(filter->xpos,filter->ypos), &(filter->font), cvScalar(165,14,14,0));
|
||||||
|
|
||||||
|
|
||||||
gst_buffer_set_data (buf, filter->cvImage->imageData,filter->cvImage->imageSize);
|
gst_buffer_set_data (buf, filter->cvImage->imageData,filter->cvImage->imageSize);
|
||||||
|
|
||||||
|
|
||||||
return gst_pad_push (filter->srcpad, buf);
|
return gst_pad_push (filter->srcpad, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ struct _Gsttextwrite
|
|||||||
|
|
||||||
gint xpos;
|
gint xpos;
|
||||||
gint ypos;
|
gint ypos;
|
||||||
|
gint thickness;
|
||||||
gdouble height;
|
gdouble height;
|
||||||
gdouble width;
|
gdouble width;
|
||||||
gchar *textbuf;
|
gchar *textbuf;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user