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


Java ConvertBufferedImage.convertFromSingle方法代码示例

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


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

示例1: process

import boofcv.core.image.ConvertBufferedImage; //导入方法依赖的package包/类
public void process(final BufferedImage buffLeft, final BufferedImage buffRight) {
	image0.reshape(buffLeft.getWidth(), buffLeft.getHeight());
	image1.reshape(buffRight.getWidth(), buffRight.getHeight());

	ConvertBufferedImage.convertFromSingle(buffLeft, image0, imageType);
	ConvertBufferedImage.convertFromSingle(buffRight, image1, imageType);

	createSet(image0,features0,points0);
	createSet(image1,features1,points1);

	System.out.println("Found features: "+features0.size()+" "+features1.size());

	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			panel.setImages(buffLeft, buffRight);
			processedImage = true;
			doRefreshAll();
		}
	});
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:21,代码来源:VisualizeAssociationAlgorithmsApp.java

示例2: 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

示例3: 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

示例4: 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

示例5: process

import boofcv.core.image.ConvertBufferedImage; //导入方法依赖的package包/类
public void process(BufferedImage buffLeft, BufferedImage buffRight) {
	// copy the input images
	imageLeft.reshape(buffLeft.getWidth(), buffLeft.getHeight());
	imageRight.reshape(buffRight.getWidth(), buffRight.getHeight());

	ConvertBufferedImage.convertFromSingle(buffLeft, imageLeft, imageType);
	ConvertBufferedImage.convertFromSingle(buffRight, imageRight, imageType);

	// update the GUI's background images
	scorePanel.setImages(buffLeft, buffRight);

	processedImage = true;

	// tell it to update everything
	doRefreshAll();
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:17,代码来源:VisualizeAssociationScoreApp.java

示例6: process

import boofcv.core.image.ConvertBufferedImage; //导入方法依赖的package包/类
public void process( final BufferedImage input ) {
	setInputImage(input);
	this.input = ConvertBufferedImage.convertFromSingle(input, this.input, ImageUInt8.class);
	this.enhanced = new ImageUInt8(input.getWidth(),input.getHeight());
	this.output = new BufferedImage( input.getWidth(), input.getHeight(), BufferedImage.TYPE_INT_RGB);

	// over write input image so that it's gray scale
	ConvertBufferedImage.convertTo(this.input,input);

	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			setPreferredSize(new Dimension(input.getWidth(),input.getHeight()));
			processImage = true;
		}});
	doRefreshAll();
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:17,代码来源:ImageEnhanceApp.java

示例7: process

import boofcv.core.image.ConvertBufferedImage; //导入方法依赖的package包/类
public void process( final BufferedImage image ) {
	imageInput.reshape(image.getWidth(),image.getHeight());
	imageBinary.reshape(image.getWidth(),image.getHeight());
	imageOutput.reshape(image.getWidth(),image.getHeight());

	ConvertBufferedImage.convertFromSingle(image, imageInput, imageType);

	// average pixel intensity should be a reasonable threshold
	final double threshold = GImageStatistics.mean(imageInput);
	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			selectThresh.setThreshold((int) threshold);
			setInputImage(image);
			selectThresh.getHistogramPanel().update(imageInput);
			selectThresh.repaint();
		}});
	doRefreshAll();
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:DemoBinaryImageOpsApp.java

示例8: 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

示例9: process

import boofcv.core.image.ConvertBufferedImage; //导入方法依赖的package包/类
public void process( final BufferedImage input ) {
	setInputImage(input);
	final T gray = ConvertBufferedImage.convertFromSingle(input, null, imageType);

	PyramidFloat<T> pyramid = FactoryPyramid.scaleSpace(scales,imageType);

	pyramid.process(gray);

	gui.set(pyramid,true);
	
	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			gui.render();
			gui.repaint();
			setPreferredSize(new Dimension(gray.width+50,gray.height+20));
			processedImage = true;
		}});
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:VisualizeScaleSpacePyramidApp.java

示例10: process

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

	ConvertBufferedImage.convertFromSingle(image, input, imageType);

	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			gui.setBackground(image);
			gui.setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
			doRefreshAll();
		}
	});
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:16,代码来源:DetectLineApp.java

示例11: process

import boofcv.core.image.ConvertBufferedImage; //导入方法依赖的package包/类
public void process( final BufferedImage original ) {
		setInputImage(original);

		this.original = original;
		image = ConvertBufferedImage.convertFromSingle(original, null, imageType);

		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				// adjust the preferred size for the list panel
				int width = panel.getListWidth();

//				setPreferredSize(new Dimension(original.getWidth()+width+10,original.getHeight()+30));
				doRefreshAll();
			}});
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:16,代码来源:ShowImageDerivative.java

示例12: process

import boofcv.core.image.ConvertBufferedImage; //导入方法依赖的package包/类
public void process( final BufferedImage input ) {
	setInputImage(input);
	this.input = input;
	workImage = ConvertBufferedImage.convertFromSingle(input, null, imageType);
	temp = new BufferedImage(workImage.width,workImage.height,BufferedImage.TYPE_INT_BGR);
	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			setPreferredSize(new Dimension(input.getWidth(),input.getHeight()));
			processImage = true;
		}});
	doRefreshAll();
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:13,代码来源:IntensityPointFeatureApp.java

示例13: main

import boofcv.core.image.ConvertBufferedImage; //导入方法依赖的package包/类
public static void main( String args[] ) {
	// load and convert the image into a usable format
	BufferedImage image = UtilImageIO.loadImage("../data/applet/particles01.jpg");

	// convert into a usable format
	ImageFloat32 input = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class);
	ImageUInt8 binary = new ImageUInt8(input.width,input.height);
	ImageSInt32 label = new ImageSInt32(input.width,input.height);

	// the mean pixel value is often a reasonable threshold when creating a binary image
	double mean = ImageStatistics.mean(input);

	// create a binary image by thresholding
	ThresholdImageOps.threshold(input,binary,(float)mean,true);

	// remove small blobs through erosion and dilation
	// The null in the input indicates that it should internally declare the work image it needs
	// this is less efficient, but easier to code.
	ImageUInt8 filtered = BinaryImageOps.erode8(binary,null);
	filtered = BinaryImageOps.dilate8(filtered, null);

	// Detect blobs inside the image using an 8-connect rule
	List<Contour> contours = BinaryImageOps.contour(filtered, 8, label);

	// colors of contours
	int colorExternal = 0xFFFFFF;
	int colorInternal = 0xFF2020;

	// display the results
	BufferedImage visualBinary = VisualizeBinaryData.renderBinary(binary, null);
	BufferedImage visualFiltered = VisualizeBinaryData.renderBinary(filtered, null);
	BufferedImage visualLabel = VisualizeBinaryData.renderLabeled(label, contours.size(), null);
	BufferedImage visualContour = VisualizeBinaryData.renderContours(contours,colorExternal,colorInternal,
			input.width,input.height,null);

	ShowImages.showWindow(visualBinary,"Binary Original");
	ShowImages.showWindow(visualFiltered,"Binary Filtered");
	ShowImages.showWindow(visualLabel,"Labeled Blobs");
	ShowImages.showWindow(visualContour,"Contours");
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:41,代码来源:ExampleBinaryOps.java

示例14: main

import boofcv.core.image.ConvertBufferedImage; //导入方法依赖的package包/类
public static void main( String args[] ) {
		// load and convert the image into a usable format
		BufferedImage image = UtilImageIO.loadImage("../data/applet/particles01.jpg");
		ImageFloat32 input = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class);

		ImageUInt8 binary = new ImageUInt8(input.width,input.height);

		// the mean pixel value is often a reasonable threshold when creating a binary image
		double mean = ImageStatistics.mean(input);

		// create a binary image by thresholding
		ThresholdImageOps.threshold(input, binary, (float) mean, true);

		// reduce noise with some filtering
		ImageUInt8 filtered = BinaryImageOps.erode8(binary,null);
		filtered = BinaryImageOps.dilate8(filtered, null);

		// Find the contour around the shapes
		List<Contour> contours = BinaryImageOps.contour(filtered,8,null);

		// Fit an ellipse to each external contour and draw the results
		Graphics2D g2 = image.createGraphics();
		g2.setStroke(new BasicStroke(3));
		g2.setColor(Color.RED);

		for( Contour c : contours ) {
			FitData<EllipseRotated_F64> ellipse = ShapeFittingOps.fitEllipse_I32(c.external,0,false,null);
			VisualizeShapes.drawEllipse(ellipse.shape, g2);
		}

//		ShowImages.showWindow(VisualizeBinaryData.renderBinary(filtered,null),"Binary");
		ShowImages.showWindow(image,"Ellipses");
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:34,代码来源:ExampleFitEllipse.java

示例15: next

import boofcv.core.image.ConvertBufferedImage; //导入方法依赖的package包/类
@Override
public T next() {
	try {
		imageGUI = ImageIO.read(new ByteArrayInputStream(jpegData.get(index)));
	} catch (IOException e) {
		throw new RuntimeException(e);
	}

	if(forward) {
		index++;
		if( loop && index >= jpegData.size() ) {
			index = jpegData.size()-1;
			forward = false;
		}
	} else {
		index--;
		if( loop && index < 0) {
			index = 1;
			forward = true;
		}
	}

	output.reshape(imageGUI.getWidth(),imageGUI.getHeight());
	switch( imageType.getFamily()) {
		case SINGLE_BAND:
			ConvertBufferedImage.convertFromSingle(imageGUI, (ImageSingleBand)output, imageType.getDataType().getImageClass());
		break;

		case MULTI_SPECTRAL:
			ConvertBufferedImage.convertFromMulti(imageGUI, (MultiSpectral) output, imageType.getDataType().getImageClass());
			ConvertBufferedImage.orderBandsIntoRGB((MultiSpectral) output,imageGUI);
			break;

		default:
			throw new RuntimeException("Not supported yet: "+imageType.getFamily());
	}

	return output;
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:40,代码来源:JpegByteImageSequence.java


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