|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.ri.createlab.video.VideoHelper
public final class VideoHelper
Constructor Summary | |
---|---|
VideoHelper()
|
Method Summary | |
---|---|
int[] |
blobCalibration()
Method for getting back calibration values for the blob detector method. |
int[] |
blobDetector(int[] calibrationVals,
int sensitivity)
The blob detector detects all of the pixels that are within a certain range of the CalibrationVals, where the width of the range is determined by the value sensitivity. |
void |
closeVideo()
Closes the video stream. |
void |
closeVideoScreen()
Closes the video window |
void |
drawCircle(int radius,
int centerX,
int centerY)
Draws a circle on the camera image. |
void |
drawNothing()
Call this if you want to no longer display a polygon on the camera image. |
void |
drawPolygon(Polygon poly)
Draws a generic polygon into the image. |
void |
drawRectangle(int minX,
int minY,
int maxX,
int maxY)
Draws a rectangle in the video window. |
Color |
getAreaColor(int minX,
int minY,
int maxX,
int maxY)
Gets the AVERAGE Color value of the pixels in a portion of the image. |
int[] |
getAreaRGBValues(int minX,
int minY,
int maxX,
int maxY)
Gets the AVERAGE RGB values of the pixels in a portion of the image. |
BufferedImage |
getImage()
Returns as a BufferedImage object the most recent image retrieved from the camera |
int |
getImageHeight()
Get the image height |
int |
getImageWidth()
Get the image width |
Color |
getPixelColor(int x,
int y)
Gets the color of a given pixel as a Java Color object at the coordinate specified by x,y |
int[] |
getPixelRGBValues(int x,
int y)
Gets the Red, Green, and Blue values of the pixel at the coordinate specified by x,y |
void |
initVideo()
Initializes and starts a new video stream, which can be used to track objects, react to colors placed in the field of view of the camera, and to bring up a window of what the camera is seeing. |
void |
setFillPolygon(boolean setting)
Sets whether the polygon is filled in or an outline. |
void |
setPolygonColor(Color polyColor)
Sets the color of any polygon, rectangle, or circle drawn into the image. |
void |
showVideoScreen(String name)
Displays a window that shows the camera image. |
void |
updateVideoScreen()
Updates the image in the video window. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VideoHelper()
Method Detail |
---|
public void initVideo()
public void closeVideo()
public BufferedImage getImage()
public int getImageHeight()
public int getImageWidth()
public int[] getPixelRGBValues(int x, int y)
x
- The row of the pixely
- The column of the pixel
public Color getPixelColor(int x, int y)
x
- The row of the pixely
- The column of the pixel
public int[] getAreaRGBValues(int minX, int minY, int maxX, int maxY)
minX
- minimum X coordinate of rectangleminY
- minimum Y coordinate of rectanglemaxX
- maximum X coordinate of rectanglemaxY
- maximum Y coordinate of rectangle
public Color getAreaColor(int minX, int minY, int maxX, int maxY)
minX
- minimum X coordinate of rectangleminY
- minimum Y coordinate of rectanglemaxX
- maximum X coordinate of rectanglemaxY
- maximum Y coordinate of rectangle
public int[] blobCalibration()
public int[] blobDetector(int[] calibrationVals, int sensitivity)
calibrationVals
- An array containing the RGB values of the pixel to look forsensitivity
- The sensitivity of the detector - higher values lead to more noise, while low values
might not pick up very much of the object being tracked. A suggested value for a brightly colored object is 10.
public void showVideoScreen(String name)
name
- the name to give the windowpublic void updateVideoScreen()
public void closeVideoScreen()
public void drawRectangle(int minX, int minY, int maxX, int maxY)
minX
- minimum X coordinate of rectangleminY
- maximum X coordinate of rectanglemaxX
- minimum Y coordinate of rectanglemaxY
- maximum Y coordinate of rectanglepublic void drawCircle(int radius, int centerX, int centerY)
radius
- The radius of the circle in pixelscenterX
- The X coordinate of the center of the circlecenterY
- The Y coordinate of the center of the circlepublic void drawNothing()
public void setPolygonColor(Color polyColor)
polyColor
- The color to set the polygon to.public void setFillPolygon(boolean setting)
setting
- true sets the polygon to be filled in, false sets it to outlinepublic void drawPolygon(Polygon poly)
poly
- The polygon object to draw into the image
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |