Here's a partial answer. To cross-compile OpenCV and dlib for Raspbian 8 Jessie, mount your sdcard to an Ubuntu machine and set up like so:
cd ~/
git clone https://github.com/raspberrypi/tools
git clone https://github.com/opencv/opencv
git clone https://github.com/davisking/dlib
sudo apt install cmake
cd opencv; mkdir build; cd build
CC=$HOME/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc \
CXX=$HOME/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ \
cmake --config Release -DWITH_PNG=OFF -DWITH_JPEG=OFF ..
make -j8
sudo mount --bind /media/<your username>/root/usr/local /usr/local
sudo make install
cd ../../dlib; mkdir build; cd build
CC=$HOME/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc \
CXX=$HOME/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ \
cmake --config Release ..
make -j8
sudo make install
sudo umount /usr/local
Why disable JPEG and PNG support in OpenCV? Well these depend on zlib, so you'd need zlib cross-compiled for the Pi or else those would fail to build. Keep this in mind as later I touch upon how cross-compilation tasks like this tend to snowball out of control.
You can then take your micro-SD card out and put it back in the Pi and it'll have your cross-compiled OpenCV + dlib libraries, but we're still missing a big part you asked for: Python support.
So let's inspect what's required there:
sudo apt install cmake-curses-gui
cd ~/opencv/build
ccmake ..
In the CMake configuration you'll see missing variables like PYTHON2_LIBRARY. In order to link OpenCV for Python you'd need a libpython*.so
cross-compiled as well! This is do-able and you could even pull the binaries off your Pi and use the mount trick for pointing CMake at the appropriate paths. Before we go down that route, may I suggest an alternative.
On your Pi, you can install the appropriate Python bindings via:
sudo apt install python-opencv cmake libboost-python-dev
sudo env CC=clang CXX=clang++ pip install -v dlib
For C++ projects it's not uncommon that custom cross-compilation comes about in order to satisfy downstream linking requirements. But if you're planning to use only Python, can't you get by using the standard prebuilt packages for OpenCV?
As for dlib, the pip compiles locally so it's slow. Perhaps one hour on a Pi 3 and longer on other models. As shown above I used clang to avoid gcc taking up all of the Pi's RAM.
.deb
file. Is there some ambiguity in the question? :/ I don't know where you're getting the.deb
file bit.