OpenCV 2 incompatibilities

Bug #480772 reported by Clovis Peruchi Scotti
62
This bug affects 11 people
Affects Status Importance Assigned to Milestone
Harpia
Fix Released
Medium
Clovis Peruchi Scotti
harpia (Ubuntu)
Fix Released
Undecided
Unassigned
Lucid
Fix Released
Undecided
Unassigned
Oneiric
Invalid
Undecided
Unassigned

Bug Description

In Lucid Lynx, Ubuntu uses Opencv2.

OpenCV 2 changes the prototype of some functions (using for example default parameters):

/* save image to file */
CVAPI(int) cvSaveImage( const char* filename, const CvArr* image,
                        const int* params CV_DEFAULT(0) );

Since this third parameter is not accounted for in Harpia, the user will get errors when compiling/running any programs (even the samples).

TEST CASE: Open Harpia, go to "Help>Examples>01-Hello-World.hrp", press F9 (run). This will exit with a error message/red light
(the compile error msg can be viewed clicking twice on the "Show Image" block). This way the application is totally unusable.
Expected behavior would be to have a green light on the status message and seeing the image (lenna.png) when clicking twice on
the "Show Image" block.
"Help>Examples>04-Face-Detection-And-Cropping.hrp" should also work in machines with supported & configured webcam, this is also a test case for the added dependencies.

Changed in harpia:
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Clovis Peruchi Scotti (roboscotti) wrote :

Oh.. just to let it clear:
This bug only affects people using opencv2, which is NOT the ubuntu repository version.

Changed in harpia:
assignee: nobody → Clovis Peruchi Scotti (roboscotti)
Revision history for this message
ray1claw (ray1claw-gmail) wrote :

how to apply the patch? overwriting doesnt help cuz the original gerador.py is way too long

Revision history for this message
ray1claw (ray1claw-gmail) wrote :

manually editing each cvSaveImage line in gerador.py resolved the issue with harpia examples consisting of static images. But when it comes to examples involving live video feed, cvRetrieveFrame turns out to be incompatible with opencv2.0 again. Any patch/suggestions for that?

Revision history for this message
Clovis Peruchi Scotti (roboscotti) wrote :

@ray1claw,
Weird this problem with the patch. Did you try:
patch < harpia_opencv2.patch
?
One should search on opencv2 source to check what changed on cvRetrieveFrame.
Right now I'm totally without free time to work on this =/ When I get some we can make the whole gerador.py available for opencv2 usage.

Revision history for this message
Leandro Pavón Serrano (leandroteleco) wrote :

I have applied the patch to Lucid, and cvSaveImage corrected the error, and allows working with images.

However, when trying to use the webcam pictures, gave me an error cvRetrieveFrame. "Too Few arguments ..."

I have read on these sites:
http://www.ai.rug.nl/vakinformatie/pas/content/Highgui/opencvref_highgui.htm
http://opencv.willowgarage.com/documentation/cpp/reading_and_writing_images_and_video.html

And I have come to a way to patch the error, similar to cvSaveImage error.

You need to add ,1 before the parentheses in each line where cvRetrieveFrame, on file gerador.py

Harpia these patches work with Ubuntu 4.10 Lucid Lynx.

Revision history for this message
Clovis Peruchi Scotti (roboscotti) wrote :

After so long, the most "correct fix" is in fact to add "-x c++" option to the gcc calling line.
Another related problem is due to the different packages that represent opencv in the new version.
In Karmic, depending on "libcv-dev" would get you all the necessary packages; in lucid, these packages are unlinked; libhighgui-dev wont bring libcvaux-dev on its dependencies and neither will the opposite. The fix is to add:
"libcvaux-dev, libhighgui-dev, libcv-dev" to debian/control instead (the third is not necessary but IT FEELS RIGHT to do this right now so it won't break again in the future.

As for the software itself, the new release (harpia 1.1) just changes the header files and the "-x c++" thing, this release can be downloaded from http://www.das.ufsc.br/~scotti/harpia/harpia_1.1.tar.gz (the only changed file is gerador.py and it does fixes the opencv2 issues)
This elegant fix comes from Michal Krombholz.

I'll try to pass it to my ppa as a appropriate .deb and then submit it as SRU (https://wiki.ubuntu.com/StableReleaseUpdates) later on.

Changed in harpia:
status: In Progress → Fix Released
Revision history for this message
Clovis Peruchi Scotti (roboscotti) wrote :

Minimal debdiff that adds the "-x c++" option to gcc, adds the missing dependencies and updates the standards-version.

description: updated
Changed in harpia (Ubuntu):
status: New → Fix Released
Revision history for this message
Clovis Peruchi Scotti (roboscotti) wrote :

More on the rationale to SRU:
Rationale:

*No regression potential since:
a) no packages use harpia (no rdepends),
b) the package is unusable as it is now,
c) the changes are minimal and only "additive" in a sense.

Revision history for this message
Fabrice Coutadeur (fabricesp) wrote :

Hi,

In your debdiff:
- you shouldn't bump standards-version in a SRU
- You say in your changelog that you added dependencies, but this is not the case in the debdiff. According to the compilation error, it seems that the missing headers are fixed by adding this dependencies.

Also, I tried example 4 (face detection), and it also fails with an OpenCV error. This one may also requires a fix.

Please fix your debdiff.

Also, you can seek sponsorship by subscribing Ubuntu Sponsors Team.

Thanks,
Fabrice

Changed in harpia (Ubuntu Lucid):
status: New → Incomplete
description: updated
Revision history for this message
Clovis Peruchi Scotti (roboscotti) wrote :

Hi Fabrice, thanks for the fast reply.
As you notest, I forgot to change some things.

I'm uploading a newer .debdiff (which won't bump standards-version and adds the dependencies).

About example 04, it will only work if you have a installed webcam on /dev/video0 and it indeed needs the other dependencies.
Note that in the missing the camera case, the error is a runtime error, not a compile time one...

I just built the package and tested here and (NOW) everything seems better.

Changed in harpia (Ubuntu Lucid):
status: Incomplete → Fix Released
Changed in harpia (Ubuntu Lucid):
status: Fix Released → In Progress
Revision history for this message
Fabrice Coutadeur (fabricesp) wrote :

Uploaded to lucid-proposed. Waiting for approval of a SRU team member.
Thanks for your work!

Fabrice

Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Accepted into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in harpia (Ubuntu Lucid):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Clovis Peruchi Scotti (roboscotti) wrote :

Installed from -proposed, works for me.

Revision history for this message
nicolagiacobbe (giacobbe-nicola) wrote :

Installed from -proposed, now harpia is working on my machine.
There are still some warnings but unrelated (I suppose) to the actual bug.

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package harpia - 1.0-0ubuntu1.1

---------------
harpia (1.0-0ubuntu1.1) lucid-proposed; urgency=low

  * harpia/gerador.py: Eliminating incompatibilities to opencv2 by adding -x c++
    to gcc calls (LP: #480772); without this the app is unusable.
  * debian/control: Adding missing dependencies (libcvaux-dev, libhighgui-dev)
    (since opencv dependency tree changed in lucid)
 -- Clovis Peruchi Scotti <email address hidden> Mon, 24 May 2010 20:29:50 -0300

Changed in harpia (Ubuntu Lucid):
status: Fix Committed → Fix Released
Revision history for this message
DarkJavi (darkjavi) wrote :

Just isntalled harpia on ubuntu 10.04, the bug is still there

Revision history for this message
Clint Byrum (clint-fewbar) wrote : Re: [Bug 480772] Re: OpenCV 2 incompatibilities

Excerpts from DarkJavi's message of Sun Dec 11 21:20:33 UTC 2011:
> Just isntalled harpia on ubuntu 10.04, the bug is still there
>

Dark Javi, can you post the output of 'apt-cache policy harpia' ?

> --
> You received this bug notification because you are a member of Ubuntu
> Stable Release Updates Team, which is subscribed to the bug report.
> https://bugs.launchpad.net/bugs/480772
>
> Title:
> OpenCV 2 incompatibilities
>
> Status in Harpia Project:
> Fix Released
> Status in “harpia” package in Ubuntu:
> Fix Released
> Status in “harpia” source package in Lucid:
> Fix Released
>
> Bug description:
> In Lucid Lynx, Ubuntu uses Opencv2.
>
> OpenCV 2 changes the prototype of some functions (using for example
> default parameters):
>
> /* save image to file */
> CVAPI(int) cvSaveImage( const char* filename, const CvArr* image,
>                         const int* params CV_DEFAULT(0) );
>
> Since this third parameter is not accounted for in Harpia, the user
> will get errors when compiling/running any programs (even the
> samples).
>
> TEST CASE: Open Harpia, go to "Help>Examples>01-Hello-World.hrp", press F9 (run). This will exit with a error message/red light
> (the compile error msg can be viewed clicking twice on the "Show Image" block). This way the application is totally unusable.
> Expected behavior would be to have a green light on the status message and seeing the image (lenna.png) when clicking twice on
> the "Show Image" block.
> "Help>Examples>04-Face-Detection-And-Cropping.hrp" should also work in machines with supported & configured webcam, this is also a test case for the added dependencies.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/harpia/+bug/480772/+subscriptions

Revision history for this message
Fabrice Coutadeur (fabricesp) wrote :

Not fixed in the development version. reopening the task

Changed in harpia (Ubuntu Oneiric):
status: New → Confirmed
Changed in harpia (Ubuntu):
status: Fix Released → Confirmed
Revision history for this message
Fabrice Coutadeur (fabricesp) wrote :

My bad: this is another bug linked to --as-needed. Opening a new one.

Changed in harpia (Ubuntu):
status: Confirmed → Fix Released
Changed in harpia (Ubuntu Oneiric):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.