本文整理汇总了Java中edu.wpi.first.wpilibj.camera.AxisCameraException类的典型用法代码示例。如果您正苦于以下问题:Java AxisCameraException类的具体用法?Java AxisCameraException怎么用?Java AxisCameraException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AxisCameraException类属于edu.wpi.first.wpilibj.camera包,在下文中一共展示了AxisCameraException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: returnPIDInput
import edu.wpi.first.wpilibj.camera.AxisCameraException; //导入依赖的package包/类
protected double returnPIDInput() {
if(numMisses < 6) {
try{
storeTop();
// startProcessing();
System.out.println("Feeding in : "+top.center_mass_x);
numMisses = 0;
return top.center_mass_x;
}
catch(AxisCameraException e) {
numMisses++;
System.out.println("Error (165): "+e.getMessage());
return 165;
}
}
else {
System.out.println("Could not process 6 times in a row. Exiting...");
numMisses = 0;
// this.disable();
return 165;
}
}
开发者ID:FIRST-FRC-Team-4097,项目名称:Robot-Code-2013,代码行数:23,代码来源:CameraSubsystem.java
示例2: getImage
import edu.wpi.first.wpilibj.camera.AxisCameraException; //导入依赖的package包/类
/**
* 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;
}
开发者ID:OASTEM,项目名称:FRCTesting,代码行数:14,代码来源:ImageUtils.java
示例3: processFrame
import edu.wpi.first.wpilibj.camera.AxisCameraException; //导入依赖的package包/类
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];
}
}
开发者ID:Team-2502,项目名称:RobotCode2013,代码行数:39,代码来源:Vision.java
示例4: getHeightOfTarget
import edu.wpi.first.wpilibj.camera.AxisCameraException; //导入依赖的package包/类
public int getHeightOfTarget() {
try {
storeTop();
} catch (AxisCameraException ex) {
}
return top.boundingRectHeight;
}
开发者ID:FIRST-FRC-Team-4097,项目名称:Robot-Code-2013,代码行数:8,代码来源:CameraSubsystem.java
示例5: getImage
import edu.wpi.first.wpilibj.camera.AxisCameraException; //导入依赖的package包/类
public ColorImage getImage() throws AxisCameraException, NIVisionException {
return cam.getImage();
}
开发者ID:SaratogaMSET,项目名称:649code2014,代码行数:4,代码来源:CameraSubsystem.java
示例6: storeTop
import edu.wpi.first.wpilibj.camera.AxisCameraException; //导入依赖的package包/类
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, RED_HIGH, GREEN_LOW, GREEN_HIGH, BLUE_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.");
}
开发者ID:FIRST-FRC-Team-4097,项目名称:Robot-Code-2013,代码行数:54,代码来源:CameraSubsystem.java
注:本文中的edu.wpi.first.wpilibj.camera.AxisCameraException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论