opencv: fix indentation

This commit is contained in:
Nicola Murino 2018-11-25 16:12:40 +01:00 committed by Nicolas Dufresne
parent 2fd3130350
commit 890dbb560f
16 changed files with 463 additions and 337 deletions

View File

@ -22,7 +22,8 @@
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
gchar * gchar *
camera_serialize_undistort_settings (cv::Mat &cameraMatrix, cv::Mat &distCoeffs) camera_serialize_undistort_settings (cv::Mat & cameraMatrix,
cv::Mat & distCoeffs)
{ {
cv::FileStorage fs (".xml", cv::FileStorage::WRITE + cv::FileStorage::MEMORY); cv::FileStorage fs (".xml", cv::FileStorage::WRITE + cv::FileStorage::MEMORY);
fs << "cameraMatrix" << cameraMatrix; fs << "cameraMatrix" << cameraMatrix;
@ -33,7 +34,8 @@ camera_serialize_undistort_settings (cv::Mat &cameraMatrix, cv::Mat &distCoeffs)
} }
gboolean gboolean
camera_deserialize_undistort_settings (gchar * str, cv::Mat &cameraMatrix, cv::Mat &distCoeffs) camera_deserialize_undistort_settings (gchar * str, cv::Mat & cameraMatrix,
cv::Mat & distCoeffs)
{ {
cv::FileStorage fs (str, cv::FileStorage::READ + cv::FileStorage::MEMORY); cv::FileStorage fs (str, cv::FileStorage::READ + cv::FileStorage::MEMORY);
fs["cameraMatrix"] >> cameraMatrix; fs["cameraMatrix"] >> cameraMatrix;

View File

@ -128,7 +128,8 @@ enum
PROP_SETTINGS PROP_SETTINGS
}; };
enum { enum
{
DETECTION = 0, DETECTION = 0,
CAPTURING = 1, CAPTURING = 1,
CALIBRATED = 2 CALIBRATED = 2
@ -142,19 +143,23 @@ camera_calibration_pattern_get_type (void)
static GType camera_calibration_pattern_type = 0; static GType camera_calibration_pattern_type = 0;
static const GEnumValue camera_calibration_pattern[] = { static const GEnumValue camera_calibration_pattern[] = {
{GST_CAMERA_CALIBRATION_PATTERN_CHESSBOARD, "Chessboard", "chessboard"}, {GST_CAMERA_CALIBRATION_PATTERN_CHESSBOARD, "Chessboard", "chessboard"},
{GST_CAMERA_CALIBRATION_PATTERN_CIRCLES_GRID, "Circle Grids", "circle_grids"}, {GST_CAMERA_CALIBRATION_PATTERN_CIRCLES_GRID, "Circle Grids",
{GST_CAMERA_CALIBRATION_PATTERN_ASYMMETRIC_CIRCLES_GRID, "Asymmetric Circle Grids", "asymmetric_circle_grids"}, "circle_grids"},
{GST_CAMERA_CALIBRATION_PATTERN_ASYMMETRIC_CIRCLES_GRID,
"Asymmetric Circle Grids", "asymmetric_circle_grids"},
{0, NULL, NULL}, {0, NULL, NULL},
}; };
if (!camera_calibration_pattern_type) { if (!camera_calibration_pattern_type) {
camera_calibration_pattern_type = camera_calibration_pattern_type =
g_enum_register_static ("GstCameraCalibrationPattern", camera_calibration_pattern); g_enum_register_static ("GstCameraCalibrationPattern",
camera_calibration_pattern);
} }
return camera_calibration_pattern_type; return camera_calibration_pattern_type;
} }
G_DEFINE_TYPE (GstCameraCalibrate, gst_camera_calibrate, GST_TYPE_OPENCV_VIDEO_FILTER); G_DEFINE_TYPE (GstCameraCalibrate, gst_camera_calibrate,
GST_TYPE_OPENCV_VIDEO_FILTER);
static void gst_camera_calibrate_dispose (GObject * object); static void gst_camera_calibrate_dispose (GObject * object);
static void gst_camera_calibrate_set_property (GObject * object, guint prop_id, static void gst_camera_calibrate_set_property (GObject * object, guint prop_id,
@ -162,8 +167,9 @@ static void gst_camera_calibrate_set_property (GObject * object, guint prop_id,
static void gst_camera_calibrate_get_property (GObject * object, guint prop_id, static void gst_camera_calibrate_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_camera_calibrate_transform_frame_ip ( static GstFlowReturn
GstOpencvVideoFilter * cvfilter, GstBuffer * frame, IplImage * img); gst_camera_calibrate_transform_frame_ip (GstOpencvVideoFilter * cvfilter,
GstBuffer * frame, IplImage * img);
/* clean up */ /* clean up */
static void static void
@ -178,7 +184,8 @@ gst_camera_calibrate_class_init (GstCameraCalibrateClass * klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstOpencvVideoFilterClass *opencvfilter_class = GST_OPENCV_VIDEO_FILTER_CLASS (klass); GstOpencvVideoFilterClass *opencvfilter_class =
GST_OPENCV_VIDEO_FILTER_CLASS (klass);
GstCaps *caps; GstCaps *caps;
GstPadTemplate *templ; GstPadTemplate *templ;
@ -223,22 +230,26 @@ gst_camera_calibrate_class_init (GstCameraCalibrateClass * klass)
g_object_class_install_property (gobject_class, PROP_CORNER_SUB_PIXEL, g_object_class_install_property (gobject_class, PROP_CORNER_SUB_PIXEL,
g_param_spec_boolean ("corner-sub-pixel", "Corner Sub Pixel", g_param_spec_boolean ("corner-sub-pixel", "Corner Sub Pixel",
"Improve corner detection accuracy for chessboard", "Improve corner detection accuracy for chessboard",
DEFAULT_CORNER_SUB_PIXEL, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_CORNER_SUB_PIXEL,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_ZERO_TANGENT_DISTORTION, g_object_class_install_property (gobject_class, PROP_ZERO_TANGENT_DISTORTION,
g_param_spec_boolean ("zero-tangent-distorsion", "Zero Tangent Distorsion", g_param_spec_boolean ("zero-tangent-distorsion",
"Assume zero tangential distortion", "Zero Tangent Distorsion", "Assume zero tangential distortion",
DEFAULT_ZERO_TANGENT_DISTORTION, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_ZERO_TANGENT_DISTORTION,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_CENTER_PRINCIPAL_POINT, g_object_class_install_property (gobject_class, PROP_CENTER_PRINCIPAL_POINT,
g_param_spec_boolean ("center-principal-point", "Center Principal Point", g_param_spec_boolean ("center-principal-point", "Center Principal Point",
"Fix the principal point at the center", "Fix the principal point at the center",
DEFAULT_CENTER_PRINCIPAL_POINT, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_CENTER_PRINCIPAL_POINT,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_USE_FISHEYE, g_object_class_install_property (gobject_class, PROP_USE_FISHEYE,
g_param_spec_boolean ("use-fisheye", "Use Fisheye", g_param_spec_boolean ("use-fisheye", "Use Fisheye",
"Use fisheye camera model for calibration", "Use fisheye camera model for calibration",
DEFAULT_USE_FISHEYE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_USE_FISHEYE,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_DELAY, g_object_class_install_property (gobject_class, PROP_DELAY,
g_param_spec_int ("delay", "Delay", g_param_spec_int ("delay", "Delay",
@ -248,14 +259,15 @@ gst_camera_calibrate_class_init (GstCameraCalibrateClass * klass)
g_object_class_install_property (gobject_class, PROP_FRAME_COUNT, g_object_class_install_property (gobject_class, PROP_FRAME_COUNT,
g_param_spec_int ("frame-count", "Frame Count", g_param_spec_int ("frame-count", "Frame Count",
"The number of frames to use from the input for calibration", 1, G_MAXINT, "The number of frames to use from the input for calibration", 1,
DEFAULT_FRAME_COUNT, G_MAXINT, DEFAULT_FRAME_COUNT,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_SHOW_CORNERS, g_object_class_install_property (gobject_class, PROP_SHOW_CORNERS,
g_param_spec_boolean ("show-corners", "Show Corners", g_param_spec_boolean ("show-corners", "Show Corners",
"Show corners", "Show corners",
DEFAULT_SHOW_CORNERS, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_SHOW_CORNERS,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_SETTINGS, g_object_class_install_property (gobject_class, PROP_SETTINGS,
g_param_spec_string ("settings", "Settings", g_param_spec_string ("settings", "Settings",
@ -299,15 +311,20 @@ gst_camera_calibrate_init (GstCameraCalibrate * calib)
calib->showCorners = DEFAULT_SHOW_CORNERS; calib->showCorners = DEFAULT_SHOW_CORNERS;
calib->flags = cv::CALIB_FIX_K4 | cv::CALIB_FIX_K5; calib->flags = cv::CALIB_FIX_K4 | cv::CALIB_FIX_K5;
if (calib->calibFixPrincipalPoint) calib->flags |= cv::CALIB_FIX_PRINCIPAL_POINT; if (calib->calibFixPrincipalPoint)
if (calib->calibZeroTangentDist) calib->flags |= cv::CALIB_ZERO_TANGENT_DIST; calib->flags |= cv::CALIB_FIX_PRINCIPAL_POINT;
if (calib->aspectRatio) calib->flags |= cv::CALIB_FIX_ASPECT_RATIO; if (calib->calibZeroTangentDist)
calib->flags |= cv::CALIB_ZERO_TANGENT_DIST;
if (calib->aspectRatio)
calib->flags |= cv::CALIB_FIX_ASPECT_RATIO;
if (calib->useFisheye) { if (calib->useFisheye) {
/* the fisheye model has its own enum, so overwrite the flags */ /* the fisheye model has its own enum, so overwrite the flags */
calib->flags = cv::fisheye::CALIB_FIX_SKEW | cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC | calib->flags =
cv::fisheye::CALIB_FIX_SKEW | cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC |
/*cv::fisheye::CALIB_FIX_K1 | */ /*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; calib->mode = CAPTURING; //DETECTION;
@ -319,8 +336,8 @@ gst_camera_calibrate_init (GstCameraCalibrate * calib)
calib->settings = NULL; calib->settings = NULL;
gst_opencv_video_filter_set_in_place ( gst_opencv_video_filter_set_in_place (GST_OPENCV_VIDEO_FILTER_CAST (calib),
GST_OPENCV_VIDEO_FILTER_CAST (calib), TRUE); TRUE);
} }
static void static void
@ -455,7 +472,8 @@ bool camera_calibrate_calibrate(GstCameraCalibrate *calib,
cv::Size imageSize, cv::Mat & cameraMatrix, cv::Mat & distCoeffs, cv::Size imageSize, cv::Mat & cameraMatrix, cv::Mat & distCoeffs,
std::vector < std::vector < cv::Point2f > >imagePoints); std::vector < std::vector < cv::Point2f > >imagePoints);
void camera_calibrate_run(GstCameraCalibrate *calib, IplImage *img) void
camera_calibrate_run (GstCameraCalibrate * calib, IplImage * img)
{ {
cv::Mat view = cv::cvarrToMat (img); cv::Mat view = cv::cvarrToMat (img);
@ -473,7 +491,8 @@ void camera_calibrate_run(GstCameraCalibrate *calib, IplImage *img)
std::vector < cv::Point2f > pointBuf; std::vector < cv::Point2f > pointBuf;
bool found; bool found;
int chessBoardFlags = cv::CALIB_CB_ADAPTIVE_THRESH | cv::CALIB_CB_NORMALIZE_IMAGE; int chessBoardFlags =
cv::CALIB_CB_ADAPTIVE_THRESH | cv::CALIB_CB_NORMALIZE_IMAGE;
if (!calib->useFisheye) { if (!calib->useFisheye) {
/* fast check erroneously fails with high distortions like fisheye */ /* fast check erroneously fails with high distortions like fisheye */
@ -483,13 +502,17 @@ void camera_calibrate_run(GstCameraCalibrate *calib, IplImage *img)
/* Find feature points on the input format */ /* Find feature points on the input format */
switch (calib->calibrationPattern) { switch (calib->calibrationPattern) {
case GST_CAMERA_CALIBRATION_PATTERN_CHESSBOARD: case GST_CAMERA_CALIBRATION_PATTERN_CHESSBOARD:
found = cv::findChessboardCorners(view, calib->boardSize, pointBuf, chessBoardFlags); found =
cv::findChessboardCorners (view, calib->boardSize, pointBuf,
chessBoardFlags);
break; break;
case GST_CAMERA_CALIBRATION_PATTERN_CIRCLES_GRID: case GST_CAMERA_CALIBRATION_PATTERN_CIRCLES_GRID:
found = cv::findCirclesGrid (view, calib->boardSize, pointBuf); found = cv::findCirclesGrid (view, calib->boardSize, pointBuf);
break; break;
case GST_CAMERA_CALIBRATION_PATTERN_ASYMMETRIC_CIRCLES_GRID: case GST_CAMERA_CALIBRATION_PATTERN_ASYMMETRIC_CIRCLES_GRID:
found = cv::findCirclesGrid(view, calib->boardSize, pointBuf, cv::CALIB_CB_ASYMMETRIC_GRID ); found =
cv::findCirclesGrid (view, calib->boardSize, pointBuf,
cv::CALIB_CB_ASYMMETRIC_GRID);
break; break;
default: default:
found = FALSE; found = FALSE;
@ -499,18 +522,23 @@ void camera_calibrate_run(GstCameraCalibrate *calib, IplImage *img)
bool blinkOutput = FALSE; bool blinkOutput = FALSE;
if (found) { if (found) {
/* improve the found corners' coordinate accuracy for chessboard */ /* improve the found corners' coordinate accuracy for chessboard */
if (calib->calibrationPattern == GST_CAMERA_CALIBRATION_PATTERN_CHESSBOARD && calib->cornerSubPix) { if (calib->calibrationPattern == GST_CAMERA_CALIBRATION_PATTERN_CHESSBOARD
&& calib->cornerSubPix) {
/* FIXME findChessboardCorners and alike do a cv::COLOR_BGR2GRAY (and a histogram balance) /* FIXME findChessboardCorners and alike do a cv::COLOR_BGR2GRAY (and a histogram balance)
* the color convert should be done once (if needed) and shared * the color convert should be done once (if needed) and shared
* FIXME keep viewGray around to avoid reallocating it each time... */ * FIXME keep viewGray around to avoid reallocating it each time... */
cv::Mat viewGray; cv::Mat viewGray;
cv::cvtColor (view, viewGray, cv::COLOR_BGR2GRAY); cv::cvtColor (view, viewGray, cv::COLOR_BGR2GRAY);
cv::cornerSubPix(viewGray, pointBuf, cv::Size(11, 11), cv::Size(-1, -1), cv::cornerSubPix (viewGray, pointBuf, cv::Size (11, 11), cv::Size (-1,
cv::TermCriteria(cv::TermCriteria::EPS + cv::TermCriteria::COUNT, 30, 0.1)); -1),
cv::TermCriteria (cv::TermCriteria::EPS + cv::TermCriteria::COUNT,
30, 0.1));
} }
/* take new samples after delay time */ /* take new samples after delay time */
if ((calib->mode == CAPTURING) && ((clock() - calib->prevTimestamp) > calib->delay * 1e-3 * CLOCKS_PER_SEC)) { if ((calib->mode == CAPTURING)
&& ((clock () - calib->prevTimestamp) >
calib->delay * 1e-3 * CLOCKS_PER_SEC)) {
calib->imagePoints.push_back (pointBuf); calib->imagePoints.push_back (pointBuf);
calib->prevTimestamp = clock (); calib->prevTimestamp = clock ();
blinkOutput = true; blinkOutput = true;
@ -518,14 +546,17 @@ void camera_calibrate_run(GstCameraCalibrate *calib, IplImage *img)
/* draw the corners */ /* draw the corners */
if (calib->showCorners) { if (calib->showCorners) {
cv::drawChessboardCorners(view, calib->boardSize, cv::Mat(pointBuf), found); cv::drawChessboardCorners (view, calib->boardSize, cv::Mat (pointBuf),
found);
} }
} }
/* if got enough frames then stop calibration and show result */ /* if got enough frames then stop calibration and show result */
if (calib->mode == CAPTURING && calib->imagePoints.size() >= (size_t)calib->nrFrames) { if (calib->mode == CAPTURING
&& calib->imagePoints.size () >= (size_t) calib->nrFrames) {
if (camera_calibrate_calibrate(calib, imageSize, calib->cameraMatrix, calib->distCoeffs, calib->imagePoints)) { if (camera_calibrate_calibrate (calib, imageSize, calib->cameraMatrix,
calib->distCoeffs, calib->imagePoints)) {
calib->mode = CALIBRATED; calib->mode = CALIBRATED;
GstPad *sink_pad = GST_BASE_TRANSFORM_SINK_PAD (calib); GstPad *sink_pad = GST_BASE_TRANSFORM_SINK_PAD (calib);
@ -535,21 +566,27 @@ void camera_calibrate_run(GstCameraCalibrate *calib, IplImage *img)
/* set settings property */ /* set settings property */
g_free (calib->settings); g_free (calib->settings);
calib->settings = camera_serialize_undistort_settings(calib->cameraMatrix, calib->distCoeffs); calib->settings =
camera_serialize_undistort_settings (calib->cameraMatrix,
calib->distCoeffs);
/* create calibrated event and send upstream and downstream */ /* create calibrated event and send upstream and downstream */
sink_event = gst_camera_event_new_calibrated (calib->settings); sink_event = gst_camera_event_new_calibrated (calib->settings);
GST_LOG_OBJECT (sink_pad, "Sending upstream event %s.", GST_EVENT_TYPE_NAME (sink_event)); GST_LOG_OBJECT (sink_pad, "Sending upstream event %s.",
GST_EVENT_TYPE_NAME (sink_event));
if (!gst_pad_push_event (sink_pad, sink_event)) { if (!gst_pad_push_event (sink_pad, sink_event)) {
GST_WARNING_OBJECT (sink_pad, "Sending upstream event %p (%s) failed.", GST_WARNING_OBJECT (sink_pad,
sink_event, GST_EVENT_TYPE_NAME (sink_event)); "Sending upstream event %p (%s) failed.", sink_event,
GST_EVENT_TYPE_NAME (sink_event));
} }
src_event = gst_camera_event_new_calibrated (calib->settings); src_event = gst_camera_event_new_calibrated (calib->settings);
GST_LOG_OBJECT (src_pad, "Sending downstream event %s.", GST_EVENT_TYPE_NAME (src_event)); GST_LOG_OBJECT (src_pad, "Sending downstream event %s.",
GST_EVENT_TYPE_NAME (src_event));
if (!gst_pad_push_event (src_pad, src_event)) { if (!gst_pad_push_event (src_pad, src_event)) {
GST_WARNING_OBJECT (src_pad, "Sending downstream event %p (%s) failed.", GST_WARNING_OBJECT (src_pad,
src_event, GST_EVENT_TYPE_NAME (src_event)); "Sending downstream event %p (%s) failed.", src_event,
GST_EVENT_TYPE_NAME (src_event));
} }
} else { } else {
/* failed to calibrate, go back to detection mode */ /* failed to calibrate, go back to detection mode */
@ -573,20 +610,24 @@ void camera_calibrate_run(GstCameraCalibrate *calib, IplImage *img)
(calib->mode == CALIBRATED) ? "Calibrated" : "Waiting..."; (calib->mode == CALIBRATED) ? "Calibrated" : "Waiting...";
int baseLine = 0; int baseLine = 0;
cv::Size textSize = cv::getTextSize (msg, 1, 1, 1, &baseLine); cv::Size textSize = cv::getTextSize (msg, 1, 1, 1, &baseLine);
cv::Point textOrigin(view.cols - 2 * textSize.width - 10, view.rows - 2 * baseLine - 10); cv::Point textOrigin (view.cols - 2 * textSize.width - 10,
view.rows - 2 * baseLine - 10);
if (calib->mode == CAPTURING) { if (calib->mode == CAPTURING) {
msg = cv::format("%d/%d", (int)calib->imagePoints.size(), calib->nrFrames); msg =
cv::format ("%d/%d", (int) calib->imagePoints.size (), calib->nrFrames);
} }
const cv::Scalar RED (0, 0, 255); const cv::Scalar RED (0, 0, 255);
const cv::Scalar GREEN (0, 255, 0); const cv::Scalar GREEN (0, 255, 0);
cv::putText(view, msg, textOrigin, 1, 1, calib->mode == CALIBRATED ? GREEN : RED); cv::putText (view, msg, textOrigin, 1, 1,
calib->mode == CALIBRATED ? GREEN : RED);
} }
static double camera_calibrate_calc_reprojection_errors ( static double
const std::vector<std::vector<cv::Point3f> >& objectPoints, camera_calibrate_calc_reprojection_errors (const std::vector < std::vector <
cv::Point3f > >&objectPoints,
const std::vector < std::vector < cv::Point2f > >&imagePoints, const std::vector < std::vector < cv::Point2f > >&imagePoints,
const std::vector < cv::Mat > &rvecs, const std::vector < cv::Mat > &tvecs, const std::vector < cv::Mat > &rvecs, const std::vector < cv::Mat > &tvecs,
const cv::Mat & cameraMatrix, const cv::Mat & distCoeffs, const cv::Mat & cameraMatrix, const cv::Mat & distCoeffs,
@ -597,15 +638,11 @@ static double camera_calibrate_calc_reprojection_errors (
double totalErr = 0, err; double totalErr = 0, err;
perViewErrors.resize (objectPoints.size ()); perViewErrors.resize (objectPoints.size ());
for(size_t i = 0; i < objectPoints.size(); ++i) for (size_t i = 0; i < objectPoints.size (); ++i) {
{ if (fisheye) {
if (fisheye)
{
cv::fisheye::projectPoints (objectPoints[i], imagePoints2, cv::fisheye::projectPoints (objectPoints[i], imagePoints2,
rvecs[i], tvecs[i], cameraMatrix, distCoeffs); rvecs[i], tvecs[i], cameraMatrix, distCoeffs);
} } else {
else
{
cv::projectPoints (objectPoints[i], rvecs[i], tvecs[i], cv::projectPoints (objectPoints[i], rvecs[i], tvecs[i],
cameraMatrix, distCoeffs, imagePoints2); cameraMatrix, distCoeffs, imagePoints2);
} }
@ -620,7 +657,8 @@ static double camera_calibrate_calc_reprojection_errors (
return std::sqrt (totalErr / totalPoints); return std::sqrt (totalErr / totalPoints);
} }
static void camera_calibrate_calc_corners (cv::Size boardSize, float squareSize, static void
camera_calibrate_calc_corners (cv::Size boardSize, float squareSize,
std::vector < cv::Point3f > &corners, gint patternType /*= CHESSBOARD*/ ) std::vector < cv::Point3f > &corners, gint patternType /*= CHESSBOARD*/ )
{ {
corners.clear (); corners.clear ();
@ -635,14 +673,16 @@ static void camera_calibrate_calc_corners (cv::Size boardSize, float squareSize,
case GST_CAMERA_CALIBRATION_PATTERN_ASYMMETRIC_CIRCLES_GRID: case GST_CAMERA_CALIBRATION_PATTERN_ASYMMETRIC_CIRCLES_GRID:
for (int i = 0; i < boardSize.height; i++) for (int i = 0; i < boardSize.height; i++)
for (int j = 0; j < boardSize.width; j++) for (int j = 0; j < boardSize.width; j++)
corners.push_back(cv::Point3f((2 * j + i % 2) * squareSize, i * squareSize, 0)); corners.push_back (cv::Point3f ((2 * j + i % 2) * squareSize,
i * squareSize, 0));
break; break;
default: default:
break; break;
} }
} }
static bool camera_calibrate_calibrate_full(GstCameraCalibrate *calib, static bool
camera_calibrate_calibrate_full (GstCameraCalibrate * calib,
cv::Size & imageSize, cv::Mat & cameraMatrix, cv::Mat & distCoeffs, cv::Size & imageSize, cv::Mat & cameraMatrix, cv::Mat & distCoeffs,
std::vector < std::vector < cv::Point2f > >imagePoints, std::vector < std::vector < cv::Point2f > >imagePoints,
std::vector < cv::Mat > &rvecs, std::vector < cv::Mat > &tvecs, std::vector < cv::Mat > &rvecs, std::vector < cv::Mat > &tvecs,
@ -688,13 +728,15 @@ static bool camera_calibrate_calibrate_full(GstCameraCalibrate *calib,
bool ok = checkRange (cameraMatrix) && checkRange (distCoeffs); bool ok = checkRange (cameraMatrix) && checkRange (distCoeffs);
totalAvgErr = camera_calibrate_calc_reprojection_errors (objectPoints, imagePoints, totalAvgErr =
camera_calibrate_calc_reprojection_errors (objectPoints, imagePoints,
rvecs, tvecs, cameraMatrix, distCoeffs, reprojErrs, calib->useFisheye); rvecs, tvecs, cameraMatrix, distCoeffs, reprojErrs, calib->useFisheye);
return ok; return ok;
} }
bool camera_calibrate_calibrate(GstCameraCalibrate *calib, bool
camera_calibrate_calibrate (GstCameraCalibrate * calib,
cv::Size imageSize, cv::Mat & cameraMatrix, cv::Mat & distCoeffs, cv::Size imageSize, cv::Mat & cameraMatrix, cv::Mat & distCoeffs,
std::vector < std::vector < cv::Point2f > >imagePoints) std::vector < std::vector < cv::Point2f > >imagePoints)
{ {
@ -720,8 +762,7 @@ gst_camera_calibrate_plugin_init (GstPlugin * plugin)
{ {
/* debug category for filtering log messages */ /* debug category for filtering log messages */
GST_DEBUG_CATEGORY_INIT (gst_camera_calibrate_debug, "cameracalibrate", GST_DEBUG_CATEGORY_INIT (gst_camera_calibrate_debug, "cameracalibrate",
0, 0, "Performs camera calibration");
"Performs camera calibration");
return gst_element_register (plugin, "cameracalibrate", GST_RANK_NONE, return gst_element_register (plugin, "cameracalibrate", GST_RANK_NONE,
GST_TYPE_CAMERA_CALIBRATE); GST_TYPE_CAMERA_CALIBRATE);

View File

@ -98,7 +98,8 @@ enum
PROP_SETTINGS PROP_SETTINGS
}; };
G_DEFINE_TYPE (GstCameraUndistort, gst_camera_undistort, GST_TYPE_OPENCV_VIDEO_FILTER); G_DEFINE_TYPE (GstCameraUndistort, gst_camera_undistort,
GST_TYPE_OPENCV_VIDEO_FILTER);
static void gst_camera_undistort_dispose (GObject * object); static void gst_camera_undistort_dispose (GObject * object);
static void gst_camera_undistort_set_property (GObject * object, guint prop_id, static void gst_camera_undistort_set_property (GObject * object, guint prop_id,
@ -109,16 +110,19 @@ static void gst_camera_undistort_get_property (GObject * object, guint prop_id,
static gboolean gst_camera_undistort_set_info (GstOpencvVideoFilter * cvfilter, static gboolean gst_camera_undistort_set_info (GstOpencvVideoFilter * cvfilter,
gint in_width, gint in_height, gint in_depth, gint in_channels, gint in_width, gint in_height, gint in_depth, gint in_channels,
gint out_width, gint out_height, gint out_depth, gint out_channels); gint out_width, gint out_height, gint out_depth, gint out_channels);
static GstFlowReturn gst_camera_undistort_transform_frame ( static GstFlowReturn gst_camera_undistort_transform_frame (GstOpencvVideoFilter
GstOpencvVideoFilter * cvfilter, * cvfilter, GstBuffer * frame, IplImage * img, GstBuffer * outframe,
GstBuffer * frame, IplImage * img, IplImage * outimg);
GstBuffer * outframe, IplImage * outimg);
static gboolean gst_camera_undistort_sink_event (GstBaseTransform *trans, GstEvent *event); static gboolean gst_camera_undistort_sink_event (GstBaseTransform * trans,
static gboolean gst_camera_undistort_src_event (GstBaseTransform *trans, GstEvent *event); GstEvent * event);
static gboolean gst_camera_undistort_src_event (GstBaseTransform * trans,
GstEvent * event);
static void camera_undistort_run(GstCameraUndistort *undist, IplImage *img, IplImage *outimg); static void camera_undistort_run (GstCameraUndistort * undist, IplImage * img,
static gboolean camera_undistort_init_undistort_rectify_map(GstCameraUndistort *undist); IplImage * outimg);
static gboolean camera_undistort_init_undistort_rectify_map (GstCameraUndistort
* undist);
/* initialize the cameraundistort's class */ /* initialize the cameraundistort's class */
static void static void
@ -127,7 +131,8 @@ gst_camera_undistort_class_init (GstCameraUndistortClass * klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass); GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass);
GstOpencvVideoFilterClass *opencvfilter_class = GST_OPENCV_VIDEO_FILTER_CLASS (klass); GstOpencvVideoFilterClass *opencvfilter_class =
GST_OPENCV_VIDEO_FILTER_CLASS (klass);
GstCaps *caps; GstCaps *caps;
GstPadTemplate *templ; GstPadTemplate *templ;
@ -136,19 +141,17 @@ gst_camera_undistort_class_init (GstCameraUndistortClass * klass)
gobject_class->set_property = gst_camera_undistort_set_property; gobject_class->set_property = gst_camera_undistort_set_property;
gobject_class->get_property = gst_camera_undistort_get_property; gobject_class->get_property = gst_camera_undistort_get_property;
trans_class->sink_event = trans_class->sink_event = GST_DEBUG_FUNCPTR (gst_camera_undistort_sink_event);
GST_DEBUG_FUNCPTR (gst_camera_undistort_sink_event); trans_class->src_event = GST_DEBUG_FUNCPTR (gst_camera_undistort_src_event);
trans_class->src_event =
GST_DEBUG_FUNCPTR (gst_camera_undistort_src_event);
opencvfilter_class->cv_set_caps = gst_camera_undistort_set_info; opencvfilter_class->cv_set_caps = gst_camera_undistort_set_info;
opencvfilter_class->cv_trans_func = opencvfilter_class->cv_trans_func = gst_camera_undistort_transform_frame;
gst_camera_undistort_transform_frame;
g_object_class_install_property (gobject_class, PROP_SHOW_UNDISTORTED, g_object_class_install_property (gobject_class, PROP_SHOW_UNDISTORTED,
g_param_spec_boolean ("undistort", "Apply camera corrections", g_param_spec_boolean ("undistort", "Apply camera corrections",
"Apply camera corrections", "Apply camera corrections",
DEFAULT_SHOW_UNDISTORTED, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_SHOW_UNDISTORTED,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_ALPHA, g_object_class_install_property (gobject_class, PROP_ALPHA,
g_param_spec_float ("alpha", "Pixels", g_param_spec_float ("alpha", "Pixels",
@ -164,8 +167,7 @@ gst_camera_undistort_class_init (GstCameraUndistortClass * klass)
gst_element_class_set_static_metadata (element_class, gst_element_class_set_static_metadata (element_class,
"cameraundistort", "cameraundistort",
"Filter/Effect/Video", "Filter/Effect/Video",
"Performs camera undistort", "Performs camera undistort", "Philippe Renon <philippe_renon@yahoo.fr>");
"Philippe Renon <philippe_renon@yahoo.fr>");
/* add sink and source pad templates */ /* add sink and source pad templates */
caps = gst_opencv_caps_from_cv_image_type (CV_16UC1); caps = gst_opencv_caps_from_cv_image_type (CV_16UC1);
@ -275,9 +277,12 @@ gst_camera_undistort_get_property (GObject * object, guint prop_id,
gboolean gboolean
gst_camera_undistort_set_info (GstOpencvVideoFilter * cvfilter, gst_camera_undistort_set_info (GstOpencvVideoFilter * cvfilter,
gint in_width, gint in_height, gint in_width, gint in_height,
__attribute__((unused)) gint in_depth, __attribute__((unused)) gint in_channels, __attribute__((unused)) gint in_depth,
__attribute__((unused)) gint out_width, __attribute__((unused)) gint out_height, __attribute__((unused)) gint in_channels,
__attribute__((unused)) gint out_depth, __attribute__((unused)) gint out_channels) __attribute__((unused)) gint out_width,
__attribute__((unused)) gint out_height,
__attribute__((unused)) gint out_depth,
__attribute__((unused)) gint out_channels)
{ {
GstCameraUndistort *undist = GST_CAMERA_UNDISTORT (cvfilter); GstCameraUndistort *undist = GST_CAMERA_UNDISTORT (cvfilter);
@ -302,7 +307,8 @@ gst_camera_undistort_transform_frame (GstOpencvVideoFilter * cvfilter,
} }
static void static void
camera_undistort_run (GstCameraUndistort *undist, IplImage *img, IplImage *outimg) camera_undistort_run (GstCameraUndistort * undist, IplImage * img,
IplImage * outimg)
{ {
const cv::Mat view = cv::cvarrToMat (img); const cv::Mat view = cv::cvarrToMat (img);
cv::Mat outview = cv::cvarrToMat (outimg); cv::Mat outview = cv::cvarrToMat (outimg);
@ -313,9 +319,10 @@ camera_undistort_run (GstCameraUndistort *undist, IplImage *img, IplImage *outim
undist->settingsChanged = FALSE; undist->settingsChanged = FALSE;
undist->doUndistort = FALSE; undist->doUndistort = FALSE;
if (undist->showUndistorted && undist->settings) { if (undist->showUndistorted && undist->settings) {
if (camera_deserialize_undistort_settings ( if (camera_deserialize_undistort_settings (undist->settings,
undist->settings, undist->cameraMatrix, undist->distCoeffs)) { undist->cameraMatrix, undist->distCoeffs)) {
undist->doUndistort = camera_undistort_init_undistort_rectify_map (undist); undist->doUndistort =
camera_undistort_init_undistort_rectify_map (undist);
} }
} }
} }
@ -329,8 +336,7 @@ camera_undistort_run (GstCameraUndistort *undist, IplImage *img, IplImage *outim
const cv::Scalar CROP_COLOR (0, 255, 0); const cv::Scalar CROP_COLOR (0, 255, 0);
cv::rectangle (outview, undist->validPixROI, CROP_COLOR); cv::rectangle (outview, undist->validPixROI, CROP_COLOR);
} }
} } else {
else {
/* FIXME should use pass through to avoid this copy when not undistorting */ /* FIXME should use pass through to avoid this copy when not undistorting */
view.copyTo (outview); view.copyTo (outview);
} }
@ -342,19 +348,21 @@ camera_undistort_init_undistort_rectify_map (GstCameraUndistort *undist)
{ {
cv::Size newImageSize; cv::Size newImageSize;
cv::Rect validPixROI; cv::Rect validPixROI;
cv::Mat newCameraMatrix = cv::getOptimalNewCameraMatrix ( cv::Mat newCameraMatrix =
undist->cameraMatrix, undist->distCoeffs, undist->imageSize, cv::getOptimalNewCameraMatrix (undist->cameraMatrix, undist->distCoeffs,
undist->alpha, newImageSize, &validPixROI); undist->imageSize, undist->alpha, newImageSize, &validPixROI);
undist->validPixROI = validPixROI; undist->validPixROI = validPixROI;
cv::initUndistortRectifyMap (undist->cameraMatrix, undist->distCoeffs, cv::Mat(), cv::initUndistortRectifyMap (undist->cameraMatrix, undist->distCoeffs,
newCameraMatrix, undist->imageSize, CV_16SC2, undist->map1, undist->map2); cv::Mat (), newCameraMatrix, undist->imageSize, CV_16SC2, undist->map1,
undist->map2);
return TRUE; return TRUE;
} }
static gboolean static gboolean
camera_undistort_calibration_event (GstCameraUndistort *undist, GstEvent *event) camera_undistort_calibration_event (GstCameraUndistort * undist,
GstEvent * event)
{ {
g_free (undist->settings); g_free (undist->settings);
@ -375,12 +383,15 @@ gst_camera_undistort_sink_event (GstBaseTransform *trans, GstEvent *event)
const GstStructure *structure = gst_event_get_structure (event); const GstStructure *structure = gst_event_get_structure (event);
if (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_BOTH && structure) { if (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_BOTH && structure) {
if (strcmp (gst_structure_get_name (structure), GST_CAMERA_EVENT_CALIBRATED_NAME) == 0) { if (strcmp (gst_structure_get_name (structure),
GST_CAMERA_EVENT_CALIBRATED_NAME) == 0) {
return camera_undistort_calibration_event (undist, event); return camera_undistort_calibration_event (undist, event);
} }
} }
return GST_BASE_TRANSFORM_CLASS (gst_camera_undistort_parent_class)->sink_event (trans, event); return
GST_BASE_TRANSFORM_CLASS (gst_camera_undistort_parent_class)->sink_event
(trans, event);
} }
static gboolean static gboolean
@ -391,12 +402,15 @@ gst_camera_undistort_src_event (GstBaseTransform *trans, GstEvent *event)
const GstStructure *structure = gst_event_get_structure (event); const GstStructure *structure = gst_event_get_structure (event);
if (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_BOTH && structure) { if (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_BOTH && structure) {
if (strcmp (gst_structure_get_name (structure), GST_CAMERA_EVENT_CALIBRATED_NAME) == 0) { if (strcmp (gst_structure_get_name (structure),
GST_CAMERA_EVENT_CALIBRATED_NAME) == 0) {
return camera_undistort_calibration_event (undist, event); return camera_undistort_calibration_event (undist, event);
} }
} }
return GST_BASE_TRANSFORM_CLASS (gst_camera_undistort_parent_class)->src_event (trans, event); return
GST_BASE_TRANSFORM_CLASS (gst_camera_undistort_parent_class)->src_event
(trans, event);
} }
/* entry point to initialize the plug-in /* entry point to initialize the plug-in
@ -408,8 +422,7 @@ gst_camera_undistort_plugin_init (GstPlugin * plugin)
{ {
/* debug category for filtering log messages */ /* debug category for filtering log messages */
GST_DEBUG_CATEGORY_INIT (gst_camera_undistort_debug, "cameraundistort", GST_DEBUG_CATEGORY_INIT (gst_camera_undistort_debug, "cameraundistort",
0, 0, "Performs camera undistortion");
"Performs camera undistortion");
return gst_element_register (plugin, "cameraundistort", GST_RANK_NONE, return gst_element_register (plugin, "cameraundistort", GST_RANK_NONE,
GST_TYPE_CAMERA_UNDISTORT); GST_TYPE_CAMERA_UNDISTORT);

View File

@ -146,19 +146,22 @@ gst_cv_laplace_class_init (GstCvLaplaceClass * klass)
g_object_class_install_property (gobject_class, PROP_APERTURE_SIZE, g_object_class_install_property (gobject_class, PROP_APERTURE_SIZE,
g_param_spec_int ("aperture-size", "aperture size", g_param_spec_int ("aperture-size", "aperture size",
"Size of the extended Laplace Kernel (1, 3, 5 or 7)", 1, 7, "Size of the extended Laplace Kernel (1, 3, 5 or 7)", 1, 7,
DEFAULT_APERTURE_SIZE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_APERTURE_SIZE,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_SCALE, g_object_class_install_property (gobject_class, PROP_SCALE,
g_param_spec_double ("scale", "scale factor", g_param_spec_double ("scale", "scale factor", "Scale factor", 0.0,
"Scale factor", 0.0, G_MAXDOUBLE, G_MAXDOUBLE, DEFAULT_SCALE_FACTOR,
DEFAULT_SCALE_FACTOR, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_SHIFT, g_object_class_install_property (gobject_class, PROP_SHIFT,
g_param_spec_double ("shift", "Shift", g_param_spec_double ("shift", "Shift",
"Value added to the scaled source array elements", 0.0, G_MAXDOUBLE, "Value added to the scaled source array elements", 0.0, G_MAXDOUBLE,
DEFAULT_SHIFT, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_SHIFT,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_MASK, g_object_class_install_property (gobject_class, PROP_MASK,
g_param_spec_boolean ("mask", "Mask", g_param_spec_boolean ("mask", "Mask",
"Sets whether the detected edges should be used as a mask on the original input or not", "Sets whether the detected edges should be used as a mask on the original input or not",
DEFAULT_MASK, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_MASK,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
gst_element_class_add_static_pad_template (element_class, &src_factory); gst_element_class_add_static_pad_template (element_class, &src_factory);
gst_element_class_add_static_pad_template (element_class, &sink_factory); gst_element_class_add_static_pad_template (element_class, &sink_factory);
@ -197,8 +200,10 @@ gst_cv_laplace_cv_set_caps (GstOpencvVideoFilter * trans, gint in_width,
filter->intermediary_img = filter->intermediary_img =
cvCreateImage (cvSize (out_width, out_height), IPL_DEPTH_16S, 1); cvCreateImage (cvSize (out_width, out_height), IPL_DEPTH_16S, 1);
filter->cvGray = cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1); filter->cvGray =
filter->Laplace = cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1); cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->Laplace =
cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
return TRUE; return TRUE;
} }

View File

@ -158,7 +158,8 @@ gst_cv_sobel_class_init (GstCvSobelClass * klass)
g_object_class_install_property (gobject_class, PROP_MASK, g_object_class_install_property (gobject_class, PROP_MASK,
g_param_spec_boolean ("mask", "Mask", g_param_spec_boolean ("mask", "Mask",
"Sets whether the detected derivative edges should be used as a mask on the original input or not", "Sets whether the detected derivative edges should be used as a mask on the original input or not",
DEFAULT_MASK, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); DEFAULT_MASK,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
gst_element_class_add_static_pad_template (element_class, &src_factory); gst_element_class_add_static_pad_template (element_class, &src_factory);
gst_element_class_add_static_pad_template (element_class, &sink_factory); gst_element_class_add_static_pad_template (element_class, &sink_factory);
@ -195,8 +196,10 @@ gst_cv_sobel_set_caps (GstOpencvVideoFilter * transform,
cvReleaseImage (&filter->cvSobel); cvReleaseImage (&filter->cvSobel);
} }
filter->cvGray = cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1); filter->cvGray =
filter->cvSobel = cvCreateImage (cvSize (out_width, out_height), IPL_DEPTH_8U, 1); cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->cvSobel =
cvCreateImage (cvSize (out_width, out_height), IPL_DEPTH_8U, 1);
return TRUE; return TRUE;
} }

View File

@ -676,8 +676,8 @@ initialise_sbm (GstDisparity * filter)
int int
run_sbm_iteration (GstDisparity * filter) run_sbm_iteration (GstDisparity * filter)
{ {
((StereoBM *) filter-> ((StereoBM *) filter->sbm)->
sbm)->compute (*((Mat *) filter->img_left_as_cvMat_gray), compute (*((Mat *) filter->img_left_as_cvMat_gray),
*((Mat *) filter->img_right_as_cvMat_gray), *((Mat *) filter->img_right_as_cvMat_gray),
*((Mat *) filter->depth_map_as_cvMat)); *((Mat *) filter->depth_map_as_cvMat));
@ -687,8 +687,8 @@ run_sbm_iteration (GstDisparity * filter)
int int
run_sgbm_iteration (GstDisparity * filter) run_sgbm_iteration (GstDisparity * filter)
{ {
((StereoSGBM *) filter-> ((StereoSGBM *) filter->sgbm)->
sgbm)->compute (*((Mat *) filter->img_left_as_cvMat_gray), compute (*((Mat *) filter->img_left_as_cvMat_gray),
*((Mat *) filter->img_right_as_cvMat_gray), *((Mat *) filter->img_right_as_cvMat_gray),
*((Mat *) filter->depth_map_as_cvMat)); *((Mat *) filter->depth_map_as_cvMat));

View File

@ -252,8 +252,10 @@ gst_edge_detect_set_caps (GstOpencvVideoFilter * transform,
cvReleaseImage (&filter->cvEdge); cvReleaseImage (&filter->cvEdge);
} }
filter->cvGray = cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1); filter->cvGray =
filter->cvEdge = cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1); cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->cvEdge =
cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
return TRUE; return TRUE;
} }

View File

@ -198,8 +198,7 @@ gst_grabcut_init (GstGrabcut * filter)
{ {
filter->test_mode = DEFAULT_TEST_MODE; filter->test_mode = DEFAULT_TEST_MODE;
filter->scale = DEFAULT_SCALE; filter->scale = DEFAULT_SCALE;
gst_opencv_video_filter_set_in_place (GST_OPENCV_VIDEO_FILTER (filter), gst_opencv_video_filter_set_in_place (GST_OPENCV_VIDEO_FILTER (filter), TRUE);
TRUE);
} }
@ -418,8 +417,7 @@ run_grabcut_iteration (struct grabcut_params *GC, IplImage * image_c,
if (cvCountNonZero (mask_c)) if (cvCountNonZero (mask_c))
grabCut (*((Mat *) GC->image), *((Mat *) GC->mask), Rect (), grabCut (*((Mat *) GC->image), *((Mat *) GC->mask), Rect (),
*((Mat *) GC->bgdModel), *((Mat *) GC->fgdModel), 1, *((Mat *) GC->bgdModel), *((Mat *) GC->fgdModel), 1, GC_INIT_WITH_MASK);
GC_INIT_WITH_MASK);
return (0); return (0);
} }
@ -431,8 +429,7 @@ run_grabcut_iteration2 (struct grabcut_params *GC, IplImage * image_c,
((Mat *) GC->image)->data = (uchar *) image_c->imageData; ((Mat *) GC->image)->data = (uchar *) image_c->imageData;
((Mat *) GC->mask)->data = mask_c->data.ptr; ((Mat *) GC->mask)->data = mask_c->data.ptr;
grabCut (*((Mat *) GC->image), *((Mat *) GC->mask), *(bbox), grabCut (*((Mat *) GC->image), *((Mat *) GC->mask), *(bbox),
*((Mat *) GC->bgdModel), *((Mat *) GC->fgdModel), 1, *((Mat *) GC->bgdModel), *((Mat *) GC->fgdModel), 1, GC_INIT_WITH_RECT);
GC_INIT_WITH_RECT);
return (0); return (0);
} }

View File

@ -229,9 +229,9 @@ gst_retinex_get_property (GObject * object, guint prop_id,
} }
static gboolean static gboolean
gst_retinex_set_caps (GstOpencvVideoFilter * filter, gint in_width, gint in_height, gst_retinex_set_caps (GstOpencvVideoFilter * filter, gint in_width,
gint in_depth, gint in_channels, gint out_width, gint out_height, gint in_height, gint in_depth, gint in_channels, gint out_width,
gint out_depth, gint out_channels) gint out_height, gint out_depth, gint out_channels)
{ {
GstRetinex *retinex = GST_RETINEX (filter); GstRetinex *retinex = GST_RETINEX (filter);
CvSize size; CvSize size;
@ -306,8 +306,7 @@ gst_retinex_transform_ip (GstOpencvVideoFilter * filter, GstBuffer * buf,
cvSub (retinex->cvB, retinex->cvC, retinex->cvA, NULL); cvSub (retinex->cvB, retinex->cvC, retinex->cvA, NULL);
/* Restore */ /* Restore */
cvConvertScale (retinex->cvA, img, (float) gain, cvConvertScale (retinex->cvA, img, (float) gain, (float) offset);
(float) offset);
} }
/* Multiscale retinex restoration. The image and a set of filtered images are /* Multiscale retinex restoration. The image and a set of filtered images are
converted to the log domain and subtracted from the original with some set converted to the log domain and subtracted from the original with some set
@ -353,8 +352,7 @@ gst_retinex_transform_ip (GstOpencvVideoFilter * filter, GstBuffer * buf,
} }
/* Restore */ /* Restore */
cvConvertScale (retinex->cvB, img, (float) gain, cvConvertScale (retinex->cvB, img, (float) gain, (float) offset);
(float) offset);
} }
return GST_FLOW_OK; return GST_FLOW_OK;

View File

@ -97,7 +97,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_segmentation_debug);
#define GST_CAT_DEFAULT gst_segmentation_debug #define GST_CAT_DEFAULT gst_segmentation_debug
using namespace cv; using namespace cv;
using namespace cv::bgsegm; using namespace
cv::bgsegm;
/* Filter signals and args */ /* Filter signals and args */
enum enum
@ -125,12 +126,17 @@ typedef enum
#define DEFAULT_LEARNING_RATE 0.01 #define DEFAULT_LEARNING_RATE 0.01
#define GST_TYPE_SEGMENTATION_METHOD (gst_segmentation_method_get_type ()) #define GST_TYPE_SEGMENTATION_METHOD (gst_segmentation_method_get_type ())
static GType static
GType
gst_segmentation_method_get_type (void) gst_segmentation_method_get_type (void)
{ {
static GType etype = 0; static
GType
etype = 0;
if (etype == 0) { if (etype == 0) {
static const GEnumValue values[] = { static const
GEnumValue
values[] = {
{METHOD_BOOK, "Codebook-based segmentation (Bradski2008)", "codebook"}, {METHOD_BOOK, "Codebook-based segmentation (Bradski2008)", "codebook"},
{METHOD_MOG, "Mixture-of-Gaussians segmentation (Bowden2001)", "mog"}, {METHOD_MOG, "Mixture-of-Gaussians segmentation (Bowden2001)", "mog"},
{METHOD_MOG2, "Mixture-of-Gaussians segmentation (Zivkovic2004)", "mog2"}, {METHOD_MOG2, "Mixture-of-Gaussians segmentation (Zivkovic2004)", "mog2"},
@ -143,55 +149,79 @@ gst_segmentation_method_get_type (void)
G_DEFINE_TYPE (GstSegmentation, gst_segmentation, GST_TYPE_OPENCV_VIDEO_FILTER); G_DEFINE_TYPE (GstSegmentation, gst_segmentation, GST_TYPE_OPENCV_VIDEO_FILTER);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", static
GstStaticPadTemplate
sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGBA"))); GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGBA")));
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", static
GstStaticPadTemplate
src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGBA"))); GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGBA")));
static void gst_segmentation_set_property (GObject * object, guint prop_id, static void
gst_segmentation_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_segmentation_get_property (GObject * object, guint prop_id, static void
gst_segmentation_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_segmentation_transform_ip (GstOpencvVideoFilter * filter, static
GstFlowReturn
gst_segmentation_transform_ip (GstOpencvVideoFilter * filter,
GstBuffer * buffer, IplImage * img); GstBuffer * buffer, IplImage * img);
static gboolean gst_segmentation_stop (GstBaseTransform * basesrc); static
static gboolean gst_segmentation_set_caps (GstOpencvVideoFilter * filter, gint in_width, gboolean
gst_segmentation_stop (GstBaseTransform * basesrc);
static
gboolean
gst_segmentation_set_caps (GstOpencvVideoFilter * filter, gint in_width,
gint in_height, gint in_depth, gint in_channels, gint in_height, gint in_depth, gint in_channels,
gint out_width, gint out_height, gint out_depth, gint out_channels); gint out_width, gint out_height, gint out_depth, gint out_channels);
static void gst_segmentation_release_all_pointers (GstSegmentation * filter); static void
gst_segmentation_release_all_pointers (GstSegmentation * filter);
/* Codebook algorithm + connected components functions*/ /* Codebook algorithm + connected components functions*/
static int update_codebook (unsigned char *p, codeBook * c, static int
update_codebook (unsigned char *p, codeBook * c,
unsigned *cbBounds, int numChannels); unsigned *cbBounds, int numChannels);
static int clear_stale_entries (codeBook * c); static int
static unsigned char background_diff (unsigned char *p, codeBook * c, clear_stale_entries (codeBook * c);
static unsigned char
background_diff (unsigned char *p, codeBook * c,
int numChannels, int *minMod, int *maxMod); int numChannels, int *minMod, int *maxMod);
static void find_connected_components (IplImage * mask, int poly1_hull0, static void
find_connected_components (IplImage * mask, int poly1_hull0,
float perimScale, CvMemStorage * mem_storage, CvSeq * contours); float perimScale, CvMemStorage * mem_storage, CvSeq * contours);
/* MOG (Mixture-of-Gaussians functions */ /* MOG (Mixture-of-Gaussians functions */
static int initialise_mog (GstSegmentation * filter); static int
static int run_mog_iteration (GstSegmentation * filter); initialise_mog (GstSegmentation * filter);
static int run_mog2_iteration (GstSegmentation * filter); static int
static int finalise_mog (GstSegmentation * filter); run_mog_iteration (GstSegmentation * filter);
static int
run_mog2_iteration (GstSegmentation * filter);
static int
finalise_mog (GstSegmentation * filter);
/* initialize the segmentation's class */ /* initialize the segmentation's class */
static void static void
gst_segmentation_class_init (GstSegmentationClass * klass) gst_segmentation_class_init (GstSegmentationClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gobject_class;
GstBaseTransformClass *basesrc_class = GST_BASE_TRANSFORM_CLASS (klass); GstElementClass *
GstOpencvVideoFilterClass *cvfilter_class = element_class = GST_ELEMENT_CLASS (klass);
(GstOpencvVideoFilterClass *) klass; GstBaseTransformClass *
basesrc_class = GST_BASE_TRANSFORM_CLASS (klass);
GstOpencvVideoFilterClass *
cvfilter_class = (GstOpencvVideoFilterClass *) klass;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
@ -251,7 +281,8 @@ static void
gst_segmentation_set_property (GObject * object, guint prop_id, gst_segmentation_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstSegmentation *filter = GST_SEGMENTATION (object); GstSegmentation *
filter = GST_SEGMENTATION (object);
switch (prop_id) { switch (prop_id) {
case PROP_METHOD: case PROP_METHOD:
@ -273,7 +304,8 @@ static void
gst_segmentation_get_property (GObject * object, guint prop_id, gst_segmentation_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec) GValue * value, GParamSpec * pspec)
{ {
GstSegmentation *filter = GST_SEGMENTATION (object); GstSegmentation *
filter = GST_SEGMENTATION (object);
switch (prop_id) { switch (prop_id) {
case PROP_METHOD: case PROP_METHOD:
@ -291,12 +323,14 @@ gst_segmentation_get_property (GObject * object, guint prop_id,
} }
} }
static gboolean static
gboolean
gst_segmentation_set_caps (GstOpencvVideoFilter * filter, gint in_width, gst_segmentation_set_caps (GstOpencvVideoFilter * filter, gint in_width,
gint in_height, gint in_depth, gint in_channels, gint in_height, gint in_depth, gint in_channels,
gint out_width, gint out_height, gint out_depth, gint out_channels) gint out_width, gint out_height, gint out_depth, gint out_channels)
{ {
GstSegmentation *segmentation = GST_SEGMENTATION (filter); GstSegmentation *
segmentation = GST_SEGMENTATION (filter);
CvSize size; CvSize size;
size = cvSize (in_width, in_height); size = cvSize (in_width, in_height);
@ -333,10 +367,12 @@ gst_segmentation_set_caps (GstOpencvVideoFilter * filter, gint in_width,
} }
/* Clean up */ /* Clean up */
static gboolean static
gboolean
gst_segmentation_stop (GstBaseTransform * basesrc) gst_segmentation_stop (GstBaseTransform * basesrc)
{ {
GstSegmentation *filter = GST_SEGMENTATION (basesrc); GstSegmentation *
filter = GST_SEGMENTATION (basesrc);
if (filter->cvRGB != NULL) if (filter->cvRGB != NULL)
gst_segmentation_release_all_pointers (filter); gst_segmentation_release_all_pointers (filter);
@ -360,12 +396,15 @@ gst_segmentation_release_all_pointers (GstSegmentation * filter)
finalise_mog (filter); finalise_mog (filter);
} }
static GstFlowReturn static
gst_segmentation_transform_ip (GstOpencvVideoFilter * cvfilter, GstBuffer * buffer, GstFlowReturn
IplImage * img) gst_segmentation_transform_ip (GstOpencvVideoFilter * cvfilter,
GstBuffer * buffer, IplImage * img)
{ {
GstSegmentation *filter = GST_SEGMENTATION (cvfilter); GstSegmentation *
int j; filter = GST_SEGMENTATION (cvfilter);
int
j;
filter->framecount++; filter->framecount++;
@ -381,9 +420,12 @@ gst_segmentation_transform_ip (GstOpencvVideoFilter * cvfilter, GstBuffer * buff
* [2] "Real-time Foreground-Background Segmentation using Codebook Model", * [2] "Real-time Foreground-Background Segmentation using Codebook Model",
* Real-time Imaging, Volume 11, Issue 3, Pages 167-256, June 2005. */ * Real-time Imaging, Volume 11, Issue 3, Pages 167-256, June 2005. */
if (METHOD_BOOK == filter->method) { if (METHOD_BOOK == filter->method) {
unsigned cbBounds[3] = { 10, 5, 5 }; unsigned
int minMod[3] = { 20, 20, 20 }, maxMod[3] = { cbBounds[3] = { 10, 5, 5 };
20, 20, 20}; int
minMod[3] = { 20, 20, 20 }, maxMod[3] = {
20, 20, 20
};
if (filter->framecount < 30) { if (filter->framecount < 30) {
/* Learning background phase: update_codebook on every frame */ /* Learning background phase: update_codebook on every frame */
@ -498,9 +540,14 @@ update_codebook (unsigned char *p, codeBook * c, unsigned *cbBounds,
int numChannels) int numChannels)
{ {
/* c->t+=1; */ /* c->t+=1; */
unsigned int high[3], low[3]; unsigned int
int n, i; high[3],
int matchChannel; low[3];
int
n,
i;
int
matchChannel;
for (n = 0; n < numChannels; n++) { for (n = 0; n < numChannels; n++) {
high[n] = p[n] + cbBounds[n]; high[n] = p[n] + cbBounds[n];
@ -539,13 +586,15 @@ update_codebook (unsigned char *p, codeBook * c, unsigned *cbBounds,
/* OVERHEAD TO TRACK POTENTIAL STALE ENTRIES */ /* OVERHEAD TO TRACK POTENTIAL STALE ENTRIES */
for (int s = 0; s < c->numEntries; s++) { for (int s = 0; s < c->numEntries; s++) {
/* Track which codebook entries are going stale: */ /* Track which codebook entries are going stale: */
int negRun = c->t - c->cb[s]->t_last_update; int
negRun = c->t - c->cb[s]->t_last_update;
if (c->cb[s]->stale < negRun) if (c->cb[s]->stale < negRun)
c->cb[s]->stale = negRun; c->cb[s]->stale = negRun;
} }
/* ENTER A NEW CODEWORD IF NEEDED */ /* ENTER A NEW CODEWORD IF NEEDED */
if (i == c->numEntries) { /* if no existing codeword found, make one */ if (i == c->numEntries) { /* if no existing codeword found, make one */
code_element **foo = code_element **
foo =
(code_element **) g_malloc (sizeof (code_element *) * (code_element **) g_malloc (sizeof (code_element *) *
(c->numEntries + 1)); (c->numEntries + 1));
for (int ii = 0; ii < c->numEntries; ii++) { for (int ii = 0; ii < c->numEntries; ii++) {
@ -592,12 +641,18 @@ update_codebook (unsigned char *p, codeBook * c, unsigned *cbBounds,
int int
clear_stale_entries (codeBook * c) clear_stale_entries (codeBook * c)
{ {
int staleThresh = c->t >> 1; int
int *keep = (int *) g_malloc (sizeof (int) * (c->numEntries)); staleThresh = c->t >> 1;
int keepCnt = 0; int *
code_element **foo; keep = (int *) g_malloc (sizeof (int) * (c->numEntries));
int k; int
int numCleared; keepCnt = 0;
code_element **
foo;
int
k;
int
numCleared;
/* SEE WHICH CODEBOOK ENTRIES ARE TOO STALE */ /* SEE WHICH CODEBOOK ENTRIES ARE TOO STALE */
for (int i = 0; i < c->numEntries; i++) { for (int i = 0; i < c->numEntries; i++) {
if (c->cb[i]->stale > staleThresh) if (c->cb[i]->stale > staleThresh)
@ -657,9 +712,11 @@ unsigned char
background_diff (unsigned char *p, codeBook * c, int numChannels, background_diff (unsigned char *p, codeBook * c, int numChannels,
int *minMod, int *maxMod) int *minMod, int *maxMod)
{ {
int matchChannel; int
matchChannel;
/* SEE IF THIS FITS AN EXISTING CODEWORD */ /* SEE IF THIS FITS AN EXISTING CODEWORD */
int i; int
i;
for (i = 0; i < c->numEntries; i++) { for (i = 0; i < c->numEntries; i++) {
matchChannel = 0; matchChannel = 0;
for (int n = 0; n < numChannels; n++) { for (int n = 0; n < numChannels; n++) {
@ -715,11 +772,17 @@ find_connected_components (IplImage * mask, int poly1_hull0, float perimScale,
CvMemStorage * mem_storage, CvSeq * contours) CvMemStorage * mem_storage, CvSeq * contours)
{ {
CvContourScanner scanner; CvContourScanner scanner;
CvSeq *c; CvSeq *
int numCont = 0; c;
int
numCont = 0;
/* Just some convenience variables */ /* Just some convenience variables */
const CvScalar CVX_WHITE = CV_RGB (0xff, 0xff, 0xff); const
const CvScalar CVX_BLACK = CV_RGB (0x00, 0x00, 0x00); CvScalar
CVX_WHITE = CV_RGB (0xff, 0xff, 0xff);
const
CvScalar
CVX_BLACK = CV_RGB (0x00, 0x00, 0x00);
/* CLEAN UP RAW MASK */ /* CLEAN UP RAW MASK */
cvMorphologyEx (mask, mask, 0, 0, CV_MOP_OPEN, CVCLOSE_ITR); cvMorphologyEx (mask, mask, 0, 0, CV_MOP_OPEN, CVCLOSE_ITR);
@ -735,15 +798,18 @@ find_connected_components (IplImage * mask, int poly1_hull0, float perimScale,
CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cvPoint (0, 0)); CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cvPoint (0, 0));
while ((c = cvFindNextContour (scanner)) != NULL) { while ((c = cvFindNextContour (scanner)) != NULL) {
double len = cvContourArea (c, CV_WHOLE_SEQ, 0); double
len = cvContourArea (c, CV_WHOLE_SEQ, 0);
/* calculate perimeter len threshold: */ /* calculate perimeter len threshold: */
double q = (mask->height + mask->width) / perimScale; double
q = (mask->height + mask->width) / perimScale;
/* Get rid of blob if its perimeter is too small: */ /* Get rid of blob if its perimeter is too small: */
if (len < q) { if (len < q) {
cvSubstituteContour (scanner, NULL); cvSubstituteContour (scanner, NULL);
} else { } else {
/* Smooth its edges if its large enough */ /* Smooth its edges if its large enough */
CvSeq *c_new; CvSeq *
c_new;
if (poly1_hull0) { if (poly1_hull0) {
/* Polygonal approximation */ /* Polygonal approximation */
c_new = c_new =
@ -772,7 +838,8 @@ find_connected_components (IplImage * mask, int poly1_hull0, float perimScale,
int int
initialise_mog (GstSegmentation * filter) initialise_mog (GstSegmentation * filter)
{ {
filter->img_input_as_cvMat = (void *) new Mat (cvarrToMat (filter->cvYUV, false)); filter->img_input_as_cvMat = (void *) new
Mat (cvarrToMat (filter->cvYUV, false));
filter->img_fg_as_cvMat = (void *) new Mat (cvarrToMat (filter->cvFG, false)); filter->img_fg_as_cvMat = (void *) new Mat (cvarrToMat (filter->cvFG, false));
filter->mog = bgsegm::createBackgroundSubtractorMOG (); filter->mog = bgsegm::createBackgroundSubtractorMOG ();
@ -799,9 +866,8 @@ run_mog_iteration (GstSegmentation * filter)
European Workshop on Advanced Video-Based Surveillance Systems, 2001 European Workshop on Advanced Video-Based Surveillance Systems, 2001
*/ */
filter->mog->apply (*((Mat *) filter-> filter->mog->apply (*((Mat *) filter->img_input_as_cvMat),
img_input_as_cvMat), *((Mat *) filter->img_fg_as_cvMat), *((Mat *) filter->img_fg_as_cvMat), filter->learning_rate);
filter->learning_rate);
return (0); return (0);
} }
@ -811,8 +877,7 @@ run_mog2_iteration (GstSegmentation * filter)
{ {
((Mat *) filter->img_input_as_cvMat)->data = ((Mat *) filter->img_input_as_cvMat)->data =
(uchar *) filter->cvYUV->imageData; (uchar *) filter->cvYUV->imageData;
((Mat *) filter->img_fg_as_cvMat)->data = ((Mat *) filter->img_fg_as_cvMat)->data = (uchar *) filter->cvFG->imageData;
(uchar *) filter->cvFG->imageData;
/* /*
BackgroundSubtractorMOG2 [1], Gaussian Mixture-based Background/Foreground BackgroundSubtractorMOG2 [1], Gaussian Mixture-based Background/Foreground
@ -827,9 +892,8 @@ run_mog2_iteration (GstSegmentation * filter)
Letters, vol. 27, no. 7, pages 773-780, 2006. Letters, vol. 27, no. 7, pages 773-780, 2006.
*/ */
filter->mog2->apply (*((Mat *) filter-> filter->mog2->apply (*((Mat *) filter->img_input_as_cvMat),
img_input_as_cvMat), *((Mat *) filter->img_fg_as_cvMat), *((Mat *) filter->img_fg_as_cvMat), filter->learning_rate);
filter->learning_rate);
return (0); return (0);
} }

View File

@ -76,10 +76,10 @@ static void gst_opencv_video_filter_set_property (GObject * object,
static void gst_opencv_video_filter_get_property (GObject * object, static void gst_opencv_video_filter_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec); guint prop_id, GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_opencv_video_filter_transform_frame (GstVideoFilter * trans, static GstFlowReturn gst_opencv_video_filter_transform_frame (GstVideoFilter *
GstVideoFrame * inframe, GstVideoFrame * outframe); trans, GstVideoFrame * inframe, GstVideoFrame * outframe);
static GstFlowReturn gst_opencv_video_filter_transform_frame_ip (GstVideoFilter * trans, static GstFlowReturn gst_opencv_video_filter_transform_frame_ip (GstVideoFilter
GstVideoFrame * frame); * trans, GstVideoFrame * frame);
static gboolean gst_opencv_video_filter_set_info (GstVideoFilter * trans, static gboolean gst_opencv_video_filter_set_info (GstVideoFilter * trans,
GstCaps * incaps, GstVideoInfo * in_info, GstCaps * outcaps, GstCaps * incaps, GstVideoInfo * in_info, GstCaps * outcaps,
@ -117,7 +117,8 @@ gst_opencv_video_filter_class_init (GstOpencvVideoFilterClass * klass)
gobject_class->get_property = gst_opencv_video_filter_get_property; gobject_class->get_property = gst_opencv_video_filter_get_property;
vfilter_class->transform_frame = gst_opencv_video_filter_transform_frame; vfilter_class->transform_frame = gst_opencv_video_filter_transform_frame;
vfilter_class->transform_frame_ip = gst_opencv_video_filter_transform_frame_ip; vfilter_class->transform_frame_ip =
gst_opencv_video_filter_transform_frame_ip;
vfilter_class->set_info = gst_opencv_video_filter_set_info; vfilter_class->set_info = gst_opencv_video_filter_set_info;
} }