Commit 890dbb56 authored by Nicola Murino's avatar Nicola Murino Committed by Nicolas Dufresne
Browse files

opencv: fix indentation

parent 2fd31303
......@@ -198,7 +198,7 @@ MotionCells::performDetectionMotionCells (IplImage * p_frame,
delete[]m_motioncellsidxcstr;
m_motioncells_idx_count = m_MotionCells.size () * MSGLEN; //one motion cell idx: (lin idx : col idx,) it's up to 6 character except last motion cell idx
m_motioncellsidxcstr = new char[m_motioncells_idx_count];
char *tmpstr = new char[MSGLEN+ 1];
char *tmpstr = new char[MSGLEN + 1];
tmpstr[0] = 0;
for (unsigned int i = 0; i < m_MotionCells.size (); i++) {
CvPoint pt1, pt2;
......@@ -223,10 +223,10 @@ MotionCells::performDetectionMotionCells (IplImage * p_frame,
}
if (i < m_MotionCells.size () - 1) {
snprintf (tmpstr, MSGLEN+1, "%d:%d,", m_MotionCells.at (i).lineidx,
snprintf (tmpstr, MSGLEN + 1, "%d:%d,", m_MotionCells.at (i).lineidx,
m_MotionCells.at (i).colidx);
} else {
snprintf (tmpstr, MSGLEN+1, "%d:%d", m_MotionCells.at (i).lineidx,
snprintf (tmpstr, MSGLEN + 1, "%d:%d", m_MotionCells.at (i).lineidx,
m_MotionCells.at (i).colidx);
}
if (i == 0)
......
......@@ -22,20 +22,22 @@
#include <opencv2/opencv.hpp>
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 << "distCoeffs" << distCoeffs;
std::string buf = fs.releaseAndGetString();
std::string buf = fs.releaseAndGetString ();
return g_strdup(buf.c_str());
return g_strdup (buf.c_str ());
}
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["distCoeffs"] >> distCoeffs;
......
This diff is collapsed.
......@@ -98,7 +98,8 @@ enum
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_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,
gint in_width, gint in_height, gint in_depth, gint in_channels,
gint out_width, gint out_height, gint out_depth, gint out_channels);
static GstFlowReturn gst_camera_undistort_transform_frame (
GstOpencvVideoFilter * cvfilter,
GstBuffer * frame, IplImage * img,
GstBuffer * outframe, IplImage * outimg);
static GstFlowReturn gst_camera_undistort_transform_frame (GstOpencvVideoFilter
* cvfilter, GstBuffer * frame, IplImage * img, GstBuffer * outframe,
IplImage * outimg);
static gboolean gst_camera_undistort_sink_event (GstBaseTransform *trans, GstEvent *event);
static gboolean gst_camera_undistort_src_event (GstBaseTransform *trans, GstEvent *event);
static gboolean gst_camera_undistort_sink_event (GstBaseTransform * trans,
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 gboolean camera_undistort_init_undistort_rectify_map(GstCameraUndistort *undist);
static void camera_undistort_run (GstCameraUndistort * undist, IplImage * img,
IplImage * outimg);
static gboolean camera_undistort_init_undistort_rectify_map (GstCameraUndistort
* undist);
/* initialize the cameraundistort's class */
static void
......@@ -127,7 +131,8 @@ gst_camera_undistort_class_init (GstCameraUndistortClass * klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_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;
GstPadTemplate *templ;
......@@ -136,19 +141,17 @@ gst_camera_undistort_class_init (GstCameraUndistortClass * klass)
gobject_class->set_property = gst_camera_undistort_set_property;
gobject_class->get_property = gst_camera_undistort_get_property;
trans_class->sink_event =
GST_DEBUG_FUNCPTR (gst_camera_undistort_sink_event);
trans_class->src_event =
GST_DEBUG_FUNCPTR (gst_camera_undistort_src_event);
trans_class->sink_event = GST_DEBUG_FUNCPTR (gst_camera_undistort_sink_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_trans_func =
gst_camera_undistort_transform_frame;
opencvfilter_class->cv_trans_func = gst_camera_undistort_transform_frame;
g_object_class_install_property (gobject_class, PROP_SHOW_UNDISTORTED,
g_param_spec_boolean ("undistort", "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_param_spec_float ("alpha", "Pixels",
......@@ -164,8 +167,7 @@ gst_camera_undistort_class_init (GstCameraUndistortClass * klass)
gst_element_class_set_static_metadata (element_class,
"cameraundistort",
"Filter/Effect/Video",
"Performs camera undistort",
"Philippe Renon <philippe_renon@yahoo.fr>");
"Performs camera undistort", "Philippe Renon <philippe_renon@yahoo.fr>");
/* add sink and source pad templates */
caps = gst_opencv_caps_from_cv_image_type (CV_16UC1);
......@@ -238,7 +240,7 @@ gst_camera_undistort_set_property (GObject * object, guint prop_id,
}
str = g_value_get_string (value);
if (str)
undist->settings = g_strdup (str);
undist->settings = g_strdup (str);
undist->settingsChanged = TRUE;
break;
default:
......@@ -275,9 +277,12 @@ gst_camera_undistort_get_property (GObject * object, guint prop_id,
gboolean
gst_camera_undistort_set_info (GstOpencvVideoFilter * cvfilter,
gint in_width, gint in_height,
__attribute__((unused)) gint in_depth, __attribute__((unused)) gint in_channels,
__attribute__((unused)) gint out_width, __attribute__((unused)) gint out_height,
__attribute__((unused)) gint out_depth, __attribute__((unused)) gint out_channels)
__attribute__((unused)) gint in_depth,
__attribute__((unused)) gint in_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);
......@@ -302,7 +307,8 @@ gst_camera_undistort_transform_frame (GstOpencvVideoFilter * cvfilter,
}
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);
cv::Mat outview = cv::cvarrToMat (outimg);
......@@ -313,9 +319,10 @@ camera_undistort_run (GstCameraUndistort *undist, IplImage *img, IplImage *outim
undist->settingsChanged = FALSE;
undist->doUndistort = FALSE;
if (undist->showUndistorted && undist->settings) {
if (camera_deserialize_undistort_settings (
undist->settings, undist->cameraMatrix, undist->distCoeffs)) {
undist->doUndistort = camera_undistort_init_undistort_rectify_map (undist);
if (camera_deserialize_undistort_settings (undist->settings,
undist->cameraMatrix, undist->distCoeffs)) {
undist->doUndistort =
camera_undistort_init_undistort_rectify_map (undist);
}
}
}
......@@ -329,37 +336,38 @@ camera_undistort_run (GstCameraUndistort *undist, IplImage *img, IplImage *outim
const cv::Scalar CROP_COLOR (0, 255, 0);
cv::rectangle (outview, undist->validPixROI, CROP_COLOR);
}
}
else {
/* FIXME should use pass through to avoid this copy when not undistorting */
view.copyTo (outview);
} else {
/* FIXME should use pass through to avoid this copy when not undistorting */
view.copyTo (outview);
}
}
/* compute undistort */
static gboolean
camera_undistort_init_undistort_rectify_map (GstCameraUndistort *undist)
camera_undistort_init_undistort_rectify_map (GstCameraUndistort * undist)
{
cv::Size newImageSize;
cv::Rect validPixROI;
cv::Mat newCameraMatrix = cv::getOptimalNewCameraMatrix (
undist->cameraMatrix, undist->distCoeffs, undist->imageSize,
undist->alpha, newImageSize, &validPixROI);
cv::Mat newCameraMatrix =
cv::getOptimalNewCameraMatrix (undist->cameraMatrix, undist->distCoeffs,
undist->imageSize, undist->alpha, newImageSize, &validPixROI);
undist->validPixROI = validPixROI;
cv::initUndistortRectifyMap (undist->cameraMatrix, undist->distCoeffs, cv::Mat(),
newCameraMatrix, undist->imageSize, CV_16SC2, undist->map1, undist->map2);
cv::initUndistortRectifyMap (undist->cameraMatrix, undist->distCoeffs,
cv::Mat (), newCameraMatrix, undist->imageSize, CV_16SC2, undist->map1,
undist->map2);
return TRUE;
}
static gboolean
camera_undistort_calibration_event (GstCameraUndistort *undist, GstEvent *event)
camera_undistort_calibration_event (GstCameraUndistort * undist,
GstEvent * event)
{
g_free (undist->settings);
if (!gst_camera_event_parse_calibrated (event, &(undist->settings))) {
return FALSE;
return FALSE;
}
undist->settingsChanged = TRUE;
......@@ -368,35 +376,41 @@ camera_undistort_calibration_event (GstCameraUndistort *undist, GstEvent *event)
}
static gboolean
gst_camera_undistort_sink_event (GstBaseTransform *trans, GstEvent *event)
gst_camera_undistort_sink_event (GstBaseTransform * trans, GstEvent * event)
{
GstCameraUndistort *undist = GST_CAMERA_UNDISTORT (trans);
const GstStructure *structure = gst_event_get_structure (event);
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 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
gst_camera_undistort_src_event (GstBaseTransform *trans, GstEvent *event)
gst_camera_undistort_src_event (GstBaseTransform * trans, GstEvent * event)
{
GstCameraUndistort *undist = GST_CAMERA_UNDISTORT (trans);
const GstStructure *structure = gst_event_get_structure (event);
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 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
......@@ -408,8 +422,7 @@ 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");
0, "Performs camera undistortion");
return gst_element_register (plugin, "cameraundistort", GST_RANK_NONE,
GST_TYPE_CAMERA_UNDISTORT);
......
......@@ -146,19 +146,22 @@ gst_cv_laplace_class_init (GstCvLaplaceClass * klass)
g_object_class_install_property (gobject_class, PROP_APERTURE_SIZE,
g_param_spec_int ("aperture-size", "aperture size",
"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_param_spec_double ("scale", "scale factor",
"Scale factor", 0.0, G_MAXDOUBLE,
DEFAULT_SCALE_FACTOR, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_param_spec_double ("scale", "scale factor", "Scale factor", 0.0,
G_MAXDOUBLE, DEFAULT_SCALE_FACTOR,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
g_object_class_install_property (gobject_class, PROP_SHIFT,
g_param_spec_double ("shift", "Shift",
"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_param_spec_boolean ("mask", "Mask",
"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, &sink_factory);
......@@ -190,15 +193,17 @@ gst_cv_laplace_cv_set_caps (GstOpencvVideoFilter * trans, gint in_width,
GstCvLaplace *filter = GST_CV_LAPLACE (trans);
if (filter->intermediary_img != NULL) {
cvReleaseImage (&filter->intermediary_img);
cvReleaseImage (&filter->cvGray);
cvReleaseImage (&filter->Laplace);
cvReleaseImage (&filter->intermediary_img);
cvReleaseImage (&filter->cvGray);
cvReleaseImage (&filter->Laplace);
}
filter->intermediary_img =
cvCreateImage (cvSize (out_width, out_height), IPL_DEPTH_16S, 1);
filter->cvGray = cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->Laplace = cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->cvGray =
cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->Laplace =
cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
return TRUE;
}
......
......@@ -371,11 +371,11 @@ gst_cv_smooth_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
IplImage * img)
{
GstCvSmooth *filter = GST_CV_SMOOTH (base);
Mat mat = cvarrToMat(img);
Mat mat = cvarrToMat (img);
if (filter->positionx != 0 || filter->positiony != 0 ||
filter->width != G_MAXINT || filter->height != G_MAXINT) {
Size mat_size = mat.size();
Size mat_size = mat.size ();
/* if the effect would start outside the image, just skip it */
if (filter->positionx >= mat_size.width
......@@ -385,12 +385,12 @@ gst_cv_smooth_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
if (filter->width <= 0 || filter->height <= 0)
return GST_FLOW_OK;
Rect mat_rect(filter->positionx,
Rect mat_rect (filter->positionx,
filter->positiony,
MIN(filter->width, mat_size.width - filter->positionx),
MIN(filter->height, mat_size.height - filter->positiony));
MIN (filter->width, mat_size.width - filter->positionx),
MIN (filter->height, mat_size.height - filter->positiony));
mat = mat(mat_rect);
mat = mat (mat_rect);
}
switch (filter->type) {
......
......@@ -158,7 +158,8 @@ gst_cv_sobel_class_init (GstCvSobelClass * klass)
g_object_class_install_property (gobject_class, PROP_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",
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, &sink_factory);
......@@ -191,12 +192,14 @@ gst_cv_sobel_set_caps (GstOpencvVideoFilter * transform,
GstCvSobel *filter = GST_CV_SOBEL (transform);
if (filter->cvSobel != NULL) {
cvReleaseImage (&filter->cvGray);
cvReleaseImage (&filter->cvSobel);
cvReleaseImage (&filter->cvGray);
cvReleaseImage (&filter->cvSobel);
}
filter->cvGray = cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->cvSobel = cvCreateImage (cvSize (out_width, out_height), IPL_DEPTH_8U, 1);
filter->cvGray =
cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->cvSobel =
cvCreateImage (cvSize (out_width, out_height), IPL_DEPTH_8U, 1);
return TRUE;
}
......
......@@ -644,8 +644,8 @@ initialise_sbm (GstDisparity * filter)
filter->depth_map_as_cvMat =
(void *) new Mat (cvarrToMat (filter->cvGray_depth_map1, false));
filter->sbm = StereoBM::create();
filter->sgbm = StereoSGBM::create(1,64,3);
filter->sbm = StereoBM::create ();
filter->sgbm = StereoSGBM::create (1, 64, 3);
filter->sbm->setBlockSize (9);
filter->sbm->setNumDisparities (32);
......@@ -676,8 +676,8 @@ initialise_sbm (GstDisparity * filter)
int
run_sbm_iteration (GstDisparity * filter)
{
((StereoBM *) filter->
sbm)->compute (*((Mat *) filter->img_left_as_cvMat_gray),
((StereoBM *) filter->sbm)->
compute (*((Mat *) filter->img_left_as_cvMat_gray),
*((Mat *) filter->img_right_as_cvMat_gray),
*((Mat *) filter->depth_map_as_cvMat));
......@@ -687,8 +687,8 @@ run_sbm_iteration (GstDisparity * filter)
int
run_sgbm_iteration (GstDisparity * filter)
{
((StereoSGBM *) filter->
sgbm)->compute (*((Mat *) filter->img_left_as_cvMat_gray),
((StereoSGBM *) filter->sgbm)->
compute (*((Mat *) filter->img_left_as_cvMat_gray),
*((Mat *) filter->img_right_as_cvMat_gray),
*((Mat *) filter->depth_map_as_cvMat));
......@@ -702,8 +702,8 @@ finalise_sbm (GstDisparity * filter)
delete (Mat *) filter->img_left_as_cvMat_gray;
delete (Mat *) filter->img_right_as_cvMat_gray;
filter->sbm.release();
filter->sgbm.release();
filter->sbm.release ();
filter->sgbm.release ();
return (0);
}
......@@ -248,12 +248,14 @@ gst_edge_detect_set_caps (GstOpencvVideoFilter * transform,
GstEdgeDetect *filter = GST_EDGE_DETECT (transform);
if (filter->cvEdge != NULL) {
cvReleaseImage (&filter->cvGray);
cvReleaseImage (&filter->cvEdge);
cvReleaseImage (&filter->cvGray);
cvReleaseImage (&filter->cvEdge);
}
filter->cvGray = cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->cvEdge = cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->cvGray =
cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
filter->cvEdge =
cvCreateImage (cvSize (in_width, in_height), IPL_DEPTH_8U, 1);
return TRUE;
}
......
......@@ -355,7 +355,7 @@ gst_face_blur_transform_ip (GstOpencvVideoFilter * transform,
cvCvtColor (img, filter->cvGray, CV_RGB2GRAY);
Mat image = cvarrToMat(filter->cvGray);
Mat image = cvarrToMat (filter->cvGray);
filter->cvCascade->detectMultiScale (image, faces, filter->scale_factor,
filter->min_neighbors, filter->flags,
cvSize (filter->min_size_width, filter->min_size_height), cvSize (0, 0));
......@@ -364,7 +364,7 @@ gst_face_blur_transform_ip (GstOpencvVideoFilter * transform,
for (i = 0; i < faces.size (); ++i) {
Rect *r = &faces[i];
Mat imag = cvarrToMat(img);
Mat imag = cvarrToMat (img);
Mat roi (imag, Rect (r->x, r->y, r->width, r->height));
blur (roi, roi, Size (11, 11));
GaussianBlur (roi, roi, Size (11, 11), 0, 0);
......
......@@ -198,8 +198,7 @@ gst_grabcut_init (GstGrabcut * filter)
{
filter->test_mode = DEFAULT_TEST_MODE;
filter->scale = DEFAULT_SCALE;
gst_opencv_video_filter_set_in_place (GST_OPENCV_VIDEO_FILTER (filter),
TRUE);
gst_opencv_video_filter_set_in_place (GST_OPENCV_VIDEO_FILTER (filter), TRUE);
}
......@@ -299,7 +298,7 @@ gst_grabcut_release_all_pointers (GstGrabcut * filter)
static GstFlowReturn
gst_grabcut_transform_ip (GstOpencvVideoFilter * filter, GstBuffer * buffer,
IplImage * img)
IplImage * img)
{
GstGrabcut *gc = GST_GRABCUT (filter);
gint alphapixels;
......@@ -312,7 +311,7 @@ gst_grabcut_transform_ip (GstOpencvVideoFilter * filter, GstBuffer * buffer,
gc->facepos.width = meta->w * gc->scale * 0.9;
gc->facepos.height = meta->h * gc->scale * 1.1;
} else {
memset (static_cast<void*>(&(gc->facepos)), 0, sizeof (gc->facepos));
memset (static_cast < void *>(&(gc->facepos)), 0, sizeof (gc->facepos));
}
/* normally input should be RGBA */
......@@ -401,9 +400,9 @@ int
initialise_grabcut (struct grabcut_params *GC, IplImage * image_c,
CvMat * mask_c)
{
GC->image = (void *) new Mat (cvarrToMat (image_c, false)); /* "true" refers to copydata */
GC->image = (void *) new Mat (cvarrToMat (image_c, false)); /* "true" refers to copydata */
GC->mask = (void *) new Mat (cvarrToMat (mask_c, false));
GC->bgdModel = (void *) new Mat (); /* "true" refers to copydata */
GC->bgdModel = (void *) new Mat (); /* "true" refers to copydata */
GC->fgdModel = (void *) new Mat ();
return (0);
......@@ -418,8 +417,7 @@ run_grabcut_iteration (struct grabcut_params *GC, IplImage * image_c,
if (cvCountNonZero (mask_c))
grabCut (*((Mat *) GC->image), *((Mat *) GC->mask), Rect (),
*((Mat *) GC->bgdModel), *((Mat *) GC->fgdModel), 1,
GC_INIT_WITH_MASK);
*((Mat *) GC->bgdModel), *((Mat *) GC->fgdModel), 1, GC_INIT_WITH_MASK);
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->mask)->data = mask_c->data.ptr;
grabCut (*((Mat *) GC->image), *((Mat *) GC->mask), *(bbox),
*((Mat *) GC->bgdModel), *((Mat *) GC->fgdModel), 1,
GC_INIT_WITH_RECT);
*((Mat *) GC->bgdModel), *((Mat *) GC->fgdModel), 1, GC_INIT_WITH_RECT);
return (0);
}
......
......@@ -191,21 +191,21 @@ gst_handdetect_class_init (GstHanddetectClass * klass)
g_param_spec_boolean ("display",
"Display",
"Whether the detected hands are highlighted in output frame",
TRUE, (GParamFlags)G_PARAM_READWRITE)
TRUE, (GParamFlags) G_PARAM_READWRITE)
);
g_object_class_install_property (gobject_class,
PROP_PROFILE_FIST,
g_param_spec_string ("profile_fist",
"Profile_fist",
"Location of HAAR cascade file (fist gesture)",
HAAR_FILE_FIST, (GParamFlags)G_PARAM_READWRITE)
HAAR_FILE_FIST, (GParamFlags) G_PARAM_READWRITE)
);
g_object_class_install_property (gobject_class,
PROP_PROFILE_PALM,
g_param_spec_string ("profile_palm",
"Profile_palm",
"Location of HAAR cascade file (palm gesture)",
HAAR_FILE_PALM, (GParamFlags)G_PARAM_READWRITE)
HAAR_FILE_PALM, (GParamFlags) G_PARAM_READWRITE)
);
/* FIXME: property name needs fixing */
g_object_class_install_property (gobject_class,
......@@ -213,7 +213,7 @@ gst_handdetect_class_init (GstHanddetectClass * klass)
g_param_spec_int ("ROI_X",
"ROI_X",
"X of left-top pointer in region of interest \nGestures in the defined region of interest will emit messages",
0, INT_MAX, 0, (GParamFlags)G_PARAM_READWRITE)
0, INT_MAX, 0, (GParamFlags) G_PARAM_READWRITE)
);
/* FIXME: property name needs fixing */
g_object_class_install_property (gobject_class,
......@@ -221,7 +221,7 @@ gst_handdetect_class_init (GstHanddetectClass * klass)
g_param_spec_int ("ROI_Y",
"ROI_Y",
"Y of left-top pointer in region of interest \nGestures in the defined region of interest will emit messages",
0, INT_MAX, 0, (GParamFlags)G_PARAM_READWRITE)
0, INT_MAX, 0, (GParamFlags) G_PARAM_READWRITE)
);
/* FIXME: property name needs fixing */
g_object_class_install_property (gobject_class,
......@@ -229,7 +229,7 @@ gst_handdetect_class_init (GstHanddetectClass * klass)
g_param_spec_int ("ROI_WIDTH",
"ROI_WIDTH",
"WIDTH of left-top pointer in region of interest \nGestures in the defined region of interest will emit messages",
0, INT_MAX, 0, (GParamFlags)G_PARAM_READWRITE)
0, INT_MAX, 0, (GParamFlags) G_PARAM_READWRITE)
);
/* FIXME: property name needs fixing */
g_object_class_install_property (gobject_class,
......@@ -237,7 +237,7 @@ gst_handdetect_class_init (GstHanddetectClass * klass)
g_param_spec_int ("ROI_HEIGHT",
"ROI_HEIGHT",
"HEIGHT of left-top pointer in region of interest \nGestures in the defined region of interest will emit messages",
0, INT_MAX, 0, (GParamFlags)G_PARAM_READWRITE