當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。