How can I create a .deb package with my compiled OpenCV build?

I thought I would add a better answer for anyone else observing this thread.

So, if you've already gone through the trouble of building opencv on the device, you've probably followed the instructions here:

http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html

In which case, if you don't add the -D args to dynamically override CMake parameters in step two and you instead just run cmake .. inside the build directory (you created), it will generate a CMakeCache.txt file.

If you edit the CMakeCache.txt file, you can change:

CPACK_BINARY_DEB:BOOL=ON

...in addition to the other specified variables in the above opencv link. Instead of running make or make install... just run make package and the magic happens.

Warning: If you have WITH_CUDA:BOOL=ON you may have dependency issues with the packager - and that's a totally different question...

For more info see the CPACK_*_*:BOOL parameters in the cmake files, and consult the CPack documentation:

http://www.cmake.org/Wiki/CMake:CPackPackageGenerators


If by OpenCV you mean the computer vision libraries at http://opencv.willowgarage.com/ then they are already packaged for debian by the Debian Science Team.

Your best bet is to download the debianised source package from your nearest debian mirror, modify the debian/rules and/or Makefile or configure etc as needed to compile correctly on the raspberry pi and rebuild the packages.

The packaging work is already done, there's no need to do it again....and again and again every time your want to update them.

There's a whole bunch of binary packages, but libopencv-dev is probably what you want to start with http://packages.debian.org/search?keywords=libopencv-dev