Question

I have developed an application for object recognition, using the Chris Evans OpenSURF implementation of SURF algorithm. I'm doing some experiments and I just realized that the algorithm does not behave well, if I launch the application through the IDE or directly with double clicking in the .exe file. I have checked that the .exe file is the binary compiled of the code I'm launching through the IDE. It seems that there is something different maybe related with the floating point precision, when launching the app from IDE or from .EXE, because the SURF algorithm is deterministic and with the same input always must return the same output. Some examples. The first and second columns are the number of points extracted from the images. The third column is the difference between this first and second.

EXE VS Diff

17340 17366 -26 Image001

4639 4631 8 Image002

3196 3189 7 Image003

10442 10441 1 Image004

1485 1477 8 Image005

5539 5555 -16 Image006

18102 18073 29 Image007

Anyone can tell me why the ouput is different if the algorithm and the code is exactly the same?

Thanks

Was it helpful?

Solution

This is because when we compile the code, then we have to on the optimization mode compilation.

Optimization mode compilation is in to way whether to speed up or to short the code. In visual studio when you go to the project option then you see the optimization setting in the C/C++ option where you set the code maximum code optimization by following option depending on the code itself.

1. Optimization: Maximum Speed 2.Enable Intrinsic function : Yes 3. Favor Size or Speed: Favor fast code

and there is more option of optimization in COde Generation option

Floating Point Model :Fast

Note: 1.these options are to speed up the processing But some time unstable the code.

  1. Always build release version when testing the time.
  2. Run individual the program exe(not from the IDE like Visual Studio), because if you run it from Visual studio the debugger of visual studio is attached to it which slows the running time.
  3. Always use release version of dlls.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top