當前位置: 首頁>>代碼示例>>Java>>正文


Java GeneralizedImageOps類代碼示例

本文整理匯總了Java中boofcv.core.image.GeneralizedImageOps的典型用法代碼示例。如果您正苦於以下問題:Java GeneralizedImageOps類的具體用法?Java GeneralizedImageOps怎麽用?Java GeneralizedImageOps使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GeneralizedImageOps類屬於boofcv.core.image包,在下文中一共展示了GeneralizedImageOps類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkBitmapToMultiRGB

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
public void checkBitmapToMultiRGB( Method m , Bitmap.Config config ) {
	Bitmap orig = Bitmap.createBitmap(w,h, config);
	orig.setPixel(1, 2, 0xFF204010 );
	
	Class[] params = m.getParameterTypes();
	
	String info = config+" "+m.getName();
	
	try {
		int numBands = Bitmap.Config.ARGB_8888 == config ? 4 : 3;
		Class msType = m.getName().contains("U8") ? ImageUInt8.class : ImageFloat32.class;
		
		MultiSpectral found = new MultiSpectral(msType,w,h,numBands);

		m.invoke(null, orig, found);
		
		assertEquals(0x20,(int)GeneralizedImageOps.get(found.getBand(0),1,2));
		assertEquals(0x40,(int)GeneralizedImageOps.get(found.getBand(1),1,2));
		assertEquals(0x10,(int)GeneralizedImageOps.get(found.getBand(2),1,2));
		if( numBands == 4 )
			assertEquals(0xFF,(int)GeneralizedImageOps.get(found.getBand(3),1,2));
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:26,代碼來源:TestImplConvertBitmap.java

示例2: checkGrayToBitmapRGB

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
public void checkGrayToBitmapRGB( Method m , Bitmap.Config config ) {
	Bitmap dst = Bitmap.createBitmap(w,h, config);
	
	Class[] params = m.getParameterTypes();
	
	try {
		ImageSingleBand src = (ImageSingleBand)params[0].getConstructor(int.class,int.class).newInstance(w,h);
		GeneralizedImageOps.set(src, 1, 2, 16);
		GeneralizedImageOps.set(src, 1, 3, 0xFF);

		String info = config+" "+params[0].getSimpleName();

		m.invoke(null, src, dst);

		assertEquals(info,0xFF101010,(int)dst.getPixel(1,2));
		assertEquals(info,0xFFFFFFFF,(int)dst.getPixel(1,3));
		assertEquals(info,0xFF000000,dst.getPixel(0,0));
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:22,代碼來源:TestImplConvertBitmap.java

示例3: equalizeLocal

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
@Test
public void equalizeLocal() {

	int numFound = 0;

	Method methods[] = EnhanceImageOps.class.getMethods();
	for( int i = 0; i < methods.length; i++ ) {
		if( methods[i].getName().compareTo("equalizeLocal") != 0 )
			continue;

		numFound++;

		Class imageType = methods[i].getParameterTypes()[0];
		ImageInteger input = (ImageInteger)GeneralizedImageOps.createSingleBand(imageType, width, height);
		ImageInteger output = (ImageInteger)GeneralizedImageOps.createSingleBand(imageType,width,height);

		equalizeLocal(input, output);

		BoofTesting.checkSubImage(this,"equalizeLocal",true,input,output);
	}

	assertEquals(2, numFound);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:24,代碼來源:TestEnhanceImageOps.java

示例4: filter

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
public static <T extends ImageSingleBand, D extends ImageSingleBand>
void filter( T input )
{
	Class<T> inputType = (Class<T>)input.getClass();
	Class<D> derivType = GImageDerivativeOps.getDerivativeType(inputType);

	T blurred = GeneralizedImageOps.createSingleBand(inputType, input.width, input.height);
	D derivX = GeneralizedImageOps.createSingleBand(derivType, input.width, input.height);
	D derivY = GeneralizedImageOps.createSingleBand(derivType, input.width, input.height);

	// declare image filters
	BlurFilter<T> filterBlur = FactoryBlurFilter.gaussian(inputType, -1, blurRadius);
	ImageGradient<T,D> gradient = FactoryDerivative.sobel(inputType, derivType);

	// process the image
	filterBlur.process(input,blurred);
	gradient.process(blurred,derivX,derivY);

	// display the results
	BufferedImage outputImage = VisualizeImageData.colorizeSign(derivX,null,-1);
	ShowImages.showWindow(outputImage,"Filter "+inputType.getSimpleName());
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:23,代碼來源:ExampleImageFilter.java

示例5: DisplayGaussianKernelApp

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
public DisplayGaussianKernelApp( Class<T> imageType ) {
	this.imageType = imageType;

	largeImg = GeneralizedImageOps.createSingleBand(imageType, imageSize, imageSize);
	addAlgorithm("Gaussian",new DerivType(0,0));
	addAlgorithm("Deriv X",new DerivType(1,0));
	addAlgorithm("Deriv XX",new DerivType(2,0));
	addAlgorithm("Deriv XXX",new DerivType(3,0));
	addAlgorithm("Deriv XXXX",new DerivType(4,0));
	addAlgorithm("Deriv XY",new DerivType(1,1));
	addAlgorithm("Deriv XXY",new DerivType(2,1));
	addAlgorithm("Deriv XYY",new DerivType(1,2));
	addAlgorithm("Deriv XXXY",new DerivType(3,1));
	addAlgorithm("Deriv XXYY",new DerivType(2,2));
	addAlgorithm("Deriv XYYY",new DerivType(1,3));

	setMainGUI(panel);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:19,代碼來源:DisplayGaussianKernelApp.java

示例6: testFlipVertical

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
private void testFlipVertical(Method m, int height) throws IllegalAccessException, InvocationTargetException {
	Class paramTypes[] = m.getParameterTypes();
	ImageSingleBand imgA = GeneralizedImageOps.createSingleBand(paramTypes[0], width, height);

	GImageMiscOps.fillUniform(imgA,rand,0,100);
	ImageSingleBand imgB = imgA.clone();

	m.invoke(null,imgB);

	for( int y = 0; y < height; y++ ) {
		for( int x = 0; x < width; x++ ) {
			double valA = GeneralizedImageOps.get(imgA,x,height-y-1);
			double valB = GeneralizedImageOps.get(imgB,x,y);
			assertTrue(valA==valB);
		}
	}
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:18,代碼來源:TestImageMiscOps.java

示例7: invert

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
public void invert( Method m ) throws InvocationTargetException, IllegalAccessException {
	Class param[] = m.getParameterTypes();
	ImageSingleBand input = GeneralizedImageOps.createSingleBand(param[0], width, height);
	GImageMiscOps.fillUniform(input, rand, 0, 100);
	ImageSingleBand output = GeneralizedImageOps.createSingleBand(param[0], width, height);

	m.invoke(null,input, 255, output);

	GImageSingleBand a = FactoryGImageSingleBand.wrap(input);
	GImageSingleBand b = FactoryGImageSingleBand.wrap(output);

	for (int y = 0; y < height; y++) {
		for (int x = 0; x < width; x++) {
			assertEquals(255 - a.get(x, y).doubleValue(), b.get(x, y).doubleValue(),1e-4f);
		}
	}
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:18,代碼來源:TestImplGrayImageOps.java

示例8: testBorder

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
/**
 * Compute the input along the image border and see if has the expected results
 */
public void testBorder() {
	imageGradient(input,derivX,derivY);
	alg.setImage(input);
	for( int y = 0; y < height; y++ ) {
		if( y < -sampleBoxY0 || y >= height-sampleBoxY1-1) {
			for( int x = 0; x < width; x++ ) {
				if( x < sampleBoxX0 || x >= width-sampleBoxX1-1) {
					G g = alg.compute(x,y);
					double expectedX = GeneralizedImageOps.get(derivX,x,y);
					double expectedY = GeneralizedImageOps.get(derivY,x,y);

					assertEquals(expectedX,g.getX(),1e-4);
					assertEquals(expectedY,g.getY(),1e-4);
				}
			}
		}
	}
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:22,代碼來源:GeneralSparseGradientTests.java

示例9: testAbs

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
private void testAbs(Method m) throws InvocationTargetException, IllegalAccessException {
	Class paramTypes[] = m.getParameterTypes();
	ImageSingleBand inputA = GeneralizedImageOps.createSingleBand(paramTypes[0], width, height);
	ImageSingleBand inputB = GeneralizedImageOps.createSingleBand(paramTypes[1], width, height);

	if( inputA.getTypeInfo().isSigned() ) {
		GImageMiscOps.fillUniform(inputA, rand, -20,20);
	} else {
		GImageMiscOps.fillUniform(inputA, rand, 0,20);
	}

	m.invoke(null,inputA,inputB);

	for( int i = 0; i < height; i++ ) {
		for( int j = 0; j < width; j++ ) {
			double a = GeneralizedImageOps.get(inputA,j,i);
			double b = GeneralizedImageOps.get(inputB,j,i);

			assertEquals(Math.abs(a),b,1e-4);
		}
	}
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:23,代碼來源:TestPixelMath.java

示例10: transform

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
@Override
public ImageSInt32 transform(T original, ImageSInt32 transformed) {

	if( transformed == null ) {
		ImageDimension d = UtilWavelet.transformDimension(original,numLevels);
		transformed = new ImageSInt32(d.width,d.height);
	}
	temp.reshape(transformed.width,transformed.height);

	copyInput.reshape(original.width,original.height);
	if( original.getTypeInfo().getDataType() == int.class ) {
		copyInput.setTo((ImageSInt32)original);
	} else {
		GeneralizedImageOps.convert(original, copyInput);
	}
	WaveletTransformOps.transformN(desc, copyInput,transformed,temp,numLevels);

	return transformed;
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:20,代碼來源:WaveletTransformInt.java

示例11: convolveDerivOrder

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
/**
 * Validate that convolution/derivative is in fact associative
 */
public void convolveDerivOrder() {
	T blur = GeneralizedImageOps.createSingleBand(imageType, width, height);
	T blurDeriv = GeneralizedImageOps.createSingleBand(imageType, width, height);
	T deriv = GeneralizedImageOps.createSingleBand(imageType, width, height);
	T derivBlur = GeneralizedImageOps.createSingleBand(imageType, width, height);

	BlurStorageFilter<T> funcBlur = FactoryBlurFilter.gaussian(imageType,sigma,radius);
	ImageGradient<T,T> funcDeriv = FactoryDerivative.three(imageType,imageType);

	funcBlur.process(input,blur);
	funcDeriv.process(blur,blurDeriv,derivY);

	funcDeriv.process(input,deriv,derivY);
	funcBlur.process(deriv,derivBlur);

	printIntensity("Blur->Deriv",blurDeriv);
	printIntensity("Deriv->Blur",blurDeriv);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:22,代碼來源:EdgeIntensitiesApp.java

示例12: process

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
public void process( BufferedImage image ) {
	I input = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());
	I blur = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());

	ConvertBufferedImage.convertFromSingle(image, input, imageType);
	GBlurImageOps.gaussian(input, blur, -1, 2, null);

	DetectLineHoughPolar<I,D> alg =  FactoryDetectLineAlgs.houghPolar(5, 10, 2, Math.PI / 180, 25, 10, imageType, derivType);

	List<LineParametric2D_F32> lines = alg.detect(blur);

	ImageLinePanel gui = new ImageLinePanel();
	gui.setBackground(image);
	gui.setLines(lines);
	gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight()));

	BufferedImage renderedTran = VisualizeImageData.grayMagnitude(alg.getTransform().getTransform(),null,-1);
	BufferedImage renderedBinary = VisualizeBinaryData.renderBinary(alg.getBinary(), null);

	ShowImages.showWindow(renderedBinary,"Detected Edges");
	ShowImages.showWindow(renderedTran,"Parameter Space");
	ShowImages.showWindow(gui,"Detected Lines");
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:24,代碼來源:VisualizeHoughPolar.java

示例13: sharpenBorder4

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
/**
 * Compare the sharpen filter to a bounded convolution
 */
@Test
public void sharpenBorder4() {
	int numFound = 0;

	Method methods[] = ImplEnhanceFilter.class.getMethods();
	for( int i = 0; i < methods.length; i++ ) {
		if( methods[i].getName().compareTo("sharpenBorder4") != 0 )
			continue;

		numFound++;

		Class imageType = methods[i].getParameterTypes()[0];
		ImageSingleBand input = GeneralizedImageOps.createSingleBand(imageType, width, height);
		ImageSingleBand output = GeneralizedImageOps.createSingleBand(imageType,width,height);

		sharpenBorder4(input, output);

		BoofTesting.checkSubImage(this, "sharpenBorder4", true, input, output);
	}

	assertEquals(2,numFound);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:26,代碼來源:TestImplEnhanceFilter.java

示例14: computeScoreRect

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
/**
 * Compute SAD (Sum of Absolute Difference) error.
 *
 * @param leftX X-axis center left image
 * @param rightX X-axis center left image
 * @param centerY Y-axis center for both images
 * @return Fit score for both regions.
 */
protected double computeScoreRect( int leftX , int rightX , int centerY ) {

	double ret=0;

	for( int y = -radiusY; y <= radiusY; y++ ) {
		for( int x = -radiusX; x <= radiusX; x++ ) {
			double l = GeneralizedImageOps.get(imageLeft,leftX+x,centerY+y);
			double r = GeneralizedImageOps.get(imageRight,rightX+x,centerY+y);

			ret += Math.abs(l-r);
		}
	}

	return ret;
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:24,代碼來源:StereoDisparityWtoNaiveFive.java

示例15: DetectLineHoughPolar

import boofcv.core.image.GeneralizedImageOps; //導入依賴的package包/類
/**
 * Configures hough line detector.
 *
 * @param localMaxRadius Radius for local maximum suppression.  Try 2.
 * @param minCounts Minimum number of counts for detected line.  Critical tuning parameter and image dependent.
 * @param resolutionRange Resolution of line range in pixels.  Try 2
 * @param resolutionAngle Resolution of line angle in radius.  Try PI/180
 * @param thresholdEdge Edge detection threshold. Try 50.
 * @param maxLines Maximum number of lines to return. If <= 0 it will return them all.
 * @param gradient Algorithm for computing image gradient.
 */
public DetectLineHoughPolar(int localMaxRadius,
							int minCounts,
							double resolutionRange ,
							double resolutionAngle ,
							float thresholdEdge,
							int maxLines ,
							ImageGradient<I, D> gradient)
{
	pruneAngleTol = (float)((localMaxRadius+1)*resolutionAngle);
	pruneRangeTol = (float)((localMaxRadius+1)*resolutionRange);
	this.localMaxRadius = localMaxRadius;
	this.gradient = gradient;
	this.thresholdEdge = thresholdEdge;
	this.resolutionRange = resolutionRange;
	this.resolutionAngle = resolutionAngle;
	this.maxLines = maxLines <= 0 ? Integer.MAX_VALUE : maxLines;
	extractor = FactoryFeatureExtractor.nonmax(new ConfigExtract(localMaxRadius, minCounts, 0, true));
	derivX = GeneralizedImageOps.createSingleBand(gradient.getDerivType(), 1, 1);
	derivY = GeneralizedImageOps.createSingleBand(gradient.getDerivType(), 1, 1);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:32,代碼來源:DetectLineHoughPolar.java


注:本文中的boofcv.core.image.GeneralizedImageOps類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。