After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748858 - opencv: cvequalizehist: add color support
opencv: cvequalizehist: add color support
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.x
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-05-04 00:23 UTC by ji0130.jung
Modified: 2018-11-03 13:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for extending an input format (5.60 KB, patch)
2015-05-04 00:23 UTC, ji0130.jung
none Details | Review
patch for extending an input format (2nd ed) (5.63 KB, patch)
2015-05-04 00:35 UTC, ji0130.jung
none Details | Review
patch for extending an input format (3rd ed) (6.01 KB, patch)
2015-05-06 05:25 UTC, ji0130.jung
needs-work Details | Review

Description ji0130.jung 2015-05-04 00:23:08 UTC
Created attachment 302826 [details] [review]
patch for extending an input format

The original "cvequalizehist" element only accepts a grayscale image as an input.
However, the most images users want to handle are colored images.
I extended its input format from grayscale to colored.
Please find the attached patch.

This patch was modified from d4703fa8806cf7d9cc778fb43370daebb37e70cd,
and you can check it using the following command.

gst-launch-1.0 videotestsrc pattern=13 ! tee name=t t. ! queue ! videoconvert ! xvimagesink t. ! queue ! cvequalizehist ! videoconvert ! xvimagesink

Thank you.
Comment 1 ji0130.jung 2015-05-04 00:35:06 UTC
Created attachment 302828 [details] [review]
patch for extending an input format (2nd ed)
Comment 2 Thiago Sousa Santos 2015-05-05 16:23:15 UTC
Comment on attachment 302826 [details] [review]
patch for extending an input format

Please remember to mark as obsolete patches that were replaced by newer versions.
Comment 3 Thiago Sousa Santos 2015-05-05 16:50:57 UTC
Review of attachment 302828 [details] [review]:

A nice addition, thanks for the patch.

Some work is still needed, please see the comments in the review.

::: ext/opencv/gstcvequalizehist.c
@@ +74,3 @@
+  cvReleaseImage (&filter->plane_r);
+  cvReleaseImage (&filter->plane_g);
+  cvReleaseImage (&filter->plane_b);

This seems far too late to release those. It should be released when going from PAUSED to READY state. I'd recommend implementing the stop method from GstBaseTransform.

@@ +104,3 @@
+  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_pad_template_new doesn't take ownership of the caps so you don't need an extra ref here

@@ +106,3 @@
+      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);

And then you need to unref the caps after this part.

It might just be simpler to keep the static pad templates as they were and just add RGB and BGR to the list of supported video formats.

@@ +127,3 @@
+  filter->plane_r = cvCreateImage (cvSize (in_width, in_height), in_depth, 1);
+  filter->plane_g = cvCreateImage (cvSize (in_width, in_height), in_depth, 1);
+  filter->plane_b = cvCreateImage (cvSize (in_width, in_height), in_depth, 1);

The caps can be changed during playback and you would leak the previous planes. You should release those before creating new ones.
Comment 4 Thiago Sousa Santos 2015-05-05 16:51:50 UTC
Review of attachment 302828 [details] [review]:

A nice addition, thanks for the patch.

Some work is still needed, please see the comments in the review.

::: ext/opencv/gstcvequalizehist.c
@@ +74,3 @@
+  cvReleaseImage (&filter->plane_r);
+  cvReleaseImage (&filter->plane_g);
+  cvReleaseImage (&filter->plane_b);

This seems far too late to release those. It should be released when going from PAUSED to READY state. I'd recommend implementing the stop method from GstBaseTransform.

@@ +104,3 @@
+  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_pad_template_new doesn't take ownership of the caps so you don't need an extra ref here

@@ +106,3 @@
+      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);

And then you need to unref the caps after this part.

It might just be simpler to keep the static pad templates as they were and just add RGB and BGR to the list of supported video formats.

@@ +127,3 @@
+  filter->plane_r = cvCreateImage (cvSize (in_width, in_height), in_depth, 1);
+  filter->plane_g = cvCreateImage (cvSize (in_width, in_height), in_depth, 1);
+  filter->plane_b = cvCreateImage (cvSize (in_width, in_height), in_depth, 1);

The caps can be changed during playback and you would leak the previous planes. You should release those before creating new ones.
Comment 5 Thiago Sousa Santos 2015-05-05 16:51:50 UTC
Review of attachment 302828 [details] [review]:

A nice addition, thanks for the patch.

Some work is still needed, please see the comments in the review.

::: ext/opencv/gstcvequalizehist.c
@@ +74,3 @@
+  cvReleaseImage (&filter->plane_r);
+  cvReleaseImage (&filter->plane_g);
+  cvReleaseImage (&filter->plane_b);

This seems far too late to release those. It should be released when going from PAUSED to READY state. I'd recommend implementing the stop method from GstBaseTransform.

@@ +104,3 @@
+  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_pad_template_new doesn't take ownership of the caps so you don't need an extra ref here

@@ +106,3 @@
+      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);

And then you need to unref the caps after this part.

It might just be simpler to keep the static pad templates as they were and just add RGB and BGR to the list of supported video formats.

@@ +127,3 @@
+  filter->plane_r = cvCreateImage (cvSize (in_width, in_height), in_depth, 1);
+  filter->plane_g = cvCreateImage (cvSize (in_width, in_height), in_depth, 1);
+  filter->plane_b = cvCreateImage (cvSize (in_width, in_height), in_depth, 1);

The caps can be changed during playback and you would leak the previous planes. You should release those before creating new ones.
Comment 6 Thiago Sousa Santos 2015-05-05 16:52:48 UTC
Yay, bugzilla!

Sorry for the spam, bugzilla gave me an error when submitting and stalled. Had to push 3 times to make it confirm my review but apparently it also submitted it 3 times despite erroring.
Comment 7 ji0130.jung 2015-05-06 05:25:46 UTC
Created attachment 302955 [details] [review]
patch for extending an input format (3rd ed)

Thank you for your kind comments.

I modified the patch according to your comments.
Please find the attachment.
Comment 8 ji0130.jung 2015-07-21 23:37:18 UTC
ping~
Comment 9 ji0130.jung 2015-07-21 23:39:51 UTC
can anybody review this?
Comment 10 Tim-Philipp Müller 2016-12-31 11:53:01 UTC
Comment on attachment 302955 [details] [review]
patch for extending an input format (3rd ed)

Thanks for the updated patch! Unfortunately it no longer applies and needs to be rebased on top of master (note that the file was renamed from .c to .cpp).
Comment 11 GStreamer system administrator 2018-11-03 13:34:58 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/248.