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


Java NIVision.Rect方法代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.image.NIVision.Rect方法的典型用法代码示例。如果您正苦于以下问题:Java NIVision.Rect方法的具体用法?Java NIVision.Rect怎么用?Java NIVision.Rect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.wpi.first.wpilibj.image.NIVision的用法示例。


在下文中一共展示了NIVision.Rect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scoreXEdge

import edu.wpi.first.wpilibj.image.NIVision; //导入方法依赖的package包/类
/**
 * Computes a score based on the match between a template profile and the
 * particle profile in the X direction. This method uses the the column
 * averages and the profile defined at the top of the sample to look for the
 * solid vertical edges with a hollow center.
 *
 * @param image The image to use, should be the image before the convex hull
 * is performed
 * @param report The Particle Analysis Report for the particle
 *
 * @return The X Edge Score (0-100)
 */
public static double scoreXEdge(BinaryImage image, ParticleAnalysisReport report) throws NIVisionException {
    double total = 0;
    LinearAverages averages;

    NIVision.Rect rect = new NIVision.Rect(report.boundingRectTop, report.boundingRectLeft, report.boundingRectHeight, report.boundingRectWidth);
    averages = NIVision.getLinearAverages(image.image, LinearAverages.LinearAveragesMode.IMAQ_COLUMN_AVERAGES, rect);
    float columnAverages[] = averages.getColumnAverages();
    for (int i = 0; i < (columnAverages.length); i++) {
        if (xMin[(i * (XMINSIZE - 1) / columnAverages.length)] < columnAverages[i]
                && columnAverages[i] < xMax[i * (XMAXSIZE - 1) / columnAverages.length]) {
            total++;
        }
    }
    total = 100 * total / (columnAverages.length);
    return total;
}
 
开发者ID:OASTEM,项目名称:2014CataBot,代码行数:29,代码来源:ImagingUtils.java

示例2: scoreYEdge

import edu.wpi.first.wpilibj.image.NIVision; //导入方法依赖的package包/类
/**
 * Computes a score based on the match between a template profile and the
 * particle profile in the Y direction. This method uses the the row
 * averages and the profile defined at the top of the sample to look for the
 * solid horizontal edges with a hollow center
 *
 * @param image The image to use, should be the image before the convex hull
 * is performed
 * @param report The Particle Analysis Report for the particle
 *
 * @return The Y Edge score (0-100)
 *
 */
public static double scoreYEdge(BinaryImage image, ParticleAnalysisReport report) throws NIVisionException {
    double total = 0;
    LinearAverages averages;

    NIVision.Rect rect = new NIVision.Rect(report.boundingRectTop, report.boundingRectLeft, report.boundingRectHeight, report.boundingRectWidth);
    averages = NIVision.getLinearAverages(image.image, LinearAverages.LinearAveragesMode.IMAQ_ROW_AVERAGES, rect);
    float rowAverages[] = averages.getRowAverages();
    for (int i = 0; i < (rowAverages.length); i++) {
        if (yMin[(i * (YMINSIZE - 1) / rowAverages.length)] < rowAverages[i]
                && rowAverages[i] < yMax[i * (YMAXSIZE - 1) / rowAverages.length]) {
            total++;
        }
    }
    total = 100 * total / (rowAverages.length);
    return total;
}
 
开发者ID:OASTEM,项目名称:2014CataBot,代码行数:30,代码来源:ImagingUtils.java

示例3: scoreXEdge

import edu.wpi.first.wpilibj.image.NIVision; //导入方法依赖的package包/类
/**
 * Computes a score based on the match between a template profile and the particle profile in the X direction. This method uses the
 * the column averages and the profile defined at the top of the sample to look for the solid vertical edges with
 * a hollow center.
 * 
 * @param image The image to use, should be the image before the convex hull is performed
 * @param report The Particle Analysis Report for the particle
 * 
 * @return The X Edge Score (0-100)
 */
public double scoreXEdge(BinaryImage image, ParticleAnalysisReport report) throws NIVisionException
{
    double total = 0;
    LinearAverages averages;

    NIVision.Rect rect = new NIVision.Rect(report.boundingRectTop, report.boundingRectLeft, report.boundingRectHeight, report.boundingRectWidth);
    averages = NIVision.getLinearAverages(image.image, LinearAverages.LinearAveragesMode.IMAQ_COLUMN_AVERAGES, rect);
    float columnAverages[] = averages.getColumnAverages();
    for(int i=0; i < (columnAverages.length); i++){
        if(xMin[(i*(XMINSIZE-1)/columnAverages.length)] < columnAverages[i] 
                && columnAverages[i] < xMax[i*(XMAXSIZE-1)/columnAverages.length]){
            total++;
                }
    }
    total = 100*total/(columnAverages.length);
    return total;
}
 
开发者ID:grt192,项目名称:2013ultimate-ascent,代码行数:28,代码来源:GRTVisionTracker.java

示例4: scoreYEdge

import edu.wpi.first.wpilibj.image.NIVision; //导入方法依赖的package包/类
/**
 * Computes a score based on the match between a template profile and the particle profile in the Y direction. This method uses the
 * the row averages and the profile defined at the top of the sample to look for the solid horizontal edges with
 * a hollow center
 * 
 * @param image The image to use, should be the image before the convex hull is performed
 * @param report The Particle Analysis Report for the particle
 * 
 * @return The Y Edge score (0-100)
 *
 */
public double scoreYEdge(BinaryImage image, ParticleAnalysisReport report) throws NIVisionException
{
    double total = 0;
    LinearAverages averages;

    NIVision.Rect rect = new NIVision.Rect(report.boundingRectTop, report.boundingRectLeft, report.boundingRectHeight, report.boundingRectWidth);
    averages = NIVision.getLinearAverages(image.image, LinearAverages.LinearAveragesMode.IMAQ_ROW_AVERAGES, rect);
    float rowAverages[] = averages.getRowAverages();
    for(int i=0; i < (rowAverages.length); i++){
        if(yMin[(i*(YMINSIZE-1)/rowAverages.length)] < rowAverages[i] 
                && rowAverages[i] < yMax[i*(YMAXSIZE-1)/rowAverages.length]){
            total++;
                }
    }
    total = 100*total/(rowAverages.length);
    return total;
}
 
开发者ID:grt192,项目名称:2013ultimate-ascent,代码行数:29,代码来源:GRTVisionTracker.java


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