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


Java NIVision类代码示例

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


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

示例1: operate

import com.ni.vision.NIVision; //导入依赖的package包/类
@Override
public Image operate (Image Source)
{
    Image returnImage = null;
    Image input = Source;
    for (int i = 0; i < this.iterations; i++)
        {
        Image out = NIVision
                .imaqCreateImage(ImageType.IMAGE_U8, 0);
        NIVision.imaqGrayMorphology(out, input,
                NIVision.MorphologyMethod.DILATE,
                new NIVision.StructuringElement());
        Source.free();
        returnImage = out;
        input = out;
        }
    return (returnImage);
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:19,代码来源:DilateOperator.java

示例2: operate

import com.ni.vision.NIVision; //导入依赖的package包/类
public Image operate (Image Source)
{
    // If we have criteria, then use the filter. If not, just return the
    // original image.
    if (allCriteria.length > 0)
        {
        Image out = NIVision
                .imaqCreateImage(ImageType.IMAGE_U8, 0);
        NIVision.imaqParticleFilter4(out, Source, allCriteria,
                new ParticleFilterOptions2(0, 0, 0, 0), null);
        Source.free();
        return out;
        }

    return Source;
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:17,代码来源:ParticleFilter.java

示例3: operate

import com.ni.vision.NIVision; //导入依赖的package包/类
@Override
public Image operate (Image Source)
{
    final Image hulledImage = NIVision
            .imaqCreateImage(ImageType.IMAGE_U8, 0);
    if (this.useConnectivity8 == true)
        {
        NIVision.imaqConvexHull(hulledImage, Source, 0);
        }
    else
        {
        NIVision.imaqConvexHull(hulledImage, Source, 1);
        }
    Source.free();
    return hulledImage;
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:17,代码来源:ConvexHullOperator.java

示例4: operate

import com.ni.vision.NIVision; //导入依赖的package包/类
@Override
public Image operate (Image source)
{
    Image alteredImage = null;
    if (this.connectivity8 == true)
        {
        NIVision.imaqSizeFilter(alteredImage, source, 0, this.erosions,
                NIVision.SizeType.KEEP_SMALL,
                new NIVision.StructuringElement(
                        3, 3, 0));
        }
    else
        {
        NIVision.imaqSizeFilter(alteredImage, source, 1, this.erosions,
                NIVision.SizeType.KEEP_SMALL,
                new NIVision.StructuringElement(
                        3, 3, 0));
        }
    source.free();
    return alteredImage;
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:22,代码来源:RemoveLargeObjectsOperator.java

示例5: setImageData

import com.ni.vision.NIVision; //导入依赖的package包/类
private synchronized void setImageData(RawData data, int start) {
//flip it here, since it is called by setImage anyways
if(flipped){
	//make an image out of data
	Image image = null;
	NIVision.imaqUnflatten(image, data, data.getBuffer().array().length);
	//flip it
	Image flippedImage = null;
	NIVision.imaqFlip(flippedImage, image, FlipAxis.HORIZONTAL_AXIS);
	//change data to the data of the flipped image
	data = NIVision.imaqFlatten(flippedImage, NIVision.FlattenType.FLATTEN_IMAGE,
            NIVision.CompressionType.COMPRESSION_JPEG, 10 * m_quality);
}
if (m_imageData != null && m_imageData.data != null) {
     m_imageData.data.free();
     if (m_imageData.data.getBuffer() != null){
       m_imageDataPool.addLast(m_imageData.data.getBuffer());
     }
     m_imageData = null;
   }
   m_imageData = new CameraData(data, start);
   notifyAll();
 }
 
开发者ID:FRC2832,项目名称:Robot_2016,代码行数:24,代码来源:CameraServer2832.java

示例6: operate

import com.ni.vision.NIVision; //导入依赖的package包/类
@Override
public Image operate (Image Source)
    {
    if (this.connectivity8 == true)
        {
        NIVision.imaqSizeFilter(Source, Source, 0, this.erosions,
            NIVision.SizeType.KEEP_SMALL, new NIVision.StructuringElement(
                3, 3, 0));
        }
    else
        {
        NIVision.imaqSizeFilter(Source, Source, 1, this.erosions,
            NIVision.SizeType.KEEP_SMALL, new NIVision.StructuringElement(
                3, 3, 0));
        }
    return Source;
    }
 
开发者ID:FIRST-Team-339,项目名称:2016,代码行数:18,代码来源:RemoveLargeObjectsOperator.java

示例7: switchDirection

import com.ni.vision.NIVision; //导入依赖的package包/类
public static void switchDirection() {
	switch (lastSelected) {
	case "Front View":
		NIVision.IMAQdxStopAcquisition(currSession);
		currSession = sessionback;
		NIVision.IMAQdxConfigureGrab(currSession);
		Robot.drivetrain.ReverseDrive();
		lastSelected = "Back View";
		break;
	default:
	case "Back View":
		NIVision.IMAQdxStopAcquisition(currSession);
		currSession = sessionfront;
		NIVision.IMAQdxConfigureGrab(currSession);
		Robot.drivetrain.ForwardDrive();
		lastSelected = "Front View";
		break;
	case "Manual Change":
		break;
	}
}
 
开发者ID:frc3946,项目名称:Stronghold,代码行数:22,代码来源:Robot.java

示例8: operatorControl

import com.ni.vision.NIVision; //导入依赖的package包/类
public void operatorControl() {
    NIVision.IMAQdxStartAcquisition(session);

    /**
     * grab an image, draw the circle, and provide it for the camera server
     * which will in turn send it to the dashboard.
     */
    NIVision.Rect rect = new NIVision.Rect(10, 10, 100, 100);

    while (isOperatorControl() && isEnabled()) {

        NIVision.IMAQdxGrab(session, frame, 1);
        NIVision.imaqDrawShapeOnImage(frame, frame, rect,
                DrawMode.DRAW_VALUE, ShapeMode.SHAPE_OVAL, 0.0f);
        
        CameraServer.getInstance().setImage(frame);

        /** robot code here! **/
        Timer.delay(0.005);		// wait for a motor update time
    }
    NIVision.IMAQdxStopAcquisition(session);
}
 
开发者ID:wjaneal,项目名称:liastem,代码行数:23,代码来源:Robot.java

示例9: openCamera

import com.ni.vision.NIVision; //导入依赖的package包/类
public synchronized void openCamera() {
  if (m_id != -1)
    return; // Camera is already open
  for (int i = 0; i < 3; i++) {
    try {
      m_id =
          NIVision.IMAQdxOpenCamera(m_name,
              NIVision.IMAQdxCameraControlMode.CameraControlModeController);
    } catch (VisionException e) {
      if (i == 2)
        throw e;
      delay(2.0);
      continue;
    }
    break;
  }
}
 
开发者ID:trc492,项目名称:Frc2016FirstStronghold,代码行数:18,代码来源:USBCamera.java

示例10: display

import com.ni.vision.NIVision; //导入依赖的package包/类
public void display() {
	NIVision.IMAQdxStartAcquisition(session);

    /**
     * grab an image, draw the circle, and provide it for the camera server
     * which will in turn send it to the dashboard.
     */
    NIVision.Rect rect = new NIVision.Rect(10, 10, 100, 100);

    //while (teleop && enabled) {
    while(enabled) {
        NIVision.IMAQdxGrab(session, frame, 1);
        NIVision.imaqDrawShapeOnImage(frame, frame, rect,
                DrawMode.DRAW_VALUE, ShapeMode.SHAPE_OVAL, 0.0f);
        
        CameraServer.getInstance().setImage(frame);

        /** robot code here! **/
        Timer.delay(0.005);		// wait for a motor update time
    }
    NIVision.IMAQdxStopAcquisition(session);
}
 
开发者ID:FRC-Team-3140,项目名称:FRC-2016,代码行数:23,代码来源:DriveCam.java

示例11: toggle

import com.ni.vision.NIVision; //导入依赖的package包/类
public void toggle(){
	if(currentSession == sessionBack){
		NIVision.IMAQdxStopAcquisition(sessionBack);
		NIVision.IMAQdxCloseCamera(sessionBack);
		sessionFront = NIVision.IMAQdxOpenCamera(RobotMap.FRONT_CAMERA, IMAQdxCameraControlMode.CameraControlModeController);
		NIVision.IMAQdxConfigureGrab(sessionFront);
		NIVision.IMAQdxStartAcquisition(sessionFront);
		currentSession = sessionFront;	
	}else if(currentSession == sessionFront){
		NIVision.IMAQdxStopAcquisition(sessionFront);
		NIVision.IMAQdxCloseCamera(sessionFront);
		sessionBack = NIVision.IMAQdxOpenCamera(RobotMap.BACK_CAMERA, IMAQdxCameraControlMode.CameraControlModeController);
		NIVision.IMAQdxConfigureGrab(sessionBack);
		NIVision.IMAQdxStartAcquisition(sessionBack);
		currentSession = sessionBack;
	}	
}
 
开发者ID:FRC4131,项目名称:FRCStronghold2016,代码行数:18,代码来源:Cameras.java

示例12: updateParticalAnalysisReports

import com.ni.vision.NIVision; //导入依赖的package包/类
/**
 * Takes the processed image and writes information on each particle (blob) into
 * the global <reports> array, in order of overall particle area.
 */
public void updateParticalAnalysisReports ()
{
    if (this.camera.gethaveCamera() == true
            && this.currentImage != null)
        {
        final int numParticles = NIVision
                .imaqCountParticles(this.currentImage, 0);

        // Measure particles and sort by particle size
        final Vector<ParticleReport> particles = new Vector<ParticleReport>();

        if (numParticles > 0)
            {

            for (int particleIndex = 0; particleIndex < numParticles; particleIndex++)
                {

                final ParticleReport particle = new ParticleReport();
                particle.PercentAreaToImageArea = NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_AREA_BY_IMAGE_AREA);
                particle.area = NIVision.imaqMeasureParticle(
                        this.currentImage,
                        particleIndex, 0,
                        NIVision.MeasurementType.MT_AREA);
                particle.ConvexHullArea = NIVision
                        .imaqMeasureParticle(
                                this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_CONVEX_HULL_AREA);
                particle.boundingRectTop = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_TOP);
                particle.boundingRectLeft = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_LEFT);
                particle.boundingRectBottom = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_BOTTOM);
                particle.boundingRectRight = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_RIGHT);
                particle.boundingRectWidth = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_WIDTH);// par.boundingRectRight
                // -
                // par.boundingRectLeft;
                particle.center_mass_x = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_CENTER_OF_MASS_X);
                particle.center_mass_y = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_CENTER_OF_MASS_Y);
                particle.imageWidth = NIVision
                        .imaqGetImageSize(this.currentImage).width;
                particles.add(particle);
                }
            particles.sort(null);

            }
        this.reports = new ParticleReport[particles.size()];
        particles.copyInto(this.reports);
        particles.clear();
        }
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:78,代码来源:ImageProcessor.java

示例13: operate

import com.ni.vision.NIVision; //导入依赖的package包/类
@Override
public Image operate (Image Source)
{
    final Image largeObjectsImage = NIVision
            .imaqCreateImage(ImageType.IMAGE_U8, 0);
    try
        {
        if (this.connectivity8 == true)
            {
            // final Image newImage =
            // NIVision.imaqCreateImage(ImageType.IMAGE_U8, 1);
            // NIVision.imaqDuplicate(newImage, Source);
            NIVision.imaqSetBorderSize(Source, 1);

            NIVision.imaqSizeFilter(largeObjectsImage, Source, 1,
                    this.erosions,
                    NIVision.SizeType.KEEP_LARGE, null);// @AHK F**K it
                                                        // adjustment
            // new NIVision.StructuringElement(3, 3, 0));
            // Source.free();
            // return newImage;
            }
        else
            {
            NIVision.imaqSizeFilter(largeObjectsImage, Source, 0,
                    this.erosions,
                    NIVision.SizeType.KEEP_LARGE, null
            /* new NIVision.StructuringElement(3, 3, 0) */);
            System.out.println("Other. Working???");
            }
        }

    catch (final Exception ex)
        {
        ex.printStackTrace();
        }
    Source.free();
    return largeObjectsImage;
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:40,代码来源:RemoveSmallObjectsOperator.java

示例14: operate

import com.ni.vision.NIVision; //导入依赖的package包/类
@Override
public Image operate (Image Source)
    {
        NIVision.imaqWriteJPEGFile(Source, this.fileName, 1000, null);
    System.out.println("Printed Image to: " + this.fileName);
    return Source;
    }
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:8,代码来源:SaveColorImageJPEGOperator.java

示例15: operate

import com.ni.vision.NIVision; //导入依赖的package包/类
@Override
public Image operate (Image Source)
    {
    // @TODO We may have to create the image instead of using the source.
    NIVision.imaqReadFile(Source, this.fileName);
    System.out.println("Loaded Image from: " + this.fileName);
    return Source;
    }
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:9,代码来源:LoadColorImageJPEGOperator.java


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