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


Java MBFImage.fill方法代码示例

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


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

示例1: MSEREllipseFinder

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
 * Construct demo
 */
public MSEREllipseFinder() {
	final MBFImage image = new MBFImage(400, 400, ColourSpace.RGB);
	final MBFImageRenderer renderer = image.createRenderer();

	image.fill(RGBColour.WHITE);
	final List<Ellipse> ellipses = new ArrayList<Ellipse>();
	ellipses.add(new Ellipse(200, 100, 100, 80, Math.PI / 4));
	ellipses.add(new Ellipse(200, 300, 50, 30, -Math.PI / 4));
	ellipses.add(new Ellipse(100, 300, 30, 50, -Math.PI / 3));

	for (final Ellipse ellipse : ellipses) {
		renderer.drawShapeFilled(ellipse, RGBColour.BLACK);
	}

	final MSERFeatureGenerator mser = new MSERFeatureGenerator(MomentFeature.class);
	final List<Component> features = mser.generateMSERs(Transforms
			.calculateIntensityNTSC(image));
	for (final Component c : features) {
		final MomentFeature feature = c.getFeature(MomentFeature.class);
		renderer.drawShape(feature.getEllipse(2), RGBColour.RED);
		renderer.drawShape(feature.getEllipse(2)
				.calculateOrientedBoundingBox(), RGBColour.GREEN);
	}
	DisplayUtilities.display(image);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:29,代码来源:MSEREllipseFinder.java

示例2: drawToImage

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void drawToImage(MBFImage image) {
	image.fill(RGBColour.WHITE);
	switch (this.touchArray.size()) {
	case 0:
		drawTarget(image, TOP_LEFT);
		break;
	case 1:
		drawTarget(image, TOP_RIGHT);
		break;
	case 2:
		drawTarget(image, BOTTOM_LEFT);
		break;
	case 3:
		drawTarget(image, BOTTOM_RIGHT);
		break;
	default:
		break;
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:21,代码来源:TouchTableScreen.java

示例3: run

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void run() {
	while (true) {
		if (!renderMode)
			break;
		final MBFImage extracted = this.image.extractROI(this.visibleArea);
		if (clear) {
			extracted.fill(RGBColour.WHITE);
			this.clear = false;
		}
		this.mode.drawToImage(extracted);

		this.image.drawImage(extracted, 0, 0);
		DisplayUtilities.display(this.image, this);
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:17,代码来源:TouchTableScreen.java

示例4: redrawCircles

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private void redrawCircles(MBFImage output) {
	long now = System.currentTimeMillis();
	output.fill(RGBColour.WHITE);
	MBFImageRenderer rend = output.createRenderer(RenderHints.ANTI_ALIASED);
	for (String hash: this.hashCircles.keySet()) {
		Circle circle = this.hashCircles.get(hash);
		Float[] col = this.hashColours.get(hash);
		float level = 2;
		long lastSeen = this.hashAggregations.get(hash).lastSeen;
		if(lastSeen!=0){				
			long diff = Math.abs(lastSeen - now);
			if(diff < BLIP_TIME){
				level -= (1 - ( diff / (float)BLIP_TIME));
			}
		}
		Float[] offCircleColour = dark(col,level);
		
		drawHashCircle(rend , hash, circle, offCircleColour);
	}
	for (IndependentPair<Point2dImpl, MBFImage> pTextLayer : this.textLayers) {
		
		MBFImage textLayer = pTextLayer.getSecondObject();
		Point2d p = pTextLayer.firstObject();
		output.drawImage(textLayer , (int)p.getX(), (int)p.getY());
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:27,代码来源:PrettyTagRenderer.java

示例5: main

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
public static void main(String[] args) {
	final MBFImage image = new MBFImage(400, 400, ColourSpace.RGB);
	final MBFImageRenderer renderer = image.createRenderer();

	image.fill(RGBColour.BLACK);
	final List<Ellipse> ellipses = new ArrayList<Ellipse>();
	ellipses.add(new Ellipse(200, 100, 10, 8, Math.PI / 4));
	ellipses.add(new Ellipse(200, 300, 5, 3, -Math.PI / 4));
	ellipses.add(new Ellipse(100, 300, 3, 5, -Math.PI / 3));

	for (final Ellipse ellipse : ellipses) {
		renderer.drawShapeFilled(ellipse, RGBColour.WHITE);
	}

	final LOCKY locky = new LOCKY();
	locky.findInterestPoints(image.flatten());
	final List<EllipticInterestPointData> pts = locky.getInterestPoints();
	for (final EllipticInterestPointData pt : pts) {
		image.drawShape(pt.getEllipse(), RGBColour.RED);
	}

	DisplayUtilities.display(image);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:24,代码来源:LOCKY.java

示例6: drawCentroids

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
MBFImage drawCentroids(double[][] centroids) {
	final int wh = (int) Math.sqrt(numCentroids);
	final MBFImage tmp = new MBFImage(wh * (patchSize + 1) + 1, wh * (patchSize + 1) + 1);
	final float mn = -1.0f;
	final float mx = +1.0f;
	tmp.fill(new Float[] { mx, mx, mx });

	for (int i = 0, y = 0; y < wh; y++) {
		for (int x = 0; x < wh; x++, i++) {
			final MBFImage p = new MBFImage(centroids[i], patchSize, patchSize, 3, false);
			tmp.drawImage(p, x * (patchSize + 1) + 1, y * (patchSize + 1) + 1);
		}
	}
	tmp.subtractInplace(mn);
	tmp.divideInplace(mx - mn);
	return tmp;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:18,代码来源:KMeansExp1.java

示例7: main

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
 * Main method
 * 
 * @param args
 */
public static void main(String[] args) {
	// Create an image
	final MBFImage image = new MBFImage(320, 70, ColourSpace.RGB);

	// Fill the image with white
	image.fill(RGBColour.WHITE);

	// Render some test into the image
	image.drawText("Hello World", 10, 60, HersheyFont.CURSIVE, 50, RGBColour.BLACK);

	// Apply a Gaussian blur
	image.processInplace(new FGaussianConvolve(2f));

	// Display the image
	DisplayUtilities.display(image);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:22,代码来源:App.java

示例8: main

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	MathMLFontRenderer<Float[]> rend = new MathMLFontRenderer<Float[]>();
	
	String mathML = "x = 2\\mathrm{wang}wang" ;
	
	MBFImage img = new MBFImage(300, 300, ColourSpace.RGB);
	img.fill(RGBColour.WHITE);
	MBFImageRenderer renderer = img.createRenderer();
	MathMLFontStyle<Float[]> style = new MathMLFontStyle<Float[]>(new MathMLFont(), RGBColour.WHITE);
	style.setColour(RGBColour.RED);
	style.setFontSize(30);
	rend.renderText(renderer, mathML, 0, 100, style);
	DisplayUtilities.display(img);
	
	MathMLFontRenderer<Float> rendf = new MathMLFontRenderer<Float>();
	
	FImage imgf = new FImage(300, 300);
	imgf.fill(0f);
	FImageRenderer rendererf = imgf.createRenderer();
	MathMLFontStyle<Float> stylef = new MathMLFontStyle<Float>(new MathMLFont(), 0.5f);
	stylef.setFontSize(30);
	rendf.renderText(rendererf, mathML, 0, 100, stylef);
	DisplayUtilities.display(imgf);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:28,代码来源:MathMLFontRenderer.java

示例9: draw

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
 * @param params
 * @return draw the plot
 */
public MBFImage draw(TernaryParams params) {

	final int padding = (Integer) params.getTyped(TernaryParams.PADDING);
	final Float[] bgColour = params.getTyped(TernaryParams.BG_COLOUR);

	final MBFImage ret = new MBFImage((int) width + padding * 2, (int) height + padding * 2, ColourSpace.RGB);
	ret.fill(bgColour);
	drawTernaryPlot(ret, params);
	drawTriangle(ret, params);
	drawBorder(ret, params);
	drawScale(ret, params);
	drawLabels(ret, params);

	return ret;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:20,代码来源:TernaryPlot.java

示例10: main

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
public static void main( String[] args ) {
	//Create an image
    MBFImage image = new MBFImage(320,70, ColourSpace.RGB);

    //Fill the image with white
    image.fill(RGBColour.WHITE);
    		        
    //Render some test into the image
    image.drawText("Hello World", 10, 60, HersheyFont.CURSIVE, 50, RGBColour.BLACK);

    //Apply a Gaussian blur
    image.processInplace(new FGaussianConvolve(2f));
    
    //Display the image
    DisplayUtilities.display(image);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:17,代码来源:App.java

示例11: setup

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
 * create the test images, draw a few ellipses on the test image, initialise the IPDEngine
 */
@Before public void setup(){
	image = new MBFImage(400,400,ColourSpace.RGB);
	ellipseDrawn = new Ellipse(200,200,100,50,Math.PI/4);
	
	image.fill(RGBColour.WHITE);
	image.createRenderer().drawShapeFilled(ellipseDrawn, RGBColour.BLACK);
	
	int derScale = 100;
	int intScale = derScale  * 3;
	InterestPointDetector<?> ipd;
	AbstractStructureTensorIPD aipd = new HarrisIPD(derScale,intScale);
	AffineAdaption affine = new AffineAdaption(aipd,new IPDSelectionMode.Threshold(0.1f));
	ipd = affine;
	engine = new EllipticIPDSIFTEngine((AffineAdaption)ipd);
	engine.setSelectionMode(new IPDSelectionMode.Count(2));
	engine.setAcrossScales(false);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:21,代码来源:IPDEngineTest.java

示例12: processFrame

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public MBFImage processFrame(MBFImage frame) {
	addToCache(frame);

	final int height = frame.getHeight();
	final float prop = (float) (cacheSize) / height;
	frame.fill(RGBColour.BLACK);
	final float[][] framer = frame.getBand(0).pixels;
	final float[][] frameg = frame.getBand(1).pixels;
	final float[][] frameb = frame.getBand(2).pixels;
	for (int y = 0; y < height; y++) {
		final int index = (int) (y * prop);
		if (index >= cache.size()) {
			break;
		}
		// System.out.println("y = " + y);
		// System.out.println("index = " + index);
		final float[][][] cacheImage = cache.get(index);
		System.arraycopy(cacheImage[0][y], 0, framer[y], 0, cacheImage[0][y].length);
		System.arraycopy(cacheImage[1][y], 0, frameg[y], 0, cacheImage[1][y].length);
		System.arraycopy(cacheImage[2][y], 0, frameb[y], 0, cacheImage[2][y].length);
	}

	for (final FImage f : frame.bands) {
		FImageConvolveSeparable.convolveVertical(f, blurKern);
	}

	if (cache.size() >= cacheSize)
		cache.removeLast();

	return frame;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:33,代码来源:SlitScanProcessor.java

示例13: beforeUpdate

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void beforeUpdate(MBFImage frame) {
	// Rectangle extractionArea = new
	// Rectangle(100,100,IMAGE_WIDTH-200,IMAGE_HEIGHT-200);

	if (this.mode == DebugMode.DEBUG_DISPLAY)
		return;
	final FImage grey = frame.extractROI(extractionArea).flatten();
	if (!this.backgroundLearner.ready()) {
		grey.process(this.backgroundLearner);
		frame.fill(RGBColour.BLACK);
		frame.drawImage(new MBFImage(grey, grey, grey), (int) extractionArea.x, (int) extractionArea.y);
		return;
	}
	grey.addInplace(this.backgroundLearner.getBackground());
	grey.threshold(0.07f);
	// grey.processInplace(new OtsuThreshold());
	// if(grey.sum() > BIGGEST_POINT_AREA * 2 ){
	// this.backgroundLearner.relearn();
	// return;
	// }

	// List<Circle> filtered = getFilteredCircles(grey);
	final List<Touch> filtered = getFilteredTouchesFast(grey);
	if (filtered.size() != 0)
		this.fireTouchEvent(filtered);
	frame.fill(RGBColour.BLACK);
	frame.drawImage(new MBFImage(grey, grey, grey), (int) extractionArea.x, (int) extractionArea.y);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:30,代码来源:TouchTableDemo.java

示例14: drawWhiteboard

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private synchronized void drawWhiteboard(MBFImage drawingPanel) {
	// drawingPanel.fill(RGBColour.WHITE);
	if (mode == MODE.MODEL || this.calibrationPointIndex < this.calibrationPoints.size()) {
		drawingPanel.fill(RGBColour.WHITE);
		final Point2d waitingForPoint = this.calibrationPoints.get(calibrationPointIndex).secondObject();
		drawingPanel.createRenderer().drawShape(new Circle(waitingForPoint.getX(), waitingForPoint.getY(), 10),
				RGBColour.RED);
	}

}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:11,代码来源:DigitalWhiteboard.java

示例15: main

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
	System.out.println("start");
	final RandomPatchSampler<MBFImage> sampler = new RandomPatchSampler<MBFImage>(
			CIFAR10Dataset.getTrainingImages(CIFAR10Dataset.MBFIMAGE_READER),
			8, 8, 400000);
	final List<MBFImage> patches = sampler.getPatches();
	System.out.println("stop");

	final double[][] data = new double[patches.size()][];
	for (int i = 0; i < data.length; i++)
		data[i] = patches.get(i).getDoublePixelVector();

	// final PCAWhitening whitening = new PCAWhitening();
	final ZCAWhitening whitening = new ZCAWhitening(0.1, new PerExampleMeanCenter());
	whitening.train(data);
	final double[][] wd = whitening.whiten(data);

	final SphericalKMeans skm = new SphericalKMeans(1600, 10);
	final SphericalKMeansResult res = skm.cluster(wd);
	final MBFImage tmp = new MBFImage(40 * (8 + 1) + 1, 40 * (8 + 1) + 1);
	tmp.fill(RGBColour.WHITE);
	for (int i = 0; i < 40; i++) {
		for (int j = 0; j < 40; j++) {
			final MBFImage patch = new MBFImage(res.centroids[i * 40 + j], 8, 8, 3, false);
			tmp.drawImage(patch, i * (8 + 1) + 1, j * (8 + 1) + 1);
		}
	}
	tmp.subtractInplace(-1.5f);
	tmp.divideInplace(3f);
	DisplayUtilities.display(tmp);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:32,代码来源:Test2.java


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