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


Java MBFImage.drawShapeFilled方法代码示例

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


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

示例1: doTutorial

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
	public void doTutorial(MBFImage image) {
		HistogramModel model = new HistogramModel(10,4,1);
		MBFImage space = Transforms.RGB_TO_HSV(image);
		model.estimateModel(space);
		MultidimensionalHistogram feature = model.histogram;
		Float[][] colours = buildBinCols(feature);
		MBFImage colourGrid = new MBFImage(80,image.getHeight(),3);
		int sqW = (colourGrid.getWidth()/4);
		int sqH = (colourGrid.getHeight()/10);
		for(int y = 0; y < 4; y++){
			for(int k = 0; k < 10; k++){
				Rectangle draw = new Rectangle(y * sqW,sqH*k,sqW,sqH);
				colourGrid.drawShapeFilled(draw, colours[y * 10 + k]);
			}
		}
		
//		DisplayUtilities.displayName(colourGrid, "wang");
		image.drawImage(colourGrid, image.getWidth()-colourGrid.getWidth(), 0);
	}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:21,代码来源:ColourHistogramGrid.java

示例2: drawToImage

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void drawToImage(MBFImage image) {
	final List<Touch> toDraw = this.getDrawingPoints();
	// if(this.touchScreen.cameraConfig instanceof
	// TriangleCameraConfig){
	// ((TriangleCameraConfig)this.touchScreen.cameraConfig).drawTriangles(image);
	//
	// }
	for (final Touch touch : toDraw) {
		// Point2d trans =
		// point2d.transform(this.touchScreen.cameraConfig.homography);

		final Circle trans = this.touchScreen.cameraConfig.transformTouch(touch);
		if (trans != null)
			image.drawShapeFilled(trans, RGBColour.BLUE);
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:18,代码来源:TouchTableScreen.java

示例3: drawPoints

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private static void drawPoints(Stream<IndependentPair<double[], PerceptronClass>> dataStream, Line2d line) {
	final MBFImage img = new MBFImage(300, 300, ColourSpace.RGB);

	img.drawLine(line, 3, RGBColour.BLUE);

	for (final IndependentPair<double[], PerceptronClass> pointClass : dataStream) {

		final double[] pc = pointClass.firstObject();
		final Point2dImpl point = new Point2dImpl((float) pc[0], (float) pc[1]);
		final PerceptronClass cls = pointClass.getSecondObject();
		switch (cls) {
		case TRUE:
			img.drawShapeFilled(new Circle(point, 5), RGBColour.GREEN);
			break;
		case FALSE:
			img.drawShape(new Circle(point, 5), 3, RGBColour.RED);
			break;
		case NONE:
			throw new RuntimeException("NOPE");
		}
	}
	DisplayUtilities.displayName(img, "random");
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:24,代码来源:DrawLinearData.java

示例4: main

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
 * Main method
 * 
 * @param args
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
	// Load the image
	final MBFImage image = ImageUtilities.readMBF(new URL("http://static.openimaj.org/media/tutorial/sinaface.jpg"));

	// Print colour space
	System.out.println(image.colourSpace);

	// Display the image
	DisplayUtilities.display(image);
	DisplayUtilities.display(image.getBand(0), "Red Channel");

	// Set blue and green pixels to black, and draw
	final MBFImage clone = image.clone();
	for (int y = 0; y < image.getHeight(); y++) {
		for (int x = 0; x < image.getWidth(); x++) {
			clone.getBand(1).pixels[y][x] = 0;
			clone.getBand(2).pixels[y][x] = 0;
		}
	}
	DisplayUtilities.display(clone);

	// Find edges
	image.processInplace(new CannyEdgeDetector());
	DisplayUtilities.display(image);

	// Draw some stuff
	image.drawShapeFilled(new Ellipse(700f, 450f, 20f, 10f, 0f), RGBColour.WHITE);
	image.drawShapeFilled(new Ellipse(650f, 425f, 25f, 12f, 0f), RGBColour.WHITE);
	image.drawShapeFilled(new Ellipse(600f, 380f, 30f, 15f, 0f), RGBColour.WHITE);
	image.drawShapeFilled(new Ellipse(500f, 300f, 100f, 70f, 0f), RGBColour.WHITE);
	image.drawText("OpenIMAJ is", 425, 300, HersheyFont.ASTROLOGY, 20, RGBColour.BLACK);
	image.drawText("Awesome", 425, 330, HersheyFont.ASTROLOGY, 20, RGBColour.BLACK);
	DisplayUtilities.display(image);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:41,代码来源:App.java

示例5: drawLabels

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private void drawLabels(MBFImage ret, TernaryParams params) {
	final int padding = (Integer) params.getTyped(TernaryParams.PADDING);
	final List<IndependentPair<TernaryData, String>> labels = params.getTyped(TernaryParams.LABELS);
	final Map<? extends Attribute, Object> typed = params.getTyped(TernaryParams.LABEL_FONT);
	final FontStyle<Float[]> fs = FontStyle.parseAttributes(typed, ret.createRenderer());
	final Float[] labelBackground = params.getTyped(TernaryParams.LABEL_BACKGROUND);
	final Float[] labelBorder = params.getTyped(TernaryParams.LABEL_BORDER);
	final int labelPadding = (Integer) params.getTyped(TernaryParams.LABEL_PADDING);
	final FontRenderer<Float[], FontStyle<Float[]>> fontRenderer = fs.getRenderer(ret.createRenderer());
	if (labels != null) {
		for (final IndependentPair<TernaryData, String> labelPoint : labels) {
			final TernaryData ternaryData = labelPoint.firstObject();
			final Point2d point = ternaryData.asPoint();
			point.setX(point.getX() * width + padding);
			point.setY(height - (point.getY() * width) + padding);
			final Point2d p = point.copy();
			if (point.getY() < height / 2) {
				point.setY(point.getY() - 10);
			}
			else {
				point.setY(point.getY() + 35);
			}
			final Rectangle rect = fontRenderer.getBounds(labelPoint.getSecondObject(), (int) point.getX(),
					(int) point.getY(), fs);
			rect.x -= labelPadding;
			rect.y -= labelPadding;
			rect.width += labelPadding * 2;
			rect.height += labelPadding * 2;
			if (labelBackground != null) {
				ret.drawShapeFilled(rect, labelBackground);
			}
			if (labelBorder != null) {
				ret.drawShape(rect, labelBorder);
			}
			ret.drawText(labelPoint.getSecondObject(), point, fs);
			ret.drawPoint(p, RGBColour.RED, (int) ternaryData.value);
		}
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:40,代码来源:TernaryPlot.java

示例6: drawMarker

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public void drawMarker( final TimelineMarker m, final MBFImage image, final int x, final int h )
{
	image.drawLine( x, 0, x, h, m.colour );

	final int fw = 20;
	final int fh = 10;
	image.drawShapeFilled( new Rectangle( x, 4, fw+4, fh + 4 ), m.colour );

	// TODO: Need to draw the label
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:12,代码来源:Timeline.java

示例7: testRenderMBF

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Test
public void testRenderMBF() throws Exception {
	final int width = 100;
	final int height = 100;
	final SVGRenderer renderer = new SVGRenderer(null, new SVGRenderHints(width, height));
	final MBFImage out = new MBFImage(width, height, ColourSpace.RGB);
	out.drawLine(0, 0, 10, 10, 1, RGBColour.RED);
	out.drawShape(new Circle(50, 50, 50), RGBColour.GREEN);
	out.drawShapeFilled(new Circle(50, 50, 20), RGBColour.GREEN);

	renderer.drawOIImage(out);
	// SVGGraphics2D svgG = renderer.getGraphics2D();
	// svgG.

	final File f = folder.newFile("out.svg");
	final Writer w = new OutputStreamWriter(new FileOutputStream(f));
	renderer.write(w);
	// Writer w = new OutputStreamWriter(System.out);
	//
	w.flush();
	w.close();
	//
	final BufferedImageTranscoder t = new BufferedImageTranscoder();
	t.addTranscodingHint(PNGTranscoder.KEY_WIDTH, (float) width);
	t.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, (float) height);
	final TranscoderInput input = new TranscoderInput(new FileInputStream(f));
	t.transcode(input, null);
	// DisplayUtilities.display(t.getBufferedImage());
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:30,代码来源:TestSVGRenderer.java

示例8: drawTarget

import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
private void drawTarget(MBFImage image, Point2d point) {
	image.drawShapeFilled(new Rectangle(point.getX() - 5, point.getY() - 5, 10, 10), RGBColour.RED);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:4,代码来源:TouchTableScreen.java


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