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


Java UtilOpenKinect类代码示例

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


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

示例1: processRgb

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
protected void processRgb(FrameMode mode, ByteBuffer frame, int timestamp) {
  if (mode.getVideoFormat() != VideoFormat.RGB) {
    System.out.println("Bad rgb format!");
  }

  System.out.println("Got rgb!   " + timestamp);

  if (outRgb == null) {
    rgb.reshape(mode.getWidth(), mode.getHeight());
    outRgb = new BufferedImage(rgb.width, rgb.height, BufferedImage.TYPE_INT_RGB);
    guiRgb = ShowImages.showWindow(outRgb, "RGB Image");
  }

  UtilOpenKinect.bufferRgbToMsU8(frame, rgb);
  ConvertBufferedImage.convertTo_U8(rgb, outRgb, true);

  guiRgb.repaint();
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:19,代码来源:KinectStreamer.java

示例2: processRgb

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
protected void processRgb( FrameMode mode, ByteBuffer frame, int timestamp ) {
	if( mode.getVideoFormat() != VideoFormat.RGB ) {
		System.out.println("Bad rgb format!");
	}

	System.out.println("Got rgb! "+timestamp);

	if( outRgb == null ) {
		rgb.reshape(mode.getWidth(),mode.getHeight());
		outRgb = new BufferedImage(rgb.width,rgb.height,BufferedImage.TYPE_INT_RGB);
		guiRgb = ShowImages.showWindow(outRgb,"RGB Image");
	}

	UtilOpenKinect.bufferRgbToMsU8(frame, rgb);
	ConvertBufferedImage.convertTo_U8(rgb,outRgb);

	guiRgb.repaint();
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:OpenKinectStreamingTest.java

示例3: process

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
public void process() throws IOException {
	parseFrame(0);

	outRgb = new BufferedImage(rgb.getWidth(),rgb.getHeight(),BufferedImage.TYPE_INT_RGB);
	outDepth = new BufferedImage(depth.getWidth(),depth.getHeight(),BufferedImage.TYPE_INT_RGB);

	gui = new ImageGridPanel(1,2,outRgb,outDepth);
	ShowImages.showWindow(gui,"Kinect Data");

	int frame = 1;
	while( true ) {
		parseFrame(frame++);
		ConvertBufferedImage.convertTo_U8(rgb,outRgb);
		VisualizeImageData.disparity(depth, outDepth, 0, UtilOpenKinect.FREENECT_DEPTH_MM_MAX_VALUE, 0);
		gui.repaint();
		BoofMiscOps.pause(30);
	}
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:PlaybackKinectLogApp.java

示例4: processKinect

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
@Override
public void processKinect(MultiSpectral<ImageUInt8> rgb, ImageUInt16 depth, long timeRgb, long timeDepth) {
	System.out.println(frameNumber+"  "+timeRgb);
	try {
		logFile.write(String.format("%10d %d %d\n",frameNumber,timeRgb,timeDepth).getBytes());
		logFile.flush();
		UtilImageIO.savePPM(rgb, String.format("log/rgb%07d.ppm", frameNumber), buffer);
		UtilOpenKinect.saveDepth(depth, String.format("log/depth%07d.depth", frameNumber), buffer);
		frameNumber++;

		if( showImage ) {
			ConvertBufferedImage.convertTo_U8(rgb,buffRgb);
			gui.repaint();
		}
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:LogKinectDataApp.java

示例5: processDepth

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
protected void processDepth(FrameMode mode, ByteBuffer frame, int timestamp) {

	if (outDepth == null) {
		depth.reshape(mode.getWidth(), mode.getHeight());
		// in my case: width 640, height 480
		outDepth = new BufferedImage(depth.width, depth.height, BufferedImage.TYPE_INT_RGB);
		guiDepth = ShowImages.showWindow(outDepth, "Depth Image");
	}

	App.bufferDepthToU16(frame, depth);

	processButtonStatePhaseOne(buttonMove);
	processButtonStatePhaseOne(buttonStop);
	processButtonStatePhaseOne(buttonLeft);
	processButtonStatePhaseOne(buttonRight);

	VisualizeImageData.grayUnsigned(depth, outDepth, UtilOpenKinect.FREENECT_DEPTH_MM_MAX_VALUE);

	drawButton(buttonMove, outDepth);
	drawButton(buttonStop, outDepth);
	drawButton(buttonLeft, outDepth);
	drawButton(buttonRight, outDepth);

	processButtonStatePhaseTwo(buttonMove, outDepth);
	processButtonStatePhaseTwo(buttonStop, outDepth);
	processButtonStatePhaseTwo(buttonLeft, outDepth);
	processButtonStatePhaseTwo(buttonRight, outDepth);

	guiDepth.repaint();
}
 
开发者ID:IBM-Cloud,项目名称:controller-kinect-bluemix,代码行数:31,代码来源:App.java

示例6: processDepth

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
protected void processDepth(FrameMode mode, ByteBuffer frame, int timestamp) {
  System.out.println("Got depth! " + timestamp);

  if (outDepth == null) {
    depth.reshape(mode.getWidth(), mode.getHeight());
    outDepth = new BufferedImage(depth.width, depth.height, BufferedImage.TYPE_INT_RGB);
    guiDepth = ShowImages.showWindow(outDepth, "Depth Image");
  }

  UtilOpenKinect.bufferDepthToU16(frame, depth);

  // VisualizeImageData.grayUnsigned(depth,outDepth,UtilOpenKinect.FREENECT_DEPTH_MM_MAX_VALUE);
  VisualizeImageData.disparity(depth, outDepth, 0, UtilOpenKinect.FREENECT_DEPTH_MM_MAX_VALUE, 0);
  guiDepth.repaint();
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:16,代码来源:KinectStreamer.java

示例7: processKinect

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
@Override
public void processKinect(Planar<GrayU8> rgb, GrayU16 depth, long timeRgb, long timeDepth) {
  VisualizeImageData.disparity(depth, buffDepth, 0, UtilOpenKinect.FREENECT_DEPTH_MM_MAX_VALUE, 0);
  ConvertBufferedImage.convertTo_U8(rgb, buffRgb, true);

  Graphics2D g2 = buffRgb.createGraphics();
  float alpha = 0.5f;
  int type = AlphaComposite.SRC_OVER;
  AlphaComposite composite = AlphaComposite.getInstance(type, alpha);
  g2.setComposite(composite);
  g2.drawImage(buffDepth, 0, 0, null);

  gui.repaint();
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:15,代码来源:KinectRGBDepth.java

示例8: main

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
public static void main( String args[] ) throws IOException {
		String baseDir = "../data/evaluation/kinect/";

		String nameRgb = baseDir+"basket.ppm";
		String nameDepth = baseDir+"basket.depth";
		String nameCalib = baseDir+"intrinsic.xml";

		IntrinsicParameters param = BoofMiscOps.loadXML(nameCalib);

		ImageUInt16 depth = new ImageUInt16(1,1);
		MultiSpectral<ImageUInt8> rgb = new MultiSpectral<ImageUInt8>(ImageUInt8.class,1,1,3);

		UtilImageIO.loadPPM_U8(nameRgb, rgb, null);
		UtilOpenKinect.parseDepth(nameDepth,depth,null);

		FastQueue<Point3D_F64> cloud = new FastQueue<Point3D_F64>(Point3D_F64.class,true);
		FastQueueArray_I32 cloudColor = new FastQueueArray_I32(3);

		VisualDepthOps.depthTo3D(param, rgb, depth, cloud, cloudColor);

		DenseMatrix64F K = PerspectiveOps.calibrationMatrix(param,null);

		PointCloudViewer viewer = new PointCloudViewer(K,20);
		viewer.setPreferredSize(new Dimension(rgb.width,rgb.height));

		for( int i = 0; i < cloud.size; i++ ) {
			Point3D_F64 p = cloud.get(i);
			int[] color = cloudColor.get(i);
			int c = (color[0] << 16 ) | (color[1] << 8) | color[2];
			viewer.addPoint(p.x,p.y,p.z,c);
		}

		ShowImages.showWindow(viewer,"Point Cloud");
		System.out.println("Total points = "+cloud.size);

//		BufferedImage depthOut = VisualizeImageData.disparity(depth, null, 0, UtilOpenKinect.FREENECT_DEPTH_MM_MAX_VALUE, 0);
//		ShowImages.showWindow(depthOut,"Depth Image");
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:39,代码来源:DisplayKinectPointCloudApp.java

示例9: processDepth

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
protected void processDepth( FrameMode mode, ByteBuffer frame, int timestamp ) {
	System.out.println("Got depth! "+timestamp);

	if( outDepth == null ) {
		depth.reshape(mode.getWidth(),mode.getHeight());
		outDepth = new BufferedImage(depth.width,depth.height,BufferedImage.TYPE_INT_RGB);
		guiDepth = ShowImages.showWindow(outDepth,"Depth Image");
	}

	UtilOpenKinect.bufferDepthToU16(frame, depth);

	VisualizeImageData.grayUnsigned(depth,outDepth,1000);
	guiDepth.repaint();
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:15,代码来源:OpenKinectStreamingTest.java

示例10: parseFrame

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
private void parseFrame(int frameNumber ) throws IOException {
	UtilImageIO.loadPPM_U8(String.format("%s/rgb%07d.ppm", directory, frameNumber), rgb, data);
	if( depthIsPng ) {
		BufferedImage image = UtilImageIO.loadImage(String.format("%s/depth%07d.png", directory, frameNumber));
		ConvertBufferedImage.convertFrom(image,depth);
	} else {
		UtilOpenKinect.parseDepth(String.format("%s/depth%07d.depth", directory, frameNumber), depth, data);
	}

}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:11,代码来源:PlaybackKinectLogApp.java

示例11: processKinect

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
@Override
public void processKinect(MultiSpectral<ImageUInt8> rgb, ImageUInt16 depth, long timeRgb, long timeDepth) {
	VisualizeImageData.disparity(depth, buffDepth, 0, UtilOpenKinect.FREENECT_DEPTH_MM_MAX_VALUE,0);
	ConvertBufferedImage.convertTo_U8(rgb,buffRgb);

	Graphics2D g2 = buffRgb.createGraphics();
	float alpha = 0.5f;
	int type = AlphaComposite.SRC_OVER;
	AlphaComposite composite =
			AlphaComposite.getInstance(type, alpha);
	g2.setComposite(composite);
	g2.drawImage(buffDepth,0,0,null);

	gui.repaint();
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:16,代码来源:OverlayRgbDepthStreamsApp.java

示例12: main

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
public static void main( String args[] ) throws IOException {
	String baseDir = "log/";

	String nameRgb = baseDir+"rgb0000000.ppm";
	String nameDepth = baseDir+"depth0000000.depth";
	String nameCalib = baseDir+"intrinsic.xml";

	IntrinsicParameters param = BoofMiscOps.loadXML(nameCalib);

	ImageUInt16 depth = new ImageUInt16(1,1);
	MultiSpectral<ImageUInt8> rgb = new MultiSpectral<ImageUInt8>(ImageUInt8.class,1,1,3);

	UtilImageIO.loadPPM_U8(nameRgb, rgb, null);
	UtilOpenKinect.parseDepth(nameDepth,depth,null);

	FastQueue<Point3D_F64> cloud = new FastQueue<Point3D_F64>(Point3D_F64.class,true);
	FastQueueArray_I32 cloudColor = new FastQueueArray_I32(3);

	VisualDepthOps.depthTo3D(param, rgb, depth, cloud, cloudColor);

	DataOutputStream file = new DataOutputStream(new FileOutputStream("kinect_pointcloud.txt"));

	file.write("# Kinect RGB Point cloud. Units: millimeters. Format: X Y Z R G B\n".getBytes());

	for( int i = 0; i < cloud.size; i++ ) {
		Point3D_F64 p = cloud.get(i);
		int[] color = cloudColor.get(i);

		String line = String.format("%.10f %.10f %.10f %d %d %d\n",p.x,p.y,p.z,color[0],color[1],color[2]);
		file.write(line.getBytes());
	}
	file.close();

	System.out.println("Total points = "+cloud.size);
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:36,代码来源:CreateRgbPointCloudFileApp.java

示例13: process

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
public void process() throws IOException {

		logFile = new DataOutputStream(new FileOutputStream("log/timestamps.txt"));
		logFile.write("# Time stamps for rgb and depth cameras.\n".getBytes());

		int w = UtilOpenKinect.getWidth(resolution);
		int h = UtilOpenKinect.getHeight(resolution);

		buffRgb = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);

		if( showImage ) {
			gui = ShowImages.showWindow(buffRgb,"Kinect RGB");
		}

		StreamOpenKinectRgbDepth stream = new StreamOpenKinectRgbDepth();
		Context kinect = Freenect.createContext();

		if( kinect.numDevices() < 0 )
			throw new RuntimeException("No kinect found!");

		Device device = kinect.openDevice(0);

		stream.start(device,resolution,this);

		if( maxImages > 0 ) {
			while( frameNumber < maxImages ) {
				System.out.printf("Total saved %d\n",frameNumber);
				BoofMiscOps.pause(100);
			}
			stream.stop();
			System.out.println("Exceeded max images");
			System.exit(0);
		}
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:35,代码来源:LogKinectDataApp.java

示例14: process

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
public void process() {

    int w = UtilOpenKinect.getWidth(resolution);
    int h = UtilOpenKinect.getHeight(resolution);

    buffRgb = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    buffDepth = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);

    gui = ShowImages.showWindow(buffRgb, "Kinect Overlay");

    StreamOpenKinectRgbDepth stream = new StreamOpenKinectRgbDepth();
    Context kinect = Freenect.createContext();

    if (kinect.numDevices() < 0)
      throw new RuntimeException("No kinect found!");

    Device device = kinect.openDevice(0);
    stream.start(device, resolution, this);
  }
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:20,代码来源:KinectRGBDepth.java

示例15: process

import boofcv.openkinect.UtilOpenKinect; //导入依赖的package包/类
public void process() throws IOException {

		// make sure there is a "log" directory
		new File("log").mkdir();

		int w = UtilOpenKinect.getWidth(resolution);
		int h = UtilOpenKinect.getHeight(resolution);

		buffRgb = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);

		savedRgb = new MultiSpectral<ImageUInt8>(ImageUInt8.class,w,h,3);
		savedDepth = new ImageUInt16(w,h);

		gui = ShowImages.showWindow(buffRgb, "Kinect RGB");
		gui.addKeyListener(this);
		gui.requestFocus();

		StreamOpenKinectRgbDepth stream = new StreamOpenKinectRgbDepth();
		Context kinect = Freenect.createContext();

		if( kinect.numDevices() < 0 )
			throw new RuntimeException("No kinect found!");

		Device device = kinect.openDevice(0);

		stream.start(device,resolution,this);

		long targetTime = System.currentTimeMillis() + period;
		updateDisplay = true;
		while( true ) {
			BoofMiscOps.pause(100);

			if( targetTime < System.currentTimeMillis() ) {
				userChoice = -1;
				savedImages = false;
				updateDisplay = false;
				while( true ) {
					if( savedImages && userChoice != -1 ) {
						if( userChoice == 1 ) {
							UtilImageIO.savePPM(savedRgb, String.format(directory + "rgb%07d.ppm", frameNumber), buffer);
							UtilOpenKinect.saveDepth(savedDepth, String.format(directory + "depth%07d.depth", frameNumber), buffer);
							frameNumber++;
							text = "Image Saved!";
						} else {
							text = "Image Discarded!";
						}
						timeText = System.currentTimeMillis()+500;
						updateDisplay = true;
						targetTime = System.currentTimeMillis()+period;
						break;
					}
					BoofMiscOps.pause(50);
				}
			}
		}
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:57,代码来源:CaptureCalibrationImagesApp.java


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