victorcapelini / jopensurf

Automatically exported from code.google.com/p/jopensurf
Other
0 stars 0 forks source link

Serious performance issues with latest code #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download the latest source
2. Run 'ant example'
3. Notice incredibly long running time

What is the expected output? What do you see instead?

In version 4-14-10, running the example takes 14 seconds on my old laptop.  It 
takes far longer than that with the most recent code and binary downloads.  
It's practically unusable; I get tired of waiting for it to complete.

What version of the product are you using? On what operating system?

Latest SVN code on Ubuntu 10.10

Please provide any additional information below.

I believe the problem was caused during a rewrite of 
com.stromberglabs.jopensurf.Surf.getPoints(...).  In the version 4-14-10, 
'mFreeOrientedPoints' was assigned directly, effectively caching the results 
for subsequent calls.  I'm not sure if this is actually the correct behavior, 
but assuming it is, the fix is to assign either 'mFreeOrientedPoints' or 
'mUprightPoints' the calculated value of 'points' in that method.  I included a 
diff patch with this report; using 'mFreeOrientedPoints' when 'upright' is true 
doesn't seem right to me, but it is consistent with the earlier check of what 
field to assign to 'points'.

diff --git a/src/com/stromberglabs/jopensurf/Surf.java 
b/src/com/stromberglabs/jopensurf/Surf.java
index ffe08d2..0c51ffa 100644
--- a/src/com/stromberglabs/jopensurf/Surf.java
+++ b/src/com/stromberglabs/jopensurf/Surf.java
@@ -105,6 +105,12 @@ public class Surf implements Serializable {
                List<SURFInterestPoint> points = upright ? mFreeOrientedPoints : mUprightPoints;
                if ( points == null ){
                        points = getDescriptorFreeInterestPoints();
+                       // cache for next time through
+                       if (upright) {
+                               mFreeOrientedPoints = points;
+                       } else {
+                               mUprightPoints = points;
+                       }
                        for ( SURFInterestPoint point : points ){
                                getOrientation(point);
                                getMDescriptor(point,upright);

Original issue reported on code.google.com by nwchr...@gmail.com on 21 Nov 2010 at 9:33

GoogleCodeExporter commented 9 years ago
This issue got fixed, apparently I was mixing up the upright and the 
free-oriented points as well when I went through the assignments. Thanks for 
catching this!

Original comment by jojopot...@gmail.com on 6 Dec 2010 at 4:15