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 635646 - opencv: Add cvcalchist element for calculating histogram
opencv: Add cvcalchist element for calculating histogram
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-11-23 21:44 UTC by Josh Doe
Modified: 2018-11-03 13:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add cvcalchist (29.00 KB, patch)
2010-11-23 21:44 UTC, Josh Doe
needs-work Details | Review
opencv: Add cvcalchist element for calculating histogram (28.33 KB, patch)
2014-07-28 21:54 UTC, Thiago Sousa Santos
none Details | Review

Description Josh Doe 2010-11-23 21:44:08 UTC
Created attachment 175134 [details] [review]
Patch to add cvcalchist

Added the element cvcalchist which wraps the OpenCV function cvCalcHist. Only
8- and 16-bit monochrome video is supported at this time. By default the
element will not alter the data, but if "draw-histogram" is true, then a crude
histogram will be drawn over the image.

I've included a test program under tests/examples/opencv that draws a text histogram to the console using the "histogram" message.

Please review the patch, as I'm sure there are some issues. I wasn't sure of a nice way to handle RGB histograms, especially in terms of how to package the data in a message, so I left that alone for the time being. Also note I'm developed this under Windows, but hopefully I've modified the Makefiles appropriately.
Comment 1 Thiago Sousa Santos 2010-12-07 23:36:36 UTC
I'm having problems building this.

It was missing compat.h from opencv, so I included it, but then building fails because of:

make[3]: Entering directory `/home/thiagoss/gst/head/gst-plugins-bad/ext/opencv'
  CC     libgstopencv_la-gstopencv.lo
cc1: warnings being treated as errors
In file included from gstcvcalchist.h:49,
                 from gstopencv.c:29:
/usr/include/opencv/cvcompat.h: In function ‘cvMinAreaRect’:
/usr/include/opencv/cvcompat.h:425: error: left-hand operand of comma expression has no effect
/usr/include/opencv/cvcompat.h:425: error: left-hand operand of comma expression has no effect
/usr/include/opencv/cvcompat.h:425: error: left-hand operand of comma expression has no effect
/usr/include/opencv/cvcompat.h:425: error: statement with no effect
make[3]: *** [libgstopencv_la-gstopencv.lo] Error 1


The line it points to is:
CV_UNREFERENCED( (left, bottom, right, top) );

And finally, CV_UNREFERENCED is defined as:
#ifdef __cplusplus
    #define CV_UNREFERENCED(arg)
#else
    #define CV_UNREFERENCED(arg) arg
#endif


Need to think on how to solve this.
Comment 2 Josh Doe 2010-12-08 12:38:06 UTC
(In reply to comment #1)
> I'm having problems building this.
> 
> It was missing compat.h from opencv, so I included it, but then building fails
> because of:

I'm not sure why cvcompat.h would be needed, at least I don't need it with a MSVC 2008 build (OSSBuild). I don't think there's any need for us to use any old API, and if we do have any, we may as well update to use the 2.x API. What's the error that requires cvcompat.h?
Comment 3 Thiago Sousa Santos 2010-12-09 21:58:00 UTC
cc1: warnings being treated as errors
gstcvcalchist.c: In function ‘gst_cv_calchist_message_new’:
gstcvcalchist.c:461: error: implicit declaration of function ‘cvQueryHistValue_1D’
gstcvcalchist.c:461: error: nested extern declaration of ‘cvQueryHistValue_1D’
Comment 4 Thiago Sousa Santos 2010-12-09 22:32:36 UTC
Managed to get it to build, but it is still giving me errors when running. Gotta run now, but I'll try to debug it later.

OpenCV Error: Bad argument (unrecognized or unsupported array type) in cvPtr1D, file /build/buildd/opencv-2.1.0/src/cxcore/cxarray.cpp, line 1729
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/buildd/opencv-2.1.0/src/cxcore/cxarray.cpp:1729: error: (-5) unrecognized or unsupported array type in function cvPtr1D
Comment 5 Robert Jobbagy 2011-04-29 11:57:56 UTC
can I help you fix this ?
Comment 6 Robert Jobbagy 2011-07-30 09:51:03 UTC
any progress ? or if you think maybe I can solve this.

Robert
Comment 7 Josh Doe 2011-08-01 15:59:33 UTC
This is not a priority for me right now, but if you'd like to try and fix the Linux compatibility please do so. Make sure you're working with the latest version of OpenCV, or at least the 2.x series.
Comment 8 Robert Jobbagy 2011-08-01 18:50:31 UTC
It's okay. I'm working with OpenCV 2.2 and I can solve this with this version.

I will post the patch on this week or this weekend.

Robert
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2011-11-28 08:52:26 UTC
Getting an updated patch would be great to include it in the upcoming releases.
Comment 10 Sebastian Dröge (slomo) 2013-08-23 10:52:11 UTC
Anybody planning to work on this? New patch against latest git master of gst-plugins-bad would be needed :)
Comment 11 Joshua M. Doe 2013-08-27 16:49:29 UTC
(In reply to comment #10)
> Anybody planning to work on this? New patch against latest git master of
> gst-plugins-bad would be needed :)

I'd like to do this, but it will be a few weeks at least.
Comment 12 Thiago Sousa Santos 2014-07-28 21:54:36 UTC
Created attachment 281889 [details] [review]
opencv: Add cvcalchist element for calculating histogram

Updated the patch to apply on latest master.

Currently it acts as passthrough and analyzes the image but if draw-histogram=true
it will push a buffer containing the histogram. Do we have any element with similar
behavior or any standard way of doing this? 2 pads or a property?
Comment 13 Sebastian Dröge (slomo) 2018-05-04 09:41:25 UTC
Thiago, let's just get this in for now then... or alternatively close it as WONTFIX?
Comment 14 GStreamer system administrator 2018-11-03 13:06:52 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/28.