当前位置: 首页>>代码示例>>Java>>正文


Java ColorGRAY类代码示例

本文整理汇总了Java中org.lasarobotics.vision.util.color.ColorGRAY的典型用法代码示例。如果您正苦于以下问题:Java ColorGRAY类的具体用法?Java ColorGRAY怎么用?Java ColorGRAY使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ColorGRAY类属于org.lasarobotics.vision.util.color包,在下文中一共展示了ColorGRAY类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: frame

import org.lasarobotics.vision.util.color.ColorGRAY; //导入依赖的package包/类
@Override
public Mat frame(Mat rgba, Mat gray) {
    /**
     * Set analysis boundary
     * You should comment this to use the entire screen and uncomment only if
     * you want faster analysis at the cost of not using the entire frame.
     * This is also particularly useful if you know approximately where the beacon is
     * as this will eliminate parts of the frame which may cause problems
     * This will not work on some methods, such as COMPLEX
     *
     * We set the Analysis boundary in the frame loop just in case we couldn't get it
     * during init(). This happens when another app is using OpenCV simulataneously.
     * Doing so should only be necessary in testing apps
     **/
    //beacon.setAnalysisBounds(new Rectangle(new Point(width / 2, height/2), width - 200, 200));

    //Run all extensions, then get matrices
    rgba = super.frame(rgba, gray);
    gray = Color.rapidConvertRGBAToGRAY(rgba);

    //Display a Grid-system every 50 pixels
    /*final int dist = 50;
    for (int x = width/2 + 50; x<width; x+=dist)
        Drawing.drawLine(rgba, new Point(x, 0), new Point(x, height), new ColorRGBA("#88888822"), 1);
    for (int x = width/2 - 50; x>=0; x-=dist)
        Drawing.drawLine(rgba, new Point(x, 0), new Point(x, height), new ColorRGBA("#88888822"), 1);
    Drawing.drawLine(rgba, new Point(width/2, 0), new Point(width/2, height), new ColorRGBA("#ffffff44"), 1);
    for (int y = height/2 + 50; y<height; y+=dist)
        Drawing.drawLine(rgba, new Point(0, y), new Point(width, y), new ColorRGBA("#88888822"), 1);
    for (int y = height/2 - 50; y>=0; y-=dist)
        Drawing.drawLine(rgba, new Point(0, y), new Point(width, y), new ColorRGBA("#88888822"), 1);
    Drawing.drawLine(rgba, new Point(0, height/2), new Point(width, height/2), new ColorRGBA("#ffffff44"), 1);*/

    //Get beacon analysis
    Beacon.BeaconAnalysis beaconAnalysis = beacon.getAnalysis();

    //Display confidence
    Drawing.drawText(rgba, "Confidence: " + beaconAnalysis.getConfidenceString(),
            new Point(0, 50), 1.0f, new ColorGRAY(255));

    //Display beacon color
    Drawing.drawText(rgba, beaconAnalysis.getColorString(),
            new Point(0, 8), 1.0f, new ColorGRAY(255), Drawing.Anchor.BOTTOMLEFT);

    //Display FPS
    Drawing.drawText(rgba, "FPS: " + fps.getFPSString(), new Point(0, 24), 1.0f, new ColorRGBA("#ffffff"));

    //Display Beacon Center
    Drawing.drawText(rgba, "Center: " + beacon.getAnalysis().getCenter().toString(), new Point(0, 78), 1.0f, new ColorRGBA("#ffffff"));

    //Display analysis method
    Drawing.drawText(rgba, beacon.getAnalysisMethod().toString() + " Analysis",
            new Point(width - 300, 40), 1.0f, new ColorRGBA("#FFC107"));

    //Display rotation sensor compensation
    Drawing.drawText(rgba, "Rot: " + rotation.getRotationCompensationAngle()
            + " (" + sensors.getScreenOrientation() + ")", new Point(0, 50), 1.0f, new ColorRGBA("#ffffff"), Drawing.Anchor.BOTTOMLEFT); //"#2196F3"

    return rgba;
}
 
开发者ID:ykarim,项目名称:FTC2016,代码行数:61,代码来源:CameraTestVisionOpMode.java


注:本文中的org.lasarobotics.vision.util.color.ColorGRAY类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。