本文整理汇总了Java中org.openimaj.image.MBFImage.extractROI方法的典型用法代码示例。如果您正苦于以下问题:Java MBFImage.extractROI方法的具体用法?Java MBFImage.extractROI怎么用?Java MBFImage.extractROI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openimaj.image.MBFImage
的用法示例。
在下文中一共展示了MBFImage.extractROI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applySimulation
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
@Override
public MBFImage applySimulation(MBFImage input) {
int width = randomIntInRange((int) (minWidth*input.getWidth()), input.getWidth());
int height = randomIntInRange((int) (minHeight*input.getHeight()), input.getHeight());
int x = random.nextInt(input.getWidth() - width);
int y = random.nextInt(input.getHeight() - height);
return input.extractROI(x, y, width, height);
}
示例2: extractContent
import org.openimaj.image.MBFImage; //导入方法依赖的package包/类
/**
* Extract content.
* @throws IOException
*/
public void extractContent() throws IOException {
if (!extractor.load(url)) {
System.err.println("Error loading page: " + url);
System.exit(1);
}
if (layoutFile != null) writeLayout();
if (thumbnailFile != null) {
MBFImage image = getRender();
//crop first if its very long
if (image.getHeight() > 1.5 * image.getWidth()) {
image = image.extractROI(0, 0, image.getWidth(), image.getWidth());
}
MBFImage thumb = image.process(new ResizeProcessor(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT));
ImageUtilities.write(thumb, thumbnailFile);
}
if (renderFile != null) {
ImageUtilities.write(getRender(), renderFile);
}
if (layoutRender != null) {
ImageUtilities.write(extractor.renderLayoutInfo(RGBColour.BLACK), layoutRender);
}
if (layoutRenderOverlayed != null) {
ImageUtilities.write(extractor.renderLayoutInfo(getRender(), RGBColour.RED), layoutRenderOverlayed);
}
if (contentLayoutRender != null) {
ImageUtilities.write(extractor.renderContentLayout(CONTENT_COLOUR, NON_CONTENT_INSIDE_COLOUR, NON_CONTENT_COLOUR), contentLayoutRender);
}
if (contentLayoutRenderOverlayed != null) {
ImageUtilities.write(extractor.renderContentLayout(getRender(), CONTENT_COLOUR, NON_CONTENT_INSIDE_COLOUR, NON_CONTENT_COLOUR), contentLayoutRenderOverlayed);
}
}