ca.mcgill.cim.sre.cv4hci
Class BufferedIplImage

java.lang.Object
  extended by java.awt.Image
      extended by java.awt.image.BufferedImage
          extended by ca.mcgill.cim.sre.cv4hci.BufferedIplImage
All Implemented Interfaces:
java.awt.image.RenderedImage, java.awt.image.WritableRenderedImage, java.awt.Transparency

public class BufferedIplImage
extends java.awt.image.BufferedImage

BufferedIplImage is a BufferedImage that accepts IplImage objects as source. It is used as a translator between OpenCV's IplImage and Java's BufferedImage. You can construct a BufferedIplImage with an IplImage, and later update it with new images using the update method for efficiency.

Since:
1.0

Field Summary
 
Fields inherited from class java.awt.image.BufferedImage
TYPE_3BYTE_BGR, TYPE_4BYTE_ABGR, TYPE_4BYTE_ABGR_PRE, TYPE_BYTE_BINARY, TYPE_BYTE_GRAY, TYPE_BYTE_INDEXED, TYPE_CUSTOM, TYPE_INT_ARGB, TYPE_INT_ARGB_PRE, TYPE_INT_BGR, TYPE_INT_RGB, TYPE_USHORT_555_RGB, TYPE_USHORT_565_RGB, TYPE_USHORT_GRAY
 
Fields inherited from class java.awt.Image
accelerationPriority, SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
BufferedIplImage(IplImage image)
          BufferedIplImage constructor specifiying the IplImage to copy from.
 
Method Summary
static int getImageType(IplImage image)
          Converts an IplImage type to a BufferedImage type.
 boolean update(IplImage image)
          Updates this BufferedIplImage with new data from the IplImage.
 
Methods inherited from class java.awt.image.BufferedImage
addTileObserver, coerceData, copyData, createGraphics, flush, getAlphaRaster, getCapabilities, getColorModel, getData, getData, getGraphics, getHeight, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getProperty, getProperty, getPropertyNames, getRaster, getRGB, getRGB, getSampleModel, getSource, getSources, getSubimage, getTile, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getTransparency, getType, getWidth, getWidth, getWritableTile, getWritableTileIndices, hasTileWriters, isAlphaPremultiplied, isTileWritable, releaseWritableTile, removeTileObserver, setData, setRGB, setRGB, toString
 
Methods inherited from class java.awt.Image
getAccelerationPriority, getScaledInstance, setAccelerationPriority
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BufferedIplImage

public BufferedIplImage(IplImage image)
BufferedIplImage constructor specifiying the IplImage to copy from. Note: No exception is thrown, but it might well be the case that the IplImage provided has no BufferedImage equivalent, in which case it will not be copied.

Method Detail

getImageType

public static int getImageType(IplImage image)
Converts an IplImage type to a BufferedImage type.

Parameters:
image - input IplImage whose type we are interested in
Returns:
corresponding type of BufferedImage (-1 == incompatible)

update

public boolean update(IplImage image)
Updates this BufferedIplImage with new data from the IplImage. If the size or the type of the image is different from us, false will be returned.

Parameters:
image - new data to copy to us
Returns:
true if IplImage was compatible with us, otherwise false