项目:2014_software
文件:HotGoalDetector.java
public void getimages(String imageAppend)
{
try
{
ColorImage image = camera.getimage();
if(imageWriteLevel >= 1 && imageWriteLevel <= 3)
{
NIVision.writeFile(image.image,"/ColorImage" + imageAppend + ".jpg");
System.out.println("Saving Color Image");
}
}
catch(Throwable t)
{
t.printstacktrace();
}
}
项目:wpilibj
文件:AxisCamera.java
/**
* Get an image from the camera. Be sure to free the image when you are done with it.
* @return A new image from the camera.
*/
public ColorImage getimage() throws AxisCameraException,NIVisionException {
ColorImage image = new HSLImage();
if (getimageFn.call1(image.image) == 0) {
image.free();
throw new AxisCameraException("No image available");
}
return image;
}
项目:FRCTesting
文件:ImageUtils.java
/**
* ColorImage- getimage/getTarget/refresh/update
* should filter image and get details
* http://www.spectrum3847.org/frc2012api/edu/wpi/first/wpilibj/image/ColorImage.html
*/
public ColorImage getimage() throws AxisCameraException,NIVisionException {
ColorImage image=new HSLImage();
if (true) {//getimageFn.call1(image.image) == 0) {
image.free();
throw new AxisCameraException("No image available");
}
return image;
}
项目:2014_software
文件:WsCamera.java
项目:RobotCode2013
文件:Vision.java
public VisionTarget [] processFrame() {
if (enableVision) {
lastFrame = System.currentTimeMillis();
try {
ColorImage image = camera.getimage();
BinaryImage bImage = image.thresholdRGB(
redLow,redHigh,greenLow,greenHigh,blueLow,blueHigh);
BinaryImage fImage = bImage.particleFilter(cc);
ParticleAnalysisReport [] report = fImage.getorderedParticleAnalysisReports();
VisionTarget [] targets = new VisionTarget[report.length];
for (int i = 0; i < report.length; i++) {
double centerX = report[i].center_mass_x;
double centerY = report[i].center_mass_y;
double width = report[i].boundingRectWidth;
double height = report[i].boundingRectHeight;
int area = (int)report[i].particleArea;
targets[i] = new VisionTarget(centerX,centerY,width,height,area);
}
frameProcess = System.currentTimeMillis() - lastFrame;
image.free();
bImage.free();
fImage.free();
return targets;
} catch (AxisCameraException e) {
System.out.println("No Image From Camera: ");
frameProcess = System.currentTimeMillis() - lastFrame;
return new VisionTarget[0];
} catch (Exception ex) {
System.out.println("Camera Exception Thrown: " + ex.getMessage());
frameProcess = System.currentTimeMillis() - lastFrame;
return new VisionTarget[0];
}
} else { // Vision is not enabled
return new VisionTarget[0];
}
}
项目:wpilib-java
文件:AxisCamera.java
/**
* Get an image from the camera. Be sure to free the image when you are done with it.
* @return A new image from the camera.
*/
public ColorImage getimage() throws AxisCameraException,NIVisionException {
ColorImage image = new HSLImage();
if (getimageFn.call1(image.image) == 0) {
image.free();
throw new AxisCameraException("No image available");
}
return image;
}
public BinaryImage getFilteredImage() throws Exception {
ColorImage ci = getimage();
bi = ci.thresholdRGB(RED_LOW,RED_HIGH,GREEN_LOW,GREEN_HIGH,BLUE_LOW,BLUE_HIGH);
bi = bi.convexHull(false);
bi = bi.removeSmallObjects(true,3);
bi = bi.particleFilter(cc);
ci.free();
return bi;
}
项目:Team_1482_2013
文件:vision.java
public BinaryImage getHSVimage(ColorImage image){
try{
this.HSVimage = image.thresholdHSV(92,196,19,100,30,100);
} catch (NIVisionException ex) {
ex.printstacktrace();
}
System.out.println("Processed HSV image");
return this.HSVimage;
}
项目:Team_1482_2013
文件:vision.java
public BinaryImage getRGBimage(ColorImage image) {
try{
this.RGBimage = image.thresholdRGB(0,150,145,230,120,225);
} catch (NIVisionException ex) {
ex.printstacktrace();
}
System.out.println("Processing RGB image");
return this.RGBimage;
}
private void storetop() throws AxisCameraException {
top = null;
ColorImage ci = getimage();
ParticleAnalysisReport target = null;
if(ci != null) {
try{
System.out.println("Storing top details...");
bi = ci.thresholdRGB(RED_LOW,BLUE_HIGH);
// ci.free();
// ci.image.clear();
// ci.image.free();
bi = bi.convexHull(false);
bi = bi.particleFilter(cc);
bi = bi.removeSmallObjects(true,2);
System.out.println("Got here.");
ParticleAnalysisReport[] reports = bi.getorderedParticleAnalysisReports();
ParticleAnalysisReport tmp;
int lastHighest = 321;
for(int i=0; i<reports.length; i++) {
tmp = reports[i];
if(tmp.center_mass_y < lastHighest) {
lastHighest = tmp.center_mass_y;
target = tmp;
}
}
}
catch(Exception e) {
isProcessing = false;
System.out.println("Error in the processing.");
throw new AxisCameraException("Error: "+e.getMessage());
}
if(target == null) {
isProcessing = false;
throw new AxisCameraException("No targets found that fit the specified criteria.");
}
else {
System.out.println(target.toString());
top = target;
}
// }
// catch(Exception e) {
// isProcessing = false;
// throw new AxisCameraException("Error: "+e.getMessage());
// }
}
else {
isProcessing = false;
throw new AxisCameraException("Couldn't get image.");
}
isProcessing = false;
System.out.println("Finished processing.");
}
项目:2017
文件:KilroyCamera.java
/**
* Returns the AxisCamera (final),in case direct access is necessary
* For the most part,this should not be used,and if a new camera
* method is needed,it should just be added to this class
*
* @method getCameraInstance()
* @return ColorImage - Camera.getimage() or a 0x0 hsl image
* @author Nathan Lydick
* @throws NIVisionException
* - throws exception when fails
* @written Oct 16,2014
* -------------------------------------------------------
*/
public ColorImage getimage () throws NIVisionException
{
if (this.haveCamera)
return this.camera.getimage();
// returns a 0x0 image
return new HSLImage();
}
项目:2016
文件:KilroyCamera.java
项目:2017
文件:ImageProcessing.java
/**
* Updates the current working image
*
* @param image
* the image to be used as the working image
*/
public void updateImage (ColorImage image)
{
this.image = image;
}
项目:2017
文件:ImageProcessing_old.java
/**
* Updates the current working image
*
* @param image
* the image to be used as the working image
*/
public void updateImage (ColorImage image)
{
this.image = image;
}
项目:2016
文件:ImageProcessing.java
/**
* Updates the current working image
*
* @param image
* the image to be used as the working image
*/
public void updateImage (ColorImage image)
{
this.image = image;
}