/* initialize the cvdilate_erode's class */
static void
gst_cv_dilate_erode_class_init (GstCvDilateErodeClass * klass)
{
  GObjectClass *gobject_class;
  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
  GstCaps *caps;
  GstPadTemplate *templ;

  gobject_class = (GObjectClass *) klass;

  gobject_class->set_property = gst_cv_dilate_erode_set_property;
  gobject_class->get_property = gst_cv_dilate_erode_get_property;

  g_object_class_install_property (gobject_class, PROP_ITERATIONS,
      g_param_spec_int ("iterations", "iterations",
          "Number of iterations to run the algorithm", 1, G_MAXINT,
          DEFAULT_ITERATIONS,
          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  /* add sink and source pad templates */
  caps = gst_opencv_caps_from_cv_image_type (CV_16UC1);
  gst_caps_append (caps, gst_opencv_caps_from_cv_image_type (CV_8UC4));
  gst_caps_append (caps, gst_opencv_caps_from_cv_image_type (CV_8UC3));
  gst_caps_append (caps, gst_opencv_caps_from_cv_image_type (CV_8UC1));
  templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
      gst_caps_ref (caps));
  gst_element_class_add_pad_template (element_class, templ);
  templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
  gst_element_class_add_pad_template (element_class, templ);
  gst_caps_unref (caps);
}
static void
gst_cv_dilate_erode_base_init (gpointer gclass)
{
  GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
  GstCaps *caps;
  GstPadTemplate *templ;

  /* add sink and source pad templates */
  caps = gst_opencv_caps_from_cv_image_type (CV_16UC1);
  gst_caps_append (caps, gst_opencv_caps_from_cv_image_type (CV_8UC4));
  gst_caps_append (caps, gst_opencv_caps_from_cv_image_type (CV_8UC3));
  gst_caps_append (caps, gst_opencv_caps_from_cv_image_type (CV_8UC1));
  templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
      gst_caps_ref (caps));
  gst_element_class_add_pad_template (element_class, templ);
  gst_object_unref (templ);
  templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
  gst_element_class_add_pad_template (element_class, templ);
  gst_object_unref (templ);
}
Beispiel #3
0
static void
gst_cv_smooth_base_init (gpointer gclass)
{
  GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
  GstCaps *caps;
  GstPadTemplate *templ;

  gst_element_class_set_details_simple (element_class,
      "cvsmooth",
      "Transform/Effect/Video",
      "Applies cvSmooth OpenCV function to the image",
      "Thiago Santos<*****@*****.**>");

  /* add sink and source pad templates */
  caps = gst_opencv_caps_from_cv_image_type (CV_8UC3);
  gst_caps_append (caps, gst_opencv_caps_from_cv_image_type (CV_8UC1));
  templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
      gst_caps_ref (caps));
  gst_element_class_add_pad_template (element_class, templ);
  gst_object_unref (templ);
  templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
  gst_element_class_add_pad_template (element_class, templ);
  gst_object_unref (templ);
}
/* initialize the cameracalibration's class */
static void
gst_camera_calibrate_class_init (GstCameraCalibrateClass * klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
  GstOpencvVideoFilterClass *opencvfilter_class = GST_OPENCV_VIDEO_FILTER_CLASS (klass);
  GstCaps *caps;
  GstPadTemplate *templ;

  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_camera_calibrate_finalize);
  gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_camera_calibrate_dispose);
  gobject_class->set_property = gst_camera_calibrate_set_property;
  gobject_class->get_property = gst_camera_calibrate_get_property;

  opencvfilter_class->cv_trans_ip_func =
      gst_camera_calibrate_transform_frame_ip;

  g_object_class_install_property (gobject_class, PROP_CALIBRATON_PATTERN,
      g_param_spec_enum ("pattern", "Calibration Pattern",
          "One of the chessboard, circles, or asymmetric circle pattern",
          GST_TYPE_CAMERA_CALIBRATION_PATTERN, DEFAULT_CALIBRATON_PATTERN,
          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_BOARD_WIDTH,
      g_param_spec_int ("board-width", "Board Width",
          "The board width in number of items",
          1, G_MAXINT, DEFAULT_BOARD_WIDTH,
          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_BOARD_HEIGHT,
      g_param_spec_int ("board-height", "Board Height",
          "The board height in number of items",
          1, G_MAXINT, DEFAULT_BOARD_WIDTH,
          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_SQUARE_SIZE,
      g_param_spec_float ("square-size", "Square Size",
          "The size of a square in your defined unit (point, millimeter, etc.)",
          0.0, G_MAXFLOAT, DEFAULT_SQUARE_SIZE,
          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_ASPECT_RATIO,
      g_param_spec_float ("aspect-ratio", "Aspect Ratio",
          "The aspect ratio",
          0.0, G_MAXFLOAT, DEFAULT_ASPECT_RATIO,
          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_CORNER_SUB_PIXEL,
      g_param_spec_boolean ("corner-sub-pixel", "Corner Sub Pixel",
          "Improve corner detection accuracy for chessboard",
          DEFAULT_CORNER_SUB_PIXEL, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_ZERO_TANGENT_DISTORTION,
      g_param_spec_boolean ("zero-tangent-distorsion", "Zero Tangent Distorsion",
          "Assume zero tangential distortion",
          DEFAULT_ZERO_TANGENT_DISTORTION, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_CENTER_PRINCIPAL_POINT,
      g_param_spec_boolean ("center-principal-point", "Center Principal Point",
          "Fix the principal point at the center",
          DEFAULT_CENTER_PRINCIPAL_POINT, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_USE_FISHEYE,
      g_param_spec_boolean ("use-fisheye", "Use Fisheye",
          "Use fisheye camera model for calibration",
          DEFAULT_USE_FISHEYE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_DELAY,
      g_param_spec_int ("delay", "Delay",
          "Sampling periodicity in ms", 0, G_MAXINT,
          DEFAULT_DELAY,
          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_FRAME_COUNT,
      g_param_spec_int ("frame-count", "Frame Count",
          "The number of frames to use from the input for calibration", 1, G_MAXINT,
          DEFAULT_FRAME_COUNT,
          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_SHOW_CORNERS,
      g_param_spec_boolean ("show-corners", "Show Corners",
          "Show corners",
          DEFAULT_SHOW_CORNERS, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));

  g_object_class_install_property (gobject_class, PROP_SETTINGS,
      g_param_spec_string ("settings", "Settings",
          "Camera correction parameters (opaque string of serialized OpenCV objects)",
          NULL, (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));

  gst_element_class_set_static_metadata (element_class,
      "cameracalibrate",
      "Filter/Effect/Video",
      "Performs camera calibration",
      "Philippe Renon <*****@*****.**>");

  /* add sink and source pad templates */
  caps = gst_opencv_caps_from_cv_image_type (CV_8UC4);
  gst_caps_append (caps, gst_opencv_caps_from_cv_image_type (CV_8UC3));
  gst_caps_append (caps, gst_opencv_caps_from_cv_image_type (CV_8UC1));
  templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
      gst_caps_ref (caps));
  gst_element_class_add_pad_template (element_class, templ);
  templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
  gst_element_class_add_pad_template (element_class, templ);
}
Beispiel #5
0
/* initialize the cvsmooth's class */
static void
gst_cv_smooth_class_init (GstCvSmoothClass * klass)
{
  GObjectClass *gobject_class;
  GstOpencvBaseTransformClass *gstopencvbasefilter_class;
  GstElementClass *gstelement_class;
  GstCaps * caps;
  GstPadTemplate * templ;

  gobject_class = (GObjectClass *) klass;
  gstelement_class = (GstElementClass *) klass;
  gstopencvbasefilter_class = (GstOpencvBaseTransformClass *) klass;

  parent_class = g_type_class_peek_parent (klass);

  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_cv_smooth_finalize);
  gobject_class->set_property = gst_cv_smooth_set_property;
  gobject_class->get_property = gst_cv_smooth_get_property;

  /* add sink and source pad templates */
  caps = gst_opencv_caps_from_cv_image_type (CV_8UC1);
  gst_caps_append (caps, gst_opencv_caps_from_cv_image_type (CV_8UC3));
  templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
      gst_caps_ref (caps));
  gst_element_class_add_pad_template (gstelement_class, templ);
  templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
  gst_element_class_add_pad_template (gstelement_class, templ);

  gstopencvbasefilter_class->cv_trans_ip_func = gst_cv_smooth_transform_ip;
  gstopencvbasefilter_class->cv_trans_func = gst_cv_smooth_transform;

  g_object_class_install_property (gobject_class, PROP_SMOOTH_TYPE,
      g_param_spec_enum ("type",
          "type",
          "Smooth Type",
          GST_TYPE_CV_SMOOTH_TYPE,
          DEFAULT_CV_SMOOTH_TYPE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
      );
  g_object_class_install_property (gobject_class, PROP_PARAM1,
      g_param_spec_int ("param1", "param1 (aperture width)",
          "The aperture width (Must be positive and odd)."
          "Check cvSmooth OpenCV docs: http://opencv.willowgarage.com"
          "/documentation/image_filtering.html#cvSmooth", 1, G_MAXINT,
          DEFAULT_PARAM1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
  g_object_class_install_property (gobject_class, PROP_PARAM2,
      g_param_spec_int ("param2", "param2 (aperture height)",
          "The aperture height, if zero, the width is used."
          "(Must be positive and odd or zero, unuset in median and bilateral "
          "types). Check cvSmooth OpenCV docs: http://opencv.willowgarage.com"
          "/documentation/image_filtering.html#cvSmooth", 0, G_MAXINT,
          DEFAULT_PARAM2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
  g_object_class_install_property (gobject_class, PROP_PARAM3,
      g_param_spec_double ("param3", "param3 (gaussian standard deviation or "
          "color sigma",
          "If type is gaussian, this means the standard deviation."
          "If type is bilateral, this means the color-sigma. If zero, "
          "Default values are used."
          "Check cvSmooth OpenCV docs: http://opencv.willowgarage.com"
          "/documentation/image_filtering.html#cvSmooth",
          0, G_MAXDOUBLE, DEFAULT_PARAM3,
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
  g_object_class_install_property (gobject_class, PROP_PARAM4,
      g_param_spec_double ("param4", "param4 (spatial sigma, bilateral only)",
          "Only used in bilateral type, means the spatial-sigma."
          "Check cvSmooth OpenCV docs: http://opencv.willowgarage.com"
          "/documentation/image_filtering.html#cvSmooth",
          0, G_MAXDOUBLE, DEFAULT_PARAM4,
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}