Install OpenCV 4.1.2 on Raspbian Buster
$ chmod +x *.sh
$ ./download-opencv.sh
$ ./install-deps.sh
$ ./build-opencv.sh
$ cd ~/opencv/opencv-4.1.2/build
$ sudo make install
Check you can run test.py
using both python 2 and 3 to verify that OpenCV python bindings were successfully installed
$ wget "https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png" -O lenna.jpg
$ python2 test.py lenna.jpg
$ python3 test.py lenna.jpg
WARNING: Users of boards with 1GB of memory
Compiling is very memory intensive, you will likely need to increase your swap size. Assuming you have a reasonably large SD card (>16GB to be safe), follow the procedure below to increase your swap size from the default 100MB to 2GB
$ sudo dphys-swapfile swapoff
$ sudo sed -i 's:CONF_SWAPSIZE=.*:CONF_SWAPSIZE=2048:g' /etc/dphys-swapfile
$ sudo reboot
I spoke a little too fast. I could install but then got an "Illegal instruction" error when trying to use it, because it was not appropriately compiled for Raspberry Pi Zero (my device). Following instructions on pyimagesearch, I could finally build it successfully. for thos who want to do it for RPi Zero, needs to remove these 2 flags:
-D ENABLE_NEON=ON
-D ENABLE_VFPV3=ON
and be patient... it took 20h to build openCV on the RPi zero. Don't forget to increase the swap to 2G and just 'make' instead of 'make -j4'
@cyysky I wish I could make a package like you did, it's very convenient for install for less experiences people!