Personal website – >www.yansongsong.cn

Recently, I was developing the raspberry PI + USB camera recognition module and planned to use OpenCv. However, I found that the installation tutorials of Raspberry PI OpenCv on the Internet were too tedious and took up a lot of memory. After my own experiments, I found a very simple and quick way, which could be installed in ten minutes if the Internet speed was OK.

My environment:

  • Raspberry pie 3 b +
  • Python3.5.4
  • Raspberry PI official operating system

Here are the installation steps:

  • Raspberry PI related library installation: sudo apt-get update sudo apt-get install libjpeg-dev sudo apt-get install libatlas-base-dev sudo apt-get install libjpeg-dev sudo apt-get install libtiff5-dev sudo apt-get install libpng12-dev sudo apt-get install libqtgui4 libqt4-test sudo apt-get install libjasper-dev
  • Sudo pip3 install opencv-python

The installation is complete

  • test

    Enter: python3 at the terminal

    Then: import cv2

    If the installation is successful, there will be no problem with the import

    Here you can output the version number of OpenCv

    Use: print (cv2.version)

    Exit Python with: exit()

Simple application

Use OpenCv library to read USB camera, real-time display, take photos

  • The code is as follows:
import cv2 import numpy as np cap = cv2.VideoCapture(0) while(1): # get a frame ret, frame = cap.read() # show a frame cv2.imshow("capture", frame) if cv2.waitKey(1) & 0xFF == ord('q'): Cv2.imwrite ("takephoto2.jpg", frame) print("take Photo Ok") break cap.release() cv2.DestroyallWindows ()Copy the code
  • Run a screenshot



    hope this helps

TensorFlow2.0:

I have bought the course, the quality is very high, both principle explanation and actual practice. Highly recommended. The disadvantage is that the teaching is very detailed, it takes a lot of time to read, but there are still a lot of harvest from deep study. You can gain deep learning knowledge and skills, and you can also learn practical programming. You u can get a red envelope of 20 yuan if you are doing activities now.

Welcome to join the author’s Knowledge Planet: “AI Deep Learning Application Road”

Based on the sharing of theoretical learning and application development technology of deep learning, the author will often share the dry contents of deep learning. When learning or applying deep learning, you can also communicate with me on this page if you have any questions.

The price of a few cups of milk tea can be purchased with a one-year subscription, according to Song Shizhi, CSDN blog expert and zhihu deep learning columnist