Skip to content

Introduction to Machine Vision

Environment Setup

First, we need to install the necessary software:

Next, install the required packages. In VS Code, click on the menu bar View - Terminal to open the terminal, and enter the following commands:

Install opencv-contrib-python:

pip install opencv-contrib-python

Install Matplotlib:

pip install matplotlib

Install scikit-image:

pip install scikit-image

Install dlib. Since direct installation may cause errors, we need to download the .whl file first: Download Link

Navigate to the directory where the file is located and run the command:

pip install dlib-19.21.1-cp39-cp39-win_amd64.whl

Install face-recognition:

pip install face-recognition

Install cvlib:

pip install cvlib

Install keras:

pip install keras

Install tensorflow:

pip install tensorflow

If the previous command fails, you can try the following command:

python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

Install flask:

pip install flask

With these steps, the environment for machine vision is now configured.

Notes

To resolve the issue of relative path errors, add the following statement:

import os
dirname, filename = os.path.split(os.path.abspath( __file__))
os.chdir(dirname)

References and Acknowledgements

Original: https://wiki-power.com/
This post is protected by CC BY-NC-SA 4.0 agreement, should be reproduced with attribution.

This post is translated using ChatGPT, please feedback if any omissions.