Saturday, February 10, 2018

Vision Overview

In my earlier Python post I mentioned how easy is to install Open CV

OpenCV is the most popular library for computer vision. Originally written in C/C++, it now provides bindings for Python. OpenCV uses machine learning algorithms to search for faces within a picture. For something as complicated as a face, there isn’t one simple test that will tell you if it found a face or not. Instead, there are thousands of small patterns/features that must be matched. The algorithms break the task of identifying the face into thousands of smaller, bite-sized tasks, each of which is easy to solve
Here is what you can do with OpenCV

Well before we start mentioning the provided examples on web site, it is good to have the API search tool - i.e. reading and writing images API

Here as part of the gui features we will read an image from disk. Likewise, we can write a copy of the image to the disk.

Here are some of the methods we will use:

  • file name
  • flag on way image should be read
  • named window name
  • image
  • file name on disk
  • image

import cv2
import numpy as np

#practice numpy


 img = cv2.imread('img.JPG',cv2.IMREAD_GRAYSCALE)

# ----------showing with opencv.........

cv2.imshow('my image',img)
k = cv2.waitKey(0) & 0xFF

if k == 27: # wait for ESC key to exit
elif k == ord('s'): # wait for 's' key to save and exit
       cv2.imwrite('img2.JPG',img) # writing the image


  •  mouse as paint brush

    No comments:

    Post a Comment