本文整理汇总了Java中org.openimaj.image.ImageUtilities.createBufferedImage方法的典型用法代码示例。如果您正苦于以下问题:Java ImageUtilities.createBufferedImage方法的具体用法?Java ImageUtilities.createBufferedImage怎么用?Java ImageUtilities.createBufferedImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openimaj.image.ImageUtilities
的用法示例。
在下文中一共展示了ImageUtilities.createBufferedImage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applySimulation
import org.openimaj.image.ImageUtilities; //导入方法依赖的package包/类
@Override
public MBFImage applySimulation(MBFImage input) {
try {
Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName("jpeg");
ImageWriter writer = iter.next();
ImageWriteParam iwp = writer.getDefaultWriteParam();
iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
float compressionFactor = this.randomFloatInRange(minCompression, maxCompression);
iwp.setCompressionQuality(compressionFactor);
ByteArrayOutputStream output = new ByteArrayOutputStream();
writer.setOutput(new MemoryCacheImageOutputStream(output));
IIOImage image = new IIOImage(ImageUtilities.createBufferedImage(input), null, null);
writer.write(null, image, iwp);
return ImageUtilities.readMBF(new ByteArrayInputStream(output.toByteArray()));
} catch (IOException e) {
throw new Error(e);
}
}
示例2: writeToSequence
import org.openimaj.image.ImageUtilities; //导入方法依赖的package包/类
/**
* Write an image to the sequence
*
* @param img
* @throws IOException
*/
public void writeToSequence(Image<?, ?> img) throws IOException {
BufferedImage bimg = ImageUtilities.createBufferedImage(img);
if(delayedInit){
init(outputStream, bimg.getType(), timeBetweenFramesMS, loopContinuously);
}
writeToSequence(bimg);
}
示例3: drawOIImage
import org.openimaj.image.ImageUtilities; //导入方法依赖的package包/类
public void drawOIImage(Image<?, ?> im) {
final BufferedImage createBufferedImage = ImageUtilities.createBufferedImage(im);
this.svgGen.drawImage(createBufferedImage, 0, 0, this.colorFromFloats(this.defaultBackgroundColour()),
new ImageObserver() {
@Override
public boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height) {
return true;
}
});
}
示例4: main
import org.openimaj.image.ImageUtilities; //导入方法依赖的package包/类
/**
* Just for testing render quality against AWT
*
* @param args
*/
public static void main(String[] args) {
final FImage tmp = new FImage(800, 800);
final int size = 40;
tmp.drawText("Hello World!", 20, 20 + size, new GeneralFont("Arial", Font.PLAIN), size);
final GeneralFontStyle<Float> gfs = new GeneralFontStyle<Float>(new GeneralFont("Arial", Font.PLAIN),
tmp.createRenderer(RenderHints.ANTI_ALIASED));
gfs.setFontSize(size);
final Polygon[] polys = getPolygons("Hello World!", 20, 20 + 2 * size, gfs);
for (final Polygon p : polys)
tmp.drawPolygon(p, 1f);
final Font fnt = new Font("Arial", Font.PLAIN, size);
final BufferedImage bimg = ImageUtilities.createBufferedImage(tmp);
final Graphics g = bimg.getGraphics();
g.setFont(fnt);
g.drawString("Hello World!", 20, 20 + 3 * size);
final GlyphVector gl = fnt.createGlyphVector(new FontRenderContext(null, true, true),
"Hello World!");
for (int i = 0; i < gl.getNumGlyphs(); i++) {
((Graphics2D) g).fill(gl.getGlyphOutline(i, 20, 20 + 4 * size));
}
DisplayUtilities.display(bimg);
}
示例5: addFrame
import org.openimaj.image.ImageUtilities; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* @see org.openimaj.video.VideoWriter#addFrame(org.openimaj.image.Image)
*/
@Override
public void addFrame( MBFImage frame )
{
// Create a buffered image for Xuggler
BufferedImage f = ImageUtilities.createBufferedImage( frame );
f = convertToType( f, BufferedImage.TYPE_3BYTE_BGR );
// Encode the image to the video stream
this.writer.encodeVideo( 0, f, nextFrameTime, DEFAULT_TIME_UNIT );
// Set up the next timecode
this.nextFrameTime += this.interFrameTime;
}