GithubHelp home page GithubHelp logo

00mjk / intro_to_computer_vision Goto Github PK

View Code? Open in Web Editor NEW

This project forked from acflippo/intro_to_computer_vision

0.0 0.0 0.0 77.21 MB

An introduction to computer vision, a course developed by me for a local high school robotics team.

Python 0.03% Jupyter Notebook 99.97%

intro_to_computer_vision's Introduction

Introduction to Computer Vision

This is an introduction to Computer Vision using Python. I will be using online resources and examples whenever it is available. I'll provide inline reference to the source code, discussions and inspiration.

Topics

Lesson 1: Computer Vision Basics

  • 1D, 2D and 3D arrays
  • Read in a picture
  • Grayscale a picture
  • Subset an array and picture

Lesson 2: Blurring

  • Primary Colors in computer vision is Red, Green and Blue
  • Subtractive versus Additive color processes
  • Why blur a picture

Lesson 3: Edge Detection

  • How to write a function in Python
  • What is a gradient (in the x-direction)
  • Write your own gradient function (for the y-direction) for a grayscale picture

Lesson 4: Color Detection

  • Bitwise operations
  • Error Handling in Python
  • Another color coding system (HSV = Hue, Saturation and Value)
  • Finding contours

Lesson 5: Shape Detection

  • Shapes
  • SMore on contours
  • SCentroid and Area from Contours
  • Occulsion

Lesson 6: Shape Detection

  • Angles
  • Distance
  • Distortions

Environment

The instructions below have been tested on Python 3.7. I mainly use Anaconda https://www.anaconda.com/products/individual > Products > Individual Edition as my virtual environment and install the necessary packages.

Here are the steps in creating your environment:

  1. Install Anaconda according to the instructions for your operating system.

  2. Create a python 3.8 with the basic packages as follows in your terminal via command line for Mac OS. For Windows, you will need to use the "Anaconda Prompt" and not the generic Window's Prompt.


   prompt> conda create -n py38cv python=3.8 conda numpy scipy

It will ask you to confirm the installation of package, you enter "y" to confirm.

  1. Activate your environment

   prompt> conda activate py38cv
  1. Install image processing libraries

   prompt> conda install -c conda-forge scikit-image
  1. Install image processing functions

   prompt> conda install -c conda-forge imutils
  1. Install OpenCV if not already installed

   prompt> conda install -c conda-forge opencv
   
  1. To verify your environment, invoke the python interactive command prompt by executing "python" in your terminal.

   prompt> python

   Python 3.8.5 | packaged by conda-forge | (default, Jul 31 2020, 02:18:36)
   [Clang 10.0.1 ] on darwin
   >>>
  1. Type the following package import at the prompt:

   >>> from skimage.measure import compare_ssim
   >>> import argparse
   >>> import imutils
   >>> import cv2
   >>> import numpy as np
   >>> print(cv2.__version__)

   >>> 4.4.0     # this can return any 4.x.x version depending on your operating system and when you installed opencv

  1. To exit from the python interactive session, type exit() and hit return.

   >>> exit()

You should encounter no errors. Now your environment is ready to go for the lessons.

Windows Environment Troubleshooting

If you have issues importing imutils, try the following to install imutils.


   prompt> conda install pip
   prompt> pip install imutils

Or, for Windows 10 64-bit, try:


   prompt> conda install -c pjamesjoyce imutils

Jupyter Notebook IDE

If you set up your python environment using Anaconda, you will be able to run the Jupyter Notebook IDE for python. To start the Notebook IDE, activate the py38cv environment. Your prompt will change to (py38cv) when your environment is activated and execute "jupyter notebook" as follows.



   (base)> activate py38cv
   (py38cv)> jupyter notebook

This will start the Notebook IDE in your preferred browser as http://localhost:8888/?token=xxxx . You can always grab the link and paste it in your browser if needed.

To exit your Notebook environment, just save your notebook and close all Jupyter notebook tabs in your browser. On the command prompt from where your notebook was launched, run Ctrl-C to stop the IDE and type "y" to confirm. To deactivate your python environment run "conda deactivate".

Note: DO NOT USE the Anaconda Navigator (the GUI) to launch your Juypter notebook as it will not initiate your py38cv environment as required for these lessons.



   >>> Ctrl-C [enter]
   >>> conda deactivate

Windows Environment Troubleshooting

If you have trouble running "jupyter notebook", try installing or re-installing jupyter package.


   prompt> conda install -c anaconda jupyter

Jupyter Lab

Jupyter Lab provides the same functionality as Jupyter notebook but with better navigation. To get Jupyter Lab, install the following in your environment.


   prompt> conda install -c conda-forge jupyterlab

intro_to_computer_vision's People

Contributors

acflippo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.