devs.visionpackage.org.cmotch.robovision
Class VisionObject

java.lang.Object
  extended by devs.visionpackage.org.cmotch.robovision.VisionObject

public class VisionObject
extends java.lang.Object

Class that represents an object seen by the robot


Field Summary
static int CENTRE
           
static int LEFT
           
static int NO_DATA
           
static int RIGHT
           
 
Constructor Summary
VisionObject(VisionImage visionImage, byte colour)
          Constructor
 
Method Summary
 int getBottom()
          Get the position of the bottom most pixel in our object
 java.awt.Point getCentre()
          Get the position of the centre of our object
 byte getColour()
          Get the colour of this object
 int getLeft()
          Get the position of the left most pixel in our object
 int getPosition()
          Get the position of the object, i.e.
 int getRight()
          Get the position of the right most pixel in our object
 int getTop()
          Get the position of the top most pixel in our object
 void setDebugLevel(int debugLevel)
          Set the debug level to ouput information
 void setLeftMargin(int margin)
          Set the left hand margin value.
 void setRightMargin(int margin)
          Set the right hand margin value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_DATA

public static final int NO_DATA
See Also:
Constant Field Values

CENTRE

public static final int CENTRE
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values
Constructor Detail

VisionObject

public VisionObject(VisionImage visionImage,
                    byte colour)
Constructor

Parameters:
visionImage - The image to analyse
colour - The colour of the object we're interested in
Method Detail

getColour

public byte getColour()
Get the colour of this object

Returns:
The colour of the object

getPosition

public int getPosition()
Get the position of the object, i.e. is it in the centre of the field of view, to the left or the right


getLeft

public int getLeft()
Get the position of the left most pixel in our object


getRight

public int getRight()
Get the position of the right most pixel in our object


getTop

public int getTop()
Get the position of the top most pixel in our object


getBottom

public int getBottom()
Get the position of the bottom most pixel in our object


getCentre

public java.awt.Point getCentre()
Get the position of the centre of our object


setLeftMargin

public void setLeftMargin(int margin)
Set the left hand margin value. This is the value that will determine whether the class decides that the object is to the left of the view or not. Values should be expressed as a percentage of the total width of the image. Values over 50% will be ignored.

Parameters:
margin - The percentage of the image width that is the left margin

setRightMargin

public void setRightMargin(int margin)
Set the right hand margin value. This is the value that will determine whether the class decides that the object is to the right of the view or not. Values should be expressed as a percentage of the total width of the image. Values less than 50% or over 100% will be ignored.

Parameters:
margin - The percentage of the image width that is the left margin

setDebugLevel

public void setDebugLevel(int debugLevel)
Set the debug level to ouput information

Parameters:
debugLevel - The debug level to use 1=less messages, 3 is max