-
Notifications
You must be signed in to change notification settings - Fork 14
OpenCV
OpenCV is a computer vision library released under a BSD license and hence it is free for both academic and commercial use. It has C++, C, Python and Java interfaces and supports Windows, Linux, Mac OS, iOS and Android. OpenCV was designed for computational efficiency and with a strong focus on real-time applications.
The goals of the OpenCV project were described as:
-
Advance vision research by providing not only open but also optimized code for basic vision infrastructure. No more reinventing the wheel.
-
Disseminate vision knowledge by providing a common infrastructure that developers could build on, so that code would be more readily readable and transferable.
-
Advance vision-based commercial applications by making portable, performance-optimized code available for free-with a license that did not require to be open or free themselves.
Detailed information of all the functionalities of the library can be found in [link] (http://www.cs.indiana.edu/cgi-pub/oleykin/website/OpenCVHelp/).
Although OpenCV 1.0 has been ported to the EoT board, it is also important to have the possibility of running newer releases. To achieve this goal, an external server running an API to use OpenCV 2.4.3 is used. With this approach, it is actually possible to run any OpenCV version.
Concretely, a free Pythonanywhere server has been used. This is a free service which provides a server with web2py and OpenCV 2.4.3 in which it is possible to program any computer vision capabilities.
In order to configure the Pythonanywhere server, the following steps should be followed:
- Register for a free account in PythonAnywhere.com
- Once you have registered and logged in, go to the Web tab, and Add a new web app
- Select web2py as your python framework.
- Select an admin password for web2py. Note that this is a web2py admin password, and it is different from your PythonAnywhere.com password.
- Open a new tab, and go to web2py admin interface located at: https://username.pythonanywhere.com/admin/default/index
- You should see your application folder under the Files tab on PythonAnywhere when you go down the directory structure home/username/web2py/appname
- To add OpenCV code to the web2py open the following code: home/username/web2py/applications/appname/controllers/default.py and add new functions there. For testing, the following functions which use OpenCV to obtain the dimensions of the image have been developed. The program can receive a URL with the image and an image embedded in the HTTP request:
def image_dimensions():
# Masquerade as Mozilla because some web servers may not
like python bots.
hdr = {'User-Agent': 'Mozilla/5.0'}
# Set up the request
req = urllib2.Request(request.vars.url, headers=hdr)
try:
# Obtain the content of the url
con = urllib2.urlopen( req )
# Read the content and convert it into an numpy array
im_array = np.asarray(bytearray(con.read()), dtype=np.uint8)
# Convert the numpy array into an image.
im = cv2.imdecode(im_array, cv2.IMREAD_GRAYSCALE)
# Get the width and heigh of the image.
height, width = im.shape
# Wrap up the width and height in an object and return the encoded JSON.
return json.dumps({"width" : width, "height" : height})
except urllib2.HTTPError, e:
return e.fp.read()
def process_image():
upfile = request.vars.imagen
fname = request.vars.imagen.filename
#return json.dumps({"Contenido del fichero" : upfile.file.read()})
#return json.dumps({"Nombre del fichero" : fname})
im_array = np.asarray(bytearray(upfile.file.read()), dtype=np.uint8)
# Convert the numpy array into an image.
im = cv2.imdecode(im_array, cv2.IMREAD_GRAYSCALE)
#cv2.imdecode(image, cv2.IMREAD_COLOR)
# PROCESS YOUR OPENCV IMAGE HERE. EXAMPLE: Get the width and heigh of the image.
height, width = im.shape
# Wrap up the width and height in an object and return the encoded JSON.
return json.dumps({"width" : width, "height" : height})If the server is running, it is possible to check its functionality using the well-known command line utility curl. The following are the commands to test both examples, sending an URL of a picture and sending the image file:
URL:
curl -F url=http://example.com/image.jpg
http://username.pythonanywhere.com/appname/default/image_dimensions
Image:
curl -v -X POST "http://eottest.pythonanywhere.com/opencvdemo/default/process_image" -F imagen=@fichero_imagen.jpg
It is also possible to create your own server using, for example, Python, Django and any OpenCV version, application or library (an example can be seen here).
The library is not currently optimized for Myriad 2, using only the LeonOS processor.
There are some known limitations of the port which work in the original OpenCV:
- The Highgui-User Interface functionality is not supported in the embedded device.
- JPEG and other image formats are not supported. On the contrary, PNG is fully supported through the use of zlib/libpng.
- Video is not supported due to dependencies with libraries optimised for PCs.
- Some parts of the library have been modified to store data in general memory and not in the stack. However, in order to use cascade detectors and other code that requires a significant amount of stack memory to allocate pointers the RTEMS minimum task stack size must be increased using:
==#define CONFIGURE_MINIMUM_TASK_STACK_SIZE 16384==
- zlib
- libpng 1.4 (included inside the EoT OpenCV library)
- SDCardIO
OpenCV is released under a BSD license and hence it is free for both academic and commercial use. By downloading, copying, installing or using the software you agree to this license. If you do not agree to this license, do not download, install, copy or use the software.
License Agreement For Open Source Computer Vision Library
Copyright (C) 2000-2008, Intel Corporation, all rights reserved. Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. Third party copyrights are property of their respective owners.
Website | Twitter | Linkedin | Flickr | Slideshare
Myriad
-
Libraries
-
Applications
-
Unittests
Desktop
-
Libraries
-
Applications
-
Unittests
Android
-
Applications