• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConvertBufferedImage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: processKinect

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
@Override
public void processKinect(MultiSpectral<ImageUInt8> rgb, ImageUInt16 depth, long timeRgb, long timeDepth) {

	if( updateDisplay ) {
		ConvertBufferedImage.convertTo_U8(rgb,buffRgb);

		if( timeText >= System.currentTimeMillis() ) {
			Graphics2D g2 = buffRgb.createGraphics();
			g2.setFont(new Font(Font.MONOSPACED, Font.BOLD, 30));
			g2.setColor(Color.RED);
			g2.drawString(text,rgb.width/2-100,rgb.height/2);
		}

		gui.repaint();
	} else if( !savedImages ) {
		savedRgb.setTo(rgb);
		savedDepth.setTo(depth);
		savedImages = true;
	}
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:21,代码来源:CaptureCalibrationImagesApp.java


示例2: processRgb

import boofcv.core.image.ConvertBufferedImage; //导入依赖的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.core.image.ConvertBufferedImage; //导入依赖的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.core.image.ConvertBufferedImage; //导入依赖的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: next

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
@Override
public T next() {
	if (reducedImage != null) {
		Graphics2D g2 = reducedImage.createGraphics();

		g2.scale(1.0 / factor, 1.0 / factor);
		g2.drawImage(bufferedImage, 0, 0, null);

		imageGUI = reducedImage;
	} else {
		imageGUI = bufferedImage;
	}

	image.reshape(imageGUI.getWidth(),imageGUI.getHeight());
	ConvertBufferedImage.convertFrom(imageGUI, image);
	return image;
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:18,代码来源:XugglerSimplified.java


示例6: extractFeaturesInternal

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
 * Detects key points inside the image and computes descriptions at those points.
 */
protected double[][] extractFeaturesInternal(BufferedImage image) {
	ImageFloat32 boofcvImage = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class);
	// create the SIFT detector and descriptor in BoofCV v0.15
	ConfigSiftDetector conf = new ConfigSiftDetector(2, detectThreshold, maxFeaturesPerScale, 5);
	DetectDescribePoint<ImageFloat32, SurfFeature> sift = FactoryDetectDescribe.sift(null, conf, null,
			null);

	// specify the image to process
	sift.detect(boofcvImage);
	int numPoints = sift.getNumberOfFeatures();
	double[][] descriptions = new double[numPoints][SIFTLength];
	for (int i = 0; i < numPoints; i++) {
		descriptions[i] = sift.getDescription(i).getValue();
	}
	return descriptions;
}
 
开发者ID:MKLab-ITI,项目名称:multimedia-indexing,代码行数:20,代码来源:SIFTExtractor.java


示例7: setActiveAlgorithm

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
@Override
	public void setActiveAlgorithm(int indexFamily, String name, Object cookie) {
		if( color == null || 0 == panel.getWidth() || 0 == panel.getHeight() ) {
			return;
		}

		InterpolatePixel<T> interp = (InterpolatePixel<T>)cookie;

		scaledImage.reshape(panel.getWidth(),panel.getHeight());
		PixelTransformAffine_F32 model = DistortSupport.transformScale(scaledImage,color);
		for( int i = 0; i < color.getNumBands(); i++ )
			DistortImageOps.distortSingle(color.getBand(i),scaledImage.getBand(i),model,null,interp);

		// numerical round off error can cause the interpolation to go outside
		// of pixel value bounds
//		GeneralizedImageOps.boundImage(scaledImage,0,255);

		BufferedImage out = ConvertBufferedImage.convertTo(scaledImage,null);
		panel.setBufferedImage(out);
		panel.repaint();
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:22,代码来源:EvaluateInterpolateEnlargeApp.java


示例8: addUndistorted

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
private void addUndistorted(final String name, final PointTransform_F32 model) {
	// Set up image distort
	InterpolatePixel<ImageFloat32> interp = FactoryInterpolation.bilinearPixel(ImageFloat32.class);
	ImageDistort<ImageFloat32> undistorter = FactoryDistort.distort(interp, null, ImageFloat32.class);
	undistorter.setModel(new PointToPixelTransform_F32(model));

	// Fill the image with all black then render it
	GImageMiscOps.fill(undist, 0);
	DistortImageOps.distortMS(dist, undist, undistorter);

	final BufferedImage out = ConvertBufferedImage.convertTo(undist,null);

	// Add this rectified image
	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			gui.addItem(new ImagePanel(out), name);
		}});
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:RemoveLensDistortionApp.java


示例9: detectLineSegments

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
 * Detects segments inside the image
 *
 * @param image Input image.
 * @param imageType Type of image processed by line detector.
 * @param derivType Type of image derivative.
 */
public static<T extends ImageSingleBand, D extends ImageSingleBand>
void detectLineSegments( BufferedImage image ,
						 Class<T> imageType ,
						 Class<D> derivType )
{
	// convert the line into a single band image
	T input = ConvertBufferedImage.convertFromSingle(image, null, imageType );

	// Comment/uncomment to try a different type of line detector
	DetectLineSegmentsGridRansac<T,D> detector = FactoryDetectLineAlgs.lineRansac(40, 30, 2.36, true, imageType, derivType);

	List<LineSegment2D_F32> found = detector.detect(input);

	// display the results
	ImageLinePanel gui = new ImageLinePanel();
	gui.setBackground(image);
	gui.setLineSegments(found);
	gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight()));

	ShowImages.showWindow(gui,"Found Line Segments");
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:29,代码来源:ExampleLineDetection.java


示例10: independent

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
 * Many operations designed to only work on {@link boofcv.struct.image.ImageSingleBand} can be applied
 * to a MultiSpectral image by feeding in each band one at a time.
 */
public static void independent( BufferedImage input ) {
	// convert the BufferedImage into a MultiSpectral
	MultiSpectral<ImageUInt8> image = ConvertBufferedImage.convertFromMulti(input,null,ImageUInt8.class);

	// declare the output blurred image
	MultiSpectral<ImageUInt8> blurred =
			new MultiSpectral<ImageUInt8>(ImageUInt8.class,image.width,image.height,image.getNumBands());
	
	// Apply Gaussian blur to each band in the image
	for( int i = 0; i < image.getNumBands(); i++ ) {
		// note that the generalized version of BlurImageOps is not being used, but the type
		// specific version.
		BlurImageOps.gaussian(image.getBand(i),blurred.getBand(i),-1,5,null);
	}
	
	// Declare the BufferedImage manually to ensure that the color bands have the same ordering on input
	// and output
	BufferedImage output = new BufferedImage(image.width,image.height,input.getType());
	ConvertBufferedImage.convertTo(blurred, output);
	ShowImages.showWindow(input,"Input");
	ShowImages.showWindow(output,"Ouput");
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:27,代码来源:ExampleMultiSpectralImages.java


示例11: convertBufferedToRGB

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
 * BufferedImage support many different image formats internally.  More often than not the order
 * of its bands are not RGB, which can cause problems when you expect it to be RGB.  A function
 * is provided that will swap the bands of a MultiSpectral image created from a BufferedImage
 * to ensure that it is in RGB ordering.
 */
public static void convertBufferedToRGB( BufferedImage input ) {

	// convert the BufferedImage into a MultiSpectral
	MultiSpectral<ImageUInt8> image = ConvertBufferedImage.convertFromMulti(input,null,ImageUInt8.class);

	int x=15,y=15;
	
	// print the value of "red" at a pixel to make it easy to see the change
	System.out.print("before: ");
	for( int i = 0; i < image.getNumBands(); i++ )
		System.out.print(image.getBand(i).get(x,y)+" ");
	System.out.println();
	
	// change the bands
	ConvertBufferedImage.orderBandsIntoRGB(image,input);

	// THe value of red should be different of the BufferedImage was not in RGB format.
	System.out.print("After:  ");
	for( int i = 0; i < image.getNumBands(); i++ )
		System.out.print(image.getBand(i).get(x,y)+" ");
	System.out.println();
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:29,代码来源:ExampleMultiSpectralImages.java


示例12: pixelAccess

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
 * Values of pixels can be read and modified by accessing the internal {@link boofcv.struct.image.ImageSingleBand}.
 */
public static void pixelAccess(  BufferedImage input ) {
	// convert the BufferedImage into a MultiSpectral
	MultiSpectral<ImageUInt8> image = ConvertBufferedImage.convertFromMulti(input,null,ImageUInt8.class);

	int x = 10, y = 10;

	// to access a pixel you first access the gray image for the each band
	for( int i = 0; i < image.getNumBands(); i++ )
		System.out.println("Original "+i+" = "+image.getBand(i).get(x,y));

	// change the value in each band
	for( int i = 0; i < image.getNumBands(); i++ )
		image.getBand(i).set(x, y, 100 + i);

	// to access a pixel you first access the gray image for the each band
	for( int i = 0; i < image.getNumBands(); i++ )
		System.out.println("Result   "+i+" = "+image.getBand(i).get(x,y));
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:22,代码来源:ExampleMultiSpectralImages.java


示例13: convertToGray

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
 * There is no real perfect way that everyone agrees on for converting color images into gray scale
 * images.  Two examples of how to convert a MultiSpectral image into a gray scale image are shown 
 * in this example.
 */
public static void convertToGray( BufferedImage input ) {
	// convert the BufferedImage into a MultiSpectral
	MultiSpectral<ImageUInt8> image = ConvertBufferedImage.convertFromMulti(input,null,ImageUInt8.class);
	
	ImageUInt8 gray = new ImageUInt8( image.width,image.height);
	
	// creates a gray scale image by averaging intensity value across pixels
	GPixelMath.averageBand(image, gray);
	BufferedImage outputAve = ConvertBufferedImage.convertTo(gray,null);

	// create an output image just from the first band
	BufferedImage outputBand0 = ConvertBufferedImage.convertTo(image.getBand(0),null);

	ShowImages.showWindow(outputAve,"Average");
	ShowImages.showWindow(outputBand0,"Band 0");
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:22,代码来源:ExampleMultiSpectralImages.java


示例14: process

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
 * Updates and displays the pyramid.
 */
public void process( BufferedImage image ) {
	T input = ConvertBufferedImage.convertFromSingle(image, null, imageType);
	pyramid.process(input);

	ImagePyramidPanel<T> gui = new ImagePyramidPanel<T>();
	gui.set(pyramid, true);
	gui.render();

	ShowImages.showWindow(gui,"Image Pyramid Float");

	// To get an image at any of the scales simply call this get function
	T imageAtScale = pyramid.getLayer(1);

	ShowImages.showWindow(ConvertBufferedImage.convertTo(imageAtScale,null),"Image at layer 1");
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:ExamplePyramidFloat.java


示例15: sharpen

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
	 * When an image is sharpened the intensity of edges are made more extreme while flat regions remain unchanged.
	 */
	public static void sharpen() {
//		BufferedImage buffered = UtilImageIO.loadImage("../data/applet/enhance/dull.jpg");
		BufferedImage buffered = UtilImageIO.loadImage("../data/applet/enhance/dark.jpg");
		ImageUInt8 gray = ConvertBufferedImage.convertFrom(buffered,(ImageUInt8)null);
		ImageUInt8 adjusted = new ImageUInt8(gray.width, gray.height);


		ListDisplayPanel panel = new ListDisplayPanel();

		EnhanceImageOps.sharpen4(gray, adjusted);
		panel.addImage(ConvertBufferedImage.convertTo(adjusted,null),"Sharpen-4");

		EnhanceImageOps.sharpen8(gray, adjusted);
		panel.addImage(ConvertBufferedImage.convertTo(adjusted,null),"Sharpen-8");

		panel.addImage(ConvertBufferedImage.convertTo(gray,null),"Original");

		panel.setPreferredSize(new Dimension(gray.width,gray.height));
		ShowImages.showWindow(panel,"Sharpen");
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:24,代码来源:ExampleImageEnhancement.java


示例16: process

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
 * Updates and displays the pyramid.
 */
public void process( BufferedImage image ) {
	T input = ConvertBufferedImage.convertFromSingle(image, null, imageType);
	pyramid.process(input);

	DiscretePyramidPanel gui = new DiscretePyramidPanel();
	gui.setPyramid(pyramid);
	gui.render();

	ShowImages.showWindow(gui,"Image Pyramid");

	// To get an image at any of the scales simply call this get function
	T imageAtScale = pyramid.getLayer(1);

	ShowImages.showWindow(ConvertBufferedImage.convertTo(imageAtScale,null),"Image at layer 1");
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:ExamplePyramidDiscrete.java


示例17: extractFeaturesInternal

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
 * Detects key points inside the image and computes descriptions at those points.
 */
protected double[][] extractFeaturesInternal(BufferedImage image) {
	ImageFloat32 boofcvImage = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class);

	// create the SURF detector and descriptor in BoofCV v0.15
	ConfigFastHessian conf = new ConfigFastHessian(detectThreshold, 2, maxFeaturesPerScale, 2, 9, 4, 4);
	DetectDescribePoint<ImageFloat32, SurfFeature> surf = FactoryDetectDescribe.surfStable(conf, null,
			null, ImageFloat32.class);
	// specify the image to process
	surf.detect(boofcvImage);
	int numPoints = surf.getNumberOfFeatures();
	double[][] descriptions = new double[numPoints][SURFLength];
	for (int i = 0; i < numPoints; i++) {
		descriptions[i] = surf.getDescription(i).getValue();
	}
	return descriptions;
}
 
开发者ID:MKLab-ITI,项目名称:multimedia-indexing,代码行数:20,代码来源:SURFExtractor.java


示例18: process

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
public void process( BufferedImage image ) {
	input.reshape(image.getWidth(),image.getHeight());
	noisy.reshape(input.width,input.height);
	output.reshape(input.width,input.height);
	deriv.reshape(input.width,input.height);

	ConvertBufferedImage.convertFromSingle(image, input, imageType);

	// add noise to the image
	noisy.setTo(input);
	GImageMiscOps.addGaussian(noisy, rand, noiseSigma, 0, 255);
	GPixelMath.boundImage(noisy,0,255);
	// compute edge image for weighted error
	GImageDerivativeOps.laplace(input,deriv);
	GPixelMath.abs(deriv,deriv);

	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			images.clear();
			images.add(ConvertBufferedImage.convertTo(output,null));
			images.add(ConvertBufferedImage.convertTo(noisy,null));
			images.add(ConvertBufferedImage.convertTo(input,null));
			info.reset();
			doRefreshAll();
		}});
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:27,代码来源:DenoiseVisualizeApp.java


示例19: stitch

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
/**
 * Given two input images create and display an image where the two have been overlayed on top of each other.
 */
public static <T extends ImageSingleBand>
void stitch( BufferedImage imageA , BufferedImage imageB , Class<T> imageType )
{
	T inputA = ConvertBufferedImage.convertFromSingle(imageA, null, imageType);
	T inputB = ConvertBufferedImage.convertFromSingle(imageB, null, imageType);

	// Detect using the standard SURF feature descriptor and describer
	DetectDescribePoint detDesc = FactoryDetectDescribe.surfStable(
			new ConfigFastHessian(1, 2, 200, 1, 9, 4, 4), null,null, ImageDataType.single(imageType));
	ScoreAssociation<SurfFeature> scorer = FactoryAssociation.scoreEuclidean(SurfFeature.class,true);
	AssociateDescription<SurfFeature> associate = FactoryAssociation.greedy(scorer,2,true);

	// fit the images using a homography.  This works well for rotations and distant objects.
	GenerateHomographyLinear modelFitter = new GenerateHomographyLinear(true);
	DistanceHomographySq distance = new DistanceHomographySq();

	ModelMatcher<Homography2D_F64,AssociatedPair> modelMatcher =
			new Ransac<Homography2D_F64,AssociatedPair>(123,modelFitter,distance,60,9);

	Homography2D_F64 H = computeTransform(inputA, inputB, detDesc, associate, modelMatcher);

	renderStitching(imageA,imageB,H);
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:27,代码来源:ExampleImageStitching.java


示例20: process

import boofcv.core.image.ConvertBufferedImage; //导入依赖的package包/类
public void process( final BufferedImage image ) {
	input.reshape(image.getWidth(),image.getHeight());
	output.reshape(image.getWidth(),image.getHeight());
	storage.reshape(image.getWidth(),image.getHeight());

	ConvertBufferedImage.convertFromMulti(image, input, imageType);

	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			setInputImage(image);
			renderedImage = new BufferedImage(input.width, input.height,BufferedImage.TYPE_INT_BGR);
			gui.setBufferedImage(renderedImage);
			gui.setPreferredSize(new Dimension(input.width,input.height));
			gui.repaint();
			processedImage = true;
			doRefreshAll();
		}});
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:ShowImageBlurApp.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CsdlNavigationProperty类代码示例发布时间:2022-05-22
下一篇:
Java CategoryWordTagFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap