Recent Changes - Search:

edit SideBar

imageFilters Module

Module to filter images.

The specific filters provided by this module depend on the host implementation of the module. The filters provided in the Ptolemy II/Nashorn host are documented in the auto-generated doc file for the current version of the host implementation. Those filters are provided by Jerry Huxtable, licensed under the Apache License, Version 2.0. The code is available at http://www.jhlabs.com/ip/filters.

This module defines two functions, a filter() function that takes an image, a filter name, and an options object, and returns a modified image, and a filters() function that returns an array of filter names implemented on the host.

Functions

The following functions are implemented by this module:

  • filter(image, name, options): Invoke the named filter on the specified image with the specified options and return the result. Any unrecognized options are ignored. Note that previously applied options for a given filter will still be used, even if they are not set in this call. The options are described in the <a href="https://chess.eecs.berkeley.edu/ptexternal/src/ptII/doc/codeDoc/js/module-imageFilters.html">detailed documentation</a>.
  • filters(): Return an array of filter names for image filters currently available on the current host.

Usage

To filter a single image from the default camera (for example to invert the colors), you can do this:

   var cameras = require("cameras");
   var imageFilters = require("imageFilters");
   var camera = new cameras.Camera();
   camera.open();
   var image = camera.snapshot();
   camera.close();
   var modifiedImage = imageFilters.filter(image, "Invert"); // Use default options.

See Also

  • OpenCV - It might be possible to use OpenCV in the browser.

Back to Optional JavaScript Modules

Edit - History - Print - Recent Changes - Search
Page last modified on February 14, 2017, at 05:49 PM