/**
 * (./) CvBlob.java, v0.1 - 04/05/08
 * (by) Douglas Edric Stanley & Cousot Stéphane
 * (cc) some right reserved
 *
 * Part of the Processing/Java OpenCV Libraries project, for the Atelier Hypermedia, art 
 * school of Aix-en-Provence, and for the Processing and Java community of course.
 *
 *
 * THIS LIBRARY (AND ALSO THIS FILE) IS RELEASED UNDER A CREATIVE COMMONS ATTRIBUTION 3.0 LICENSE
 * ‹ http://creativecommons.org/licenses/by/3.0/ ›
 */
 


// package name
package hypermedia.video;


import processing.core.*;
import java.awt.Rectangle;




// create symlink 'class' for older code compatibilities
//class Blob extends CvBlob {}




/**
 * A storage object containing a blob detected by OpenCV.
 * Returned by <code>blobs()</code> method.  
 *
 * @example blobs
 * @see OpenCV#blobs( int, int, int, boolean )
 * @see OpenCV#blobs( int, int, int, boolean, int )
 * @usage Application
 */
public class CvBlob
{

	
	/** The area of the blob in pixels */
	public float area			= 0f;
	/** The length of the perimeter in pixels */
	public float length			= 0f;
	/** The centroid or barycenter of the blob */
	public PVector centroid		= new PVector();
	/** The containing rectangle of the blob */
	public Rectangle rectangle	= new Rectangle();
	/** The list of points defining the shape of the blob */
	public PVector[] points		= new PVector[0];
	/** Is this blob a hole inside of another blob? */
	public boolean isHole		= false;
	
	
	/** A list of color int, containing the image pixels created by loadPixels()
	 *
	 * @see #loadPixels() */
	public int[] pixels	= new int[0];
	
	
	
	/**
	 * Create a new Blob with the default properties.
	 */
	protected CvBlob() {}
	
	
	/**
	 * Create a new Blob with the given properties.
	 *
	 * @param area		the shape area
	 * @param length	the contour length
	 * @param centroid	the shape barycentre point
	 * @param rect		the shape rectangle
	 * @param points	the contour points
	 * @param isHole	true whether this blob is completly inside a bigger one
	 */
	protected CvBlob
	( float area, float length, PVector centroid, Rectangle rect, PVector[] points, boolean isHole )
	{
		this.area		= area;
		this.length		= length;
		this.centroid	= centroid;
		this.rectangle	= rect;
		this.points		= points;
		this.isHole		= isHole;
	}
	
	/**
	 * Generates an image from the current blob shape, using the current frame for pixel content.
	 *
	 * After the <code>loadPixels()</code> call, pixels can by accessed via the <code>pixels</code> variable.
	 *
	 * <p>This method should be called directly after the blob detection process to retrieve the correct
	 * data values.</p>
	 * <p>! NOT YET IMPLEMENTED</p>
	 * 
	 * @see #pixels
	 * @invisible
	 */
	public void loadPixels()
	{
	}
	
	
	/**
	 * Returns blob's image as PImage.
	 * <p>! NOT IMPLEMENTED YET</p>
	 *
	 * @return PImage
	 * @invisible
	 */
	public PImage image()
	{
		return new PImage( rectangle.width, rectangle.height );
	}
	
	
	/**
	 * Smooth contour.
	 * @invisible
	 */
	public PVector[] smooth( float value )
	{
		return null;
	}
	
	
	/**
	 * Simplify contour.
	 * @invisible
	 */
	public PVector[] simplify( float value )
	{
		return null;
	}
	
}

