Giter Club home page Giter Club logo

imagefiltering's Introduction

Image Filtering

This repository contains a set of examples and tests for image filtering using Processing and the OpenCV library for Processing by Greg Borenstein.

##Filtering the image for blob detection

The following sketch should help us to filter the source image for blob detection. It requires the controlP5 library.

Code: ImageFiltering.pde

The sketch is doing the following:

  • Adjust contrast: highlight blobs
  • Thresholding: (Basic OR adaptive)
  • Noise reduction: (with dilation and erosion)
  • Blur filter: to remove remaining background noise
  • Set minimal blob size: to eliminate small blobs (spots, etc) that may be in the background.

Using basic thresholding

Thresholding is one of the most important filtering operations.

Using adaptive thresholding

Adaptive thresholding is a more advanced option to filter your image. For environments with changing illumination or if you simply get a source image with shadows or irregular illumination, try better this. You can see an example in the next image, where the

Just open the sketch and do some tests ;)

Color Tracking

Simple color tracking based on the hue channel.

Code: HSVColorTracking.pde

For color tracking with multiple colors, check this sketch:

Code: MultipleColorTracking.pde

Blob persistence (memory) over time

For some applications it may be important to "follow" a blob or an object over time (as markers or TUIO do).

"One of the most common questions I get regarding blob tracking is “memory.” How do I know which blob is which over time? Computer vision libraries, for the most part, simply pass you a list of blobs (with x, y, width, and height properties) for any given moment in time. But the blobs themselves represent only a snapshot of that particular moment and contain no information related to whether the blobs existed before this very moment. This may seem absurd given that as human beings it’s so easy for us to watch a rectangle moving across a screen and understand conceptually that it is the same rectangle. But without additional information (such as color matching, an AR marker, etc.) there’s no way for an algorithm that analyzes one frame of video to know anything about a previous frame. And so we need to apply the same intuitions our brain uses (it was there a moment ago, it’s probably still there now) to our algorithms" (by Daniel Shiffman)

Inside the BlobPersistence repository, the sketch WichFace implements a persistence algorithm that follows faces over time. It is a modification of Daniel Shiffman's algorithm that works the OpenCV library for Processing by Greg.

The same algorithm is also implemented in the ImageFilteringWithBlobPersistence example in this repository to track blobs over time:

Code:

For detailed information about this algorithm visit Daniel Shiffman's blog: http://shiffman.net/2011/04/26/opencv-matching-faces-over-time/

##Future Work In the future this repository will contain more sketches for color tracking, camera calibration, etc.

##More For more info about OpenCV and more examples, visit the library's github repository: https://github.com/atduskgreg/opencv-processing

imagefiltering's People

Contributors

jorditost avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

imagefiltering's Issues

Could not run example ImageFiltering and ImageFilteringWithBLob examples in Processing 3

Not sure if you are keeping these updated. Haven't come across any documentation of others having issues but these are not running with Processing 3. The console error output is as follows:

java.lang.RuntimeException: Waited 5000ms for: <5c2d4feb, 52eaaa1e>[count 2, qsz 0, owner <main-FPSAWTAnimator#00-Timer0>] - <main-FPSAWTAnimator#00-Timer0-FPSAWTAnimator#00-Timer1> at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:449) at java.lang.Thread.run(Thread.java:745) Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help → Troubleshooting.

Just wanted to let you know.

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.