Advertisement
Guest User

Untitled

a guest
May 27th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. --- Installing OpenCV on Pi ---
  2.  
  3. https://www.pyimagesearch.com/2017/10/09/optimizing-opencv-on-the-raspberry-pi/
  4.  
  5. Note the installation could take some time to complete (for me ~1 hour).
  6.  
  7. sudo apt-get purge wolfram-engine
  8. sudo apt-get purge libreoffice*
  9. sudo apt-get clean
  10. sudo apt-get autoremove
  11.  
  12. sudo apt-get update && sudo apt-get upgrade
  13.  
  14. sudo apt-get install build-essential cmake pkg-config
  15. sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
  16. sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
  17. sudo apt-get install libxvidcore-dev libx264-dev
  18. sudo apt-get install libgtk2.0-dev libgtk-3-dev
  19. sudo apt-get install libcanberra-gtk*
  20. sudo apt-get install libatlas-base-dev gfortran
  21. sudo apt-get install python2.7-dev python3-dev
  22.  
  23. cd ~
  24. wget -O opencv.zip https://github.com/opencv/opencv/archive/3.3.0.zip
  25. unzip opencv.zip
  26. wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.3.0.zip
  27. unzip opencv_contrib.zip
  28.  
  29. pip3 install numpy
  30.  
  31. cd ~/opencv-3.3.0/
  32. mkdir build
  33. cd build
  34. cmake -D CMAKE_BUILD_TYPE=RELEASE \
  35. -D CMAKE_INSTALL_PREFIX=/usr/local \
  36. -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \
  37. -D ENABLE_NEON=ON \
  38. -D ENABLE_VFPV3=ON \
  39. -D BUILD_TESTS=OFF \
  40. -D INSTALL_PYTHON_EXAMPLES=OFF \
  41. -D BUILD_EXAMPLES=OFF ..
  42.  
  43. # Update CONF_SWAPSIZE to a larger size.
  44. sudo nano /etc/dphys-swapfile
  45.  
  46. # set size to absolute value, leaving empty (default) then uses computed value
  47. # you most likely don't want this, unless you have an special disk situation
  48. # CONF_SWAPSIZE=100
  49. CONF_SWAPSIZE=1024
  50.  
  51. sudo /etc/init.d/dphys-swapfile restart
  52.  
  53. make -j4
  54.  
  55. sudo make install
  56. sudo ldconfig
  57.  
  58. # Reset CONF_SWAPSIZE to a smaller size.
  59. sudo nano /etc/dphys-swapfile
  60.  
  61. # set size to absolute value, leaving empty (default) then uses computed value
  62. # you most likely don't want this, unless you have an special disk situation
  63. CONF_SWAPSIZE=100
  64. # CONF_SWAPSIZE=1024
  65.  
  66. sudo /etc/init.d/dphys-swapfile restart
  67.  
  68. cd /usr/local/lib/python3.5/dist-packages/
  69.  
  70. sudo mv cv2.cpython-35m-arm-linux-gnueabihf.so cv2.so
  71.  
  72. cd ~
  73.  
  74. # Test OpenCV.
  75. python3
  76.  
  77. >>> import cv2
  78. >>> cv2.__version__
  79. '3.3.0'
  80. >>> quit()
  81.  
  82. --- Installing dlib and face_recognition python3 packages ---
  83.  
  84. Note the installation could take some time to complete (for me about more than 2 hours).
  85.  
  86. https://gist.github.com/ageitgey/1ac8dbe8572f3f533df6269dab35df65
  87.  
  88. sudo apt-get install build-essential \
  89. cmake \
  90. gfortran \
  91. git \
  92. wget \
  93. curl \
  94. graphicsmagick \
  95. libgraphicsmagick1-dev \
  96. libatlas-dev \
  97. libavcodec-dev \
  98. libavformat-dev \
  99. libboost-all-dev \
  100. libgtk2.0-dev \
  101. libjpeg-dev \
  102. liblapack-dev \
  103. libswscale-dev \
  104. pkg-config \
  105. python3-dev \
  106. python3-numpy \
  107. python3-pip \
  108. zip
  109.  
  110. sudo apt-get install python3-picamera
  111.  
  112. pip3 install --upgrade picamera[array]
  113.  
  114. # Update CONF_SWAPSIZE to a larger size.
  115. sudo nano /etc/dphys-swapfile
  116.  
  117. # set size to absolute value, leaving empty (default) then uses computed value
  118. # you most likely don't want this, unless you have an special disk situation
  119. # CONF_SWAPSIZE=100
  120. CONF_SWAPSIZE=1024
  121.  
  122. sudo /etc/init.d/dphys-swapfile restart
  123.  
  124. pip3 install dlib
  125. pip3 install face_recognition
  126.  
  127. # Reset CONF_SWAPSIZE to a smaller size.
  128. sudo nano /etc/dphys-swapfile
  129.  
  130. # set size to absolute value, leaving empty (default) then uses computed value
  131. # you most likely don't want this, unless you have an special disk situation
  132. CONF_SWAPSIZE=100
  133. # CONF_SWAPSIZE=1024
  134.  
  135. sudo /etc/init.d/dphys-swapfile restart
  136.  
  137. --- Installing imutils python3 package ---
  138.  
  139. pip3 install imutils
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement