[Bug 702722] opencv: add GrabCut segmentation element

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Thu Jul 11 03:36:20 PDT 2013


https://bugzilla.gnome.org/show_bug.cgi?id=702722
  GStreamer | gst-plugins-bad | 1.x

--- Comment #10 from Miguel (elmiguelao) Casas-Sanchez <miguelecasassanchez at gmail.com> 2013-07-11 10:36:17 UTC ---
(In reply to comment #9)
> Review of attachment 248843 [details]:
> 
> ::: ext/opencv/gstfacedetect.c
> @@ +681,3 @@
> +        ev = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, str);
> +        gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD
> (GST_BASE_TRANSFORM_CAST
> +                (filter)), ev);
> 
> I still believe this should be a GstMeta, attached to any buffer to which it is
> relevant... potentially many per buffer if there are many faces :)
> 

Yes but facedetect selects the largest face detected and grabcut does not
operate well on non-connected foreground patches.

> Why do you use doubles for the coordinates? Can they be fractional?
> 

Face detection gives integer pixels coordinates and sizes. (Sub pixel accuracy
is interesting thought hmmm ;) )

> ::: ext/opencv/gstgrabcut.cpp
> @@ +182,3 @@
> +IN CASE OF no alpha mask input (all 0's or all 1's), the 'face' \
> +downstream event is used to create a bbox of PR_FG elements.\n\
> +IF nothing is present, then nothing is done.", "Miguel Casas-Sanchez
> <miguelecasassanchez at gmail.com>");
> 
> Please move this NOTE in the documentation still
> 

I think I did, see the comments on top of the file:
 * is used to create a bbox of PR_FG elements. If both foreground alpha
 * is not specified and there is no face detection, nothing is done.
And then the element comments:
 IN CASE OF no alpha mask input (all 0's or all 1's), the 'face' \
 downstream event is used to create a bbox of PR_FG elements.\n\
 IF nothing is present, then nothing is done.", ...

> @@ +364,3 @@
> +  } else {
> +
> +    if ( (abs (gc->facepos.x) > 2) && (abs (gc->facepos.y) > 2) 
> 
> I can understand the checks for the width/height of the facepos, but why must x
> and y be > 2? Can't a face start at position (0,0)?
> 

Good question, hmmm at the time it made sense, I guess I should run some tests
and see if it's still relevant, and if not  just check for correct face
detection via (width+height > 2) or similar.

> @@ +368,3 @@
> +      GST_INFO ("running on bbox (%d,%d),(%d,%d)", gc->facepos.x,
> gc->facepos.y,
> +        gc->facepos.width, gc->facepos.height);
> +      run_graphcut_iteration2 (&(gc->GC), gc->cvRGBin, gc->grabcut_mask,
> 
> Why is the element called grabcut but the algorithm graphcut? :)

Grabcut is an implementation of the GraphCut algorithm :)

 * [1] C. Rother, V. Kolmogorov, and A. Blake, "GrabCut: Interactive foreground 
 * extraction using iterated graph cuts, ACM Trans. Graph., vol. 23, pp.
309–314,
 * 2004.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list