|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object devs.visionpackage.org.cmotch.robovision.VisionImage
public class VisionImage
Class that represents the image that was captured from the camera This includes methods to allow the caller to find out what objects were seen, if any, and what colour they were.
Field Summary | |
---|---|
static byte |
BLUE
|
static byte |
EDGE
|
static byte |
EMPTY
|
static byte |
GREEN
|
static byte |
NO_COLOUR
|
static byte |
NUMBER_OF_COLOURS
|
static byte |
OCCUPIED
|
static byte |
RED
|
Constructor Summary | |
---|---|
VisionImage(java.awt.Image image)
Constructor |
Method Summary | |
---|---|
boolean |
canYouSee(byte colour)
Look for coloured object. |
boolean[] |
getColoursSeen()
Get the colours, if any, that were seen in the image. |
int |
getHeight()
Get the height of the image |
java.awt.Image |
getImage()
Get the raw Image object (can be used for display) |
int |
getPixel(int x,
int y)
Get the value of a particular pixel |
int[] |
getPixelMap()
Get the pixel map for this image |
VisionObject |
getVisionObject(byte colour)
Get the information about an object viewed by the robot |
int |
getWidth()
Get the width of the image |
void |
setDebugLevel(int level)
Set debug level |
boolean |
testPixelColour(int pixel,
byte colour)
Determine whether a pixel is of a particular colour using the thresholds array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte RED
public static final byte GREEN
public static final byte BLUE
public static final byte NUMBER_OF_COLOURS
public static final byte NO_COLOUR
public static final byte EMPTY
public static final byte EDGE
public static final byte OCCUPIED
Constructor Detail |
---|
public VisionImage(java.awt.Image image) throws VisionException
image
- The source image from the camera
VisionException
- If the image is unusableMethod Detail |
---|
public void setDebugLevel(int level)
public int getWidth()
public int getHeight()
public java.awt.Image getImage()
public int[] getPixelMap()
public int getPixel(int x, int y)
x
- The X co-ordinate of the pixely
- The Y co-ordinate of the pixelpublic boolean[] getColoursSeen()
NOTE: These vision algorithms are quite simple, so we restrict our processing to the primary colours red, blue and green. If you put a non-primary coloured object in the field of view it may well appear as two objects in the same place.
public boolean testPixelColour(int pixel, byte colour)
pixel
- The pixel to checkcolour
- The colour to test the pixel for
public boolean canYouSee(byte colour)
colour
- The colour of the object to look forpublic VisionObject getVisionObject(byte colour)
colour
- The colour to look for (NO_COLOUR means any colour,
which will be the first of red, blue or green that was seen
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |