background preloader

Introduction to programming with OpenCV

Introduction to programming with OpenCV
Related:  Python webcam image captureComputer Vision

FaceDetector.Face Class Overview A Face contains all the information identifying the location of a face in a bitmap. Summary Constants public static final float CONFIDENCE_THRESHOLD The minimum confidence factor of good face recognition Constant Value: 0.4 public static final int EULER_X The x-axis Euler angle of a face. Constant Value: 0 (0x00000000) public static final int EULER_Y The y-axis Euler angle of a face. Constant Value: 1 (0x00000001) public static final int EULER_Z The z-axis Euler angle of a face. Constant Value: 2 (0x00000002) Public Methods public float confidence () Returns a confidence factor between 0 and 1. public float eyesDistance () Returns the distance between the eyes. public void getMidPoint (PointF point) Sets the position of the mid-point between the eyes. Parameters public float pose (int euler) Returns the face's pose. Returns the Euler angle of the of the face, for the given axis

Cell Counting - MATLAB & Simulink Example This example shows how to use a combination of basic morphological operators and blob analysis to extract information from a video stream. In this case, the example counts the number of E. Coli bacteria in each video frame. Note that the cells are of varying brightness, which makes the task of segmentation more challenging. Introduction This example illustrates how to use the morphological and BlobAnalysis System objects to segment individual cells and count them. Initialization Use these next sections of code to initialize the required variables and objects. VideoSize = [432 528]; Create a System object™ to read video from avi file. filename = 'ecolicells.avi'; hvfr = vision.VideoFileReader(filename, ... Create two morphological dilation System objects which are used to remove uneven illumination and to emphasize the boundaries between the cells. hdilate1 = vision.MorphologicalDilate('NeighborhoodSource', 'Property', ... hautoth = vision.Autothresholder( ... hblob = vision.BlobAnalysis( ...

Install libfreenect Drivers on Ubuntu libfreenect is the end result of the famous Adafruit Kinect hacking bounty X-Prize winner. After it made its mark on the scene, the OpenKinect community was born and the rest is history. This guide will provide the resources necessary to install the OpenKinect libfreenect drivers for Ubuntu. The original installation guide can be found at OpenKinect's Getting Started Guide. We'll be performing the entire operation using a Terminal app. First up, upon up a Terminal. Installing Dependencies Type in the following to install the required dependencies and packages necessary to install libfreenect. sudo apt-get install git-core cmake freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev libusb-1.0-0-dev This will take a bit of time depending on your internet connection and if you need to install all of these dependencies. Install libfreenect Create a directory in Home called Kinect. mkdir ~/Kinect cd ~/Kinect Use git to download the latest version of libfreenect sudo glview

Tutorial: OpenCV haartraining (Rapid Object Detection With A Cascade of Boosted Classifiers Based on Haar-like Features) - Naotoshi Seo Tutorial: OpenCV haartraining (Rapid Object Detection With A Cascade of Boosted Classifiers Based on Haar-like Features) Objective The OpenCV library provides us a greatly interesting demonstration for a face detection. Furthermore, it provides us programs (or functions) that they used to train classifiers for their face detection system, called HaarTraining, so that we can create our own object classifiers using these functions. It is interesting. However, I could not follow how OpenCV developers performed the haartraining for their face detection system exactly because they did not provide us several information such as what images and parameters they used for training. My working environment is Visual Studio + cygwin on Windows XP, or on Linux. FYI: I recommend you to work haartrainig with something different concurrently because you have to wait so many days during training (it would possibly take one week). A picture from the OpenCV website History Data Prepartion Positive (Face) Images

algorithm - Image Segmentation using Mean Shift explained Getting started with Kinect on Ubuntu 12.04 – OpenNI, Nite , SimpleopenNI and Processing « ramsrigoutham The objective of this tutorial is - 1) To install OpenNI, Nite (drivers that help getting data from the kinect) in Ubuntu 12.04. 2) To set up Processing and SimpleOpenNI ( OpenNI and Nite wrapper for Processing ) using which you can get started with Kinect coding. What you need? Kinect with usb cable and a computer with Ubuntu installed. It is not recommended to run Ubuntu as a wubi installer from Windows when working with Kinect. 1) Installing OpenNI and NITE 1) I highly recommend installing 32 bit versions of all even if yours is a 64 bit system. Tip: Instead of navigating to different folders using cd command you can enable Open in terminal option when you right click in any folder. sudo apt-get install nautilus-open-terminal After installing type : killall nautilus && nautilus in terminal to activate the change immediately. Testing the installation: Connect the kinect and ensure that the green Led on it is blinking. . The output with my Kinect: 1)Download processing for Linux from here.

PythonInterface Information on this page is deprecated, check the latest always-up-to-date documentation at . Starting with OpenCV release 2.2 , OpenCV will have completed it's new Python interface to cover all the C and C++ functions directly using numpy arrays. (The previous Python interface is described in SwigPythonInterface .) See notes on new developments at OpenCV Meeting Notes 2010-09-28 under "Vadim" subsection. Some highlights of the new bindings: single import of all of OpenCV using "import cv" OpenCV functions no longer have the "cv" prefix Simple types like CvRect and CvScalar use Python tuples Sharing of Image storage, so image transport between OpenCV and other systems (e.g. numpy and ROS) is very efficient Full documentation for the Python functions in Cookbook Convert an image import cv cv.SaveImage("foo.png", cv.LoadImage("foo.jpg")) Compute the Laplacian Notes

OpenCV 3 Image Thresholding and Segmentation Thresholding Thresholding is the simplest method of image segmentation. It is a non-linear operation that converts a gray-scale image into a binary image where the two levels are assigned to pixels that are below or above the specified threshold value. cv2.threshold(src, thresh, maxval, type[, dst]) This function applies fixed-level thresholding to a single-channel array. The function returns the computed threshold value and thresholded image. src - input array (single-channel, 8-bit or 32-bit floating point). Picture source: threshold dst - output array of the same size and type as src. Thresholding - code and output The code looks like this: Output: Original images are available : gradient.png and circle.png Adaptive Thresholding Using a global threshold value may not be good choicewhere image has different lighting conditions in different areas. cv.AdaptiveThreshold(src, dst, maxValue, adaptive_method=CV_ADAPTIVE_THRESH_MEAN_C, thresholdType=CV_THRESH_BINARY, blockSize=3, param1=5) where:

Projections of Reality OpenVIDIA/python - OpenVIDIA From OpenVIDIA This article describes how to get started using Python for computer vision. Why use Python at all? So lets say you have written some GPU "core" kernel. You'd like to wrap it with webcam, or video functions, or need it hooked up to other libraries, perhaps even other GPU libraries. Here's comes a high level scripting language to the rescue. Python is a `very high level' language that we'll use to take many different types of functionality such as file handling, web interface, database management and tie these to GPU computer vision by way of accessing existing GPU Computer vision libraries such as NPP, OpenCV and of course OpenVIDIA. So you can grab our favorite low level image processing GPU library for early processing, and maybe some GPU SVMs or solvers, hook in a database interface for image recogntion, and mix them with your work to make a whole pipeline without fuss. Installation We start by installing the following: Python 2.6 (32-bit version). while True: repeat()

Training Haar Cascades | memememe For better or worse, most cell phones and digital cameras today can detect human faces, and, as seen in our previous post, it doesn’t take too much effort to get simple face detection code running on an Android phone (or any other platform), using OpenCV. This is all thanks to the Viola-Jones algorithm for face detection, using Haar-based cascade classifiers. There is lots of information about this online, but a very nice explanation can be found on the OpenCV website. (image by Greg Borenstein, shared under a CC BY-NC-SA 2.0 license) It’s basically a machine learning algorithm that uses a bunch of images of faces and non-faces to train a classifier that can later be used to detect faces in realtime. The algorithm implemented in OpenCV can also be used to detect other things, as long as you have the right classifiers. Actually, that last link is for more than just iPhones. Similar to what we want, but since we have a very specific phone to detect, we decided to train our own classifier. 1.

Image format to save in python

Related: