Recompile OpenCV 1.1 for 64 bit Windows 7

asked 2013-04-10 10:41:26 -0600

AndyL gravatar image

I have a large code base that I wrote to use OpenCV 1.1. Originally I wrote this for a 32 bit Windows XP box. Now I would like to compile the code for 64 bit Windows 7. Here are some questions:

  • Are there pre-comipiled 64 bit binaries for OpenCV 1.1 that I can link against? If so where?
  • How possible would it be to recompile OpenCV 1.1 from source using mingw-w64 or some other compiler that could target 64bit?
  • How difficult would recompiling be compared to updating my code to run with OpenCV2.x?

My code is hefty, maybe ten thousand lines or so. (For those interested the code is here: http://github.com/samuellab/mindcontrol )

Why am I bothering? Why not run this as a 32 bit binary on 64 bit Windows? Well with the migration to newer hardware I must now link my code against 64 bit binaries. As I understand it, I cannot generate 32 bit code that is statically linked to third party 64 bit libraries. So my conclusion is to recompile everything for 64 bit including OpenCV.

I am on Windows 7 64 bit. I have been using 32bit mingw from mingw.org for compiling for 32 bit targets and the mingw-w64 cross compiler for compiling to 64 bit targets.

Any help would be appreciated.

Thank you.

edit retag flag offensive close merge delete

Comments

1

"How difficult would recompiling be compared to updating my code to run with OpenCV2.x?"

if i were in your shoes, before trying anything else, i'd get 2.4.4 and try to compile your codebase against it. yes, stuff got deprecated / moved to legacy (but afaiik, nothing ever got thrown away )

headers changed, libraries too, most of the work will go into changing your projects/makefiles

at least you're up to date then, any effort in upwarming 1.1 seems to be a dead end

berak gravatar imageberak ( 2013-04-10 14:02:50 -0600 )edit

Yeah. That makes sense.

AndyL gravatar imageAndyL ( 2013-04-10 14:45:17 -0600 )edit

It seems here: http://docs.opencv.org/trunk/doc/tutorials/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.html that you they dropped the "cv" from the beginning of all the functions? Does that mean I will have to go through and rename every opencv function I call?

AndyL gravatar imageAndyL ( 2013-04-10 14:48:40 -0600 )edit

hehe, not me, i'm not part of that team ;)

and no, the 1.1 api is still the same, cvNamedWindow, etc, it still runs, as of 2.4.9 ( github master )

the 2.0 api is running in parallel, it has all calls with replaced cv prefix for cv:: namespace prefix, but that should not bother you

berak gravatar imageberak ( 2013-04-10 14:54:04 -0600 )edit

Thanks @berak. I just git cloned the most recent OpenCV 2.4.9 and am still figuring out how the heading structure works. It seems like the legacy opencv headers that I am familiar with are in: opencv/include/opencv/ but that then just point to other headers that are not where I would expect. Seems like core_c.h for example is in: opencv/modules/core/include/ opencv2/core/ I may have to seriously redo my makefile.

AndyL gravatar imageAndyL ( 2013-04-10 15:48:49 -0600 )edit

bit unfortunate, cloning current master, since in 2.0 core.hpp was inside the core folder, too, and they just(week ago) moved it out ( up one to opencv2 )

also, if you're looking for functions "vanished", they're most probably in legacy.hpp

"I may have to seriously redo my makefile." yes, but if the ppl there did it right, that's all you've got to do ;)

berak gravatar imageberak ( 2013-04-10 15:56:59 -0600 )edit

Now I'm thinking it might be worth learning cmake, since OpenCV seems to play really nicely with it. Maybe I can reimplement my make file in cmake since i'm going to have to change it all up anyway.

AndyL gravatar imageAndyL ( 2013-04-11 07:10:38 -0600 )edit
1

I would recommend to not work with 'master' branch, please use '2.4' instead. 'master' is used for 3.0 preparation, and you'll have a lot of troubles using it...

Kirill Kornyakov gravatar imageKirill Kornyakov ( 2013-04-12 15:23:08 -0600 )edit

Thanks @Kirill, I am already downgraded to 2.4. However, I am have all sorts of problems getting cmake to use mingw-w64, see this question: http://answers.opencv.org/question/11600/can-opencv-2x-be-compiled-with-mingw-w64-through/

AndyL gravatar imageAndyL ( 2013-04-14 15:50:04 -0600 )edit