Opencv on Raspberry pi
Cross compiling OpenCV 4 for Raspberry Pi
I recommend that you do the build in a Debian Buster virtual machine or a Docker container in order to not mess your system.
Build Step
Cross compiling OpenCV 4 for Raspberry Pi Zero
Unfortunately the crossbuild-essential-armhf from Debian will not generate working binaries for Raspberry Pi Zero, so we can’t use the cross compilation procedure… In order to cross compile OpenCV, we are going to use a slightly more involved procedure, in which we’ll basically emulate an ARM processor on a more powerful x86-64 Debian….t is much slower than the [cross compilation] approach. Please note that, even with an emulated ARM architecture, cross compiling OpenCV is much faster than building directly on a Raspberry Pi Zero where it could take days, assuming that the build doesn’t fail because of the limited amount of RAM on the Pi Zero.