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


Java NIVision.imaqCreateImage方法代码示例

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


在下文中一共展示了NIVision.imaqCreateImage方法的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)
{
    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

示例5: operate

import com.ni.vision.NIVision; //导入方法依赖的package包/类
@Override
public Image operate (Image source)
{
    // Creating new monocolor image with no border
    Image thresholdImage = NIVision
            .imaqCreateImage(ImageType.IMAGE_U8, 0);

    // @TODO: Store NIVision.Range instead of integers so we don't make a
    // new one every time.
    NIVision.imaqColorThreshold(thresholdImage, source, 255,
            NIVision.ColorMode.HSL, this.hueRange, this.satRange,
            this.lumRange);
    source.free();
    return (thresholdImage);
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:16,代码来源:HSLColorThresholdOperator.java

示例6: capture

import com.ni.vision.NIVision; //导入方法依赖的package包/类
protected void capture() {
  Image frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
  while (true) {
    boolean hwClient;
    ByteBuffer dataBuffer = null;
    synchronized (this) {
      hwClient = m_hwClient;
      if (hwClient) {
        dataBuffer = m_imageDataPool.removeLast();
      }
    }

    try {
      if (hwClient && dataBuffer != null) {
        // Reset the image buffer limit
        dataBuffer.limit(dataBuffer.capacity() - 1);
        m_camera[selectedCamera].getImageData(dataBuffer);
        setImageData(new RawData(dataBuffer), 0);
      } else {
        m_camera[selectedCamera].getImage(frame);
        setImage(frame);
      }
    } catch (VisionException ex) {
      //DriverStation.reportError("Error when getting image from the camera: " + ex.getMessage(),true);
      if (dataBuffer != null) {
        synchronized (this) {
          m_imageDataPool.addLast(dataBuffer);
          Timer.delay(.1);
        }
      }
    }
  }
}
 
开发者ID:FRC2832,项目名称:Robot_2016,代码行数:34,代码来源:CameraServer2832.java

示例7: capture

import com.ni.vision.NIVision; //导入方法依赖的package包/类
protected void capture() {
  Image frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
  while (true) {
    boolean hwClient;
    ByteBuffer dataBuffer = null;
    synchronized (this) {
      hwClient = m_hwClient;
      if (hwClient) {
        dataBuffer = m_imageDataPool.removeLast();
      }
    }

    try {
      if (hwClient && dataBuffer != null) {
        // Reset the image buffer limit
        dataBuffer.limit(dataBuffer.capacity() - 1);
        m_camera.getImageData(dataBuffer);
        setImageData(new RawData(dataBuffer), 0);
      } else {
        m_camera.getImage(frame);
        setImage(frame);
      }
    } catch (VisionException ex) {
      DriverStation.reportError("Error when getting image from the camera: " + ex.getMessage(),
          true);
      if (dataBuffer != null) {
        synchronized (this) {
          m_imageDataPool.addLast(dataBuffer);
          Timer.delay(.1);
        }
      }
    }
  }
}
 
开发者ID:MontclairRobotics,项目名称:Sprocket,代码行数:35,代码来源:CameraServers.java

示例8: operate

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

示例9: 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();
            System.out.println("Good. Working???");
            // 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,项目名称:2016,代码行数:41,代码来源:RemoveSmallObjectsOperator.java

示例10: operate

import com.ni.vision.NIVision; //导入方法依赖的package包/类
@Override
public Image operate (Image source)
{
    // Creating new monocolor image with no border
    final Image thresholdImage = NIVision
            .imaqCreateImage(ImageType.IMAGE_U8, 0);

    // @TODO: Store NIVision.Range instead of integers so we don't make a
    // new one every time.
    NIVision.imaqColorThreshold(thresholdImage, source, 255,
            NIVision.ColorMode.HSL, this.hueRange, this.satRange,
            this.lumRange);
    source.free();
    return thresholdImage;
}
 
开发者ID:FIRST-Team-339,项目名称:2016,代码行数:16,代码来源:HSLColorThresholdOperator.java

示例11: robotInit

import com.ni.vision.NIVision; //导入方法依赖的package包/类
public void robotInit() {

        frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);

        // the camera name (ex "cam0") can be found through the roborio web interface
        session = NIVision.IMAQdxOpenCamera("cam0",
                NIVision.IMAQdxCameraControlMode.CameraControlModeController);
        NIVision.IMAQdxConfigureGrab(session);
    }
 
开发者ID:wjaneal,项目名称:liastem,代码行数:10,代码来源:Robot.java

示例12: FrcVision

import com.ni.vision.NIVision; //导入方法依赖的package包/类
public FrcVision(
        ImageProvider camera,
        ImageType imageType,
        ColorMode colorMode,
        Range[] colorThresholds,
        boolean doConvexHull,
        ParticleFilterCriteria2[] filterCriteria,
        ParticleFilterOptions2 filterOptions)
{
    if (debugEnabled)
    {
        dbgTrace = new TrcDbgTrace(
                moduleName,
                false,
                TrcDbgTrace.TraceLevel.API,
                TrcDbgTrace.MsgLevel.INFO);
    }

    this.camera = camera;
    this.colorMode = colorMode;
    this.colorThresholds = colorThresholds;
    this.doConvexHull = doConvexHull;
    this.filterCriteria = filterCriteria;
    this.filterOptions = filterOptions;
    if (colorThresholds.length != 3)
    {
        throw new IllegalArgumentException(
                "Color threshold array must have 3 elements.");
    }

    binaryImage = NIVision.imaqCreateImage(ImageType.IMAGE_U8, 0);

    monitor = new Object();
    visionThread = new Thread(this, "VisionTask");
    visionThread.start();
}
 
开发者ID:trc492,项目名称:Frc2016FirstStronghold,代码行数:37,代码来源:FrcVision.java

示例13: CameraController

import com.ni.vision.NIVision; //导入方法依赖的package包/类
public CameraController(final int quality) {
	setQuality(quality);
	frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
	//bowCam = new USBCamera("cam0");
	//sternCam = new USBCamera("cam1");
	stream();
}
 
开发者ID:FRC-Team-3140,项目名称:FRC-2016,代码行数:8,代码来源:CameraController.java

示例14: Cameras

import com.ni.vision.NIVision; //导入方法依赖的package包/类
public Cameras() {
	server = CameraServer.getInstance();
	frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
	sessionFront = NIVision.IMAQdxOpenCamera(RobotMap.FRONT_CAMERA,
			NIVision.IMAQdxCameraControlMode.CameraControlModeController);
	NIVision.IMAQdxConfigureGrab(sessionFront);
	currentSession = sessionFront;
	sessionSet = true;
	
}
 
开发者ID:FRC4131,项目名称:FRCStronghold2016,代码行数:11,代码来源:Cameras.java

示例15: robotInit

import com.ni.vision.NIVision; //导入方法依赖的package包/类
/**
	 * This function is run when the robot is first started up and should be
	 * used for any initialization code.
	 */
	public void robotInit() {
		oi = new OI();
		driveTrainEncoder.initEncoders();
		// autonomous chooser
		chooser = new SendableChooser();
		chooser.addDefault("Position One", "Position One");
		chooser.addObject("Position Two", "Position Two");
		chooser.addObject("Position Three", "Position Three");
		chooser.addObject("Position Four", "Position Four");
		chooser.addObject("Position Five", "Position Five");
		chooser.addObject("Do Nothing", "Do Nothing");
		SmartDashboard.putData("Auto mode", chooser);
		SmartDashboard.putData("LoadPrefNames", new LoadPrefNames());
		// camera chooser
		cameraSelector = new SendableChooser();
		cameraSelector.addDefault("Front View", "Front View");
		cameraSelector.addObject("Back View", "Back View");
		cameraSelector.addObject("Manual Change", "Manual Change");
		SmartDashboard.putData("Camera Selector", cameraSelector);
		
		
		
		try {
			frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
//			sessionfront = NIVision.IMAQdxOpenCamera("cam3",
//					NIVision.IMAQdxCameraControlMode.CameraControlModeController);
			sessionfront = NIVision.IMAQdxOpenCamera("cam0",
					NIVision.IMAQdxCameraControlMode.CameraControlModeController);
			sessionback = NIVision.IMAQdxOpenCamera("cam2",
					NIVision.IMAQdxCameraControlMode.CameraControlModeController);
			currSession = sessionback;
			NIVision.IMAQdxConfigureGrab(currSession);
		} catch (VisionException v) {
			//do nothing
		} catch (Exception e) {
			
		}
		// drivetrain chooser
		drivetrainSelector = new SendableChooser();
		drivetrainSelector.addDefault("Tank Drive", "Tank Drive");
		drivetrainSelector.addObject("Arcade Drive", "Arcade Drive");
		SmartDashboard.putData("Drivetrain Selector", drivetrainSelector);
		// preferences
		prefs = Preferences.getInstance();
		distanceTarget = prefs.getDouble("DistanceTarget", distanceTarget);
		distanceOffset = prefs.getDouble("DistanceOffset", distanceOffset);
		angleMultiplier = prefs.getDouble("AngleMultipler", angleMultiplier);
		angleAddition = prefs.getDouble("AngleAddition", angleAddition);
		distanceMultiplier = prefs.getDouble("DistanceMultipler",
				distanceMultiplier);
		distanceAddition = prefs
				.getDouble("DistanceAddition", distanceAddition);
		leftInches = prefs.getDouble("lWheelInches", leftInches);
		rightInches = prefs.getDouble("fRightInches", rightInches);
		leftTicks = prefs.getDouble("lWheelTicks", leftTicks);
		rightTicks = prefs.getDouble("rWheelTicks", rightTicks);
		// add sensors
		LiveWindow.addSensor("Sensors", "Gyro", gyro);
	}
 
开发者ID:frc3946,项目名称:Stronghold,代码行数:64,代码来源:Robot.java


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