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


Java Rectangle.overlapping方法代码示例

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


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

示例1: tldOverlapNorm

import org.openimaj.math.geometry.shape.Rectangle; //导入方法依赖的package包/类
/**
 * {@link Rectangle#overlapping(Rectangle)} called and normalised by:
 * 
 * @param A
 * @param B
 * @return intersect / (areaA + areaB - intersect)
 */
public static float tldOverlapNorm(Rectangle A, Rectangle B) {
	Rectangle overlap = A.overlapping(B);
	double intersect = overlap == null ? 0 : overlap.calculateArea();
	double areaA = A.calculateArea();
	double areaB = B.calculateArea();
	
	return (float) (intersect / (areaA + areaB - intersect));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:16,代码来源:TLDUtil.java

示例2: trackRedetect

import org.openimaj.math.geometry.shape.Rectangle; //导入方法依赖的package包/类
/**
 * Redetect the faces in the new frame.
 *
 * @param im
 *            The new frame.
 * @param searchAreaSize
 *            The search area size
 */
private void trackRedetect(final FImage im, final float searchAreaSize) {
	final int ww = im.width;
	final int hh = im.height;

	// Resize the frame so processing is quicker.
	this.small_ = ResizeProcessor.resample(im, (int) (MultiTracker.TSCALE * ww),
			(int) (MultiTracker.TSCALE * hh));

	for (final TrackedFace f : this.trackedFaces) {
		f.gen = false;

		// Get the new search area nearby to the last match
		Rectangle searchAreaBounds = f.lastMatchBounds.clone();
		searchAreaBounds.scale((float) MultiTracker.TSCALE);
		searchAreaBounds.scaleCentroid(searchAreaSize);

		if (searchAreaBounds.overlapping(this.small_.getBounds()) != null)
			searchAreaBounds = searchAreaBounds.overlapping(this.small_.getBounds());
		else
			searchAreaBounds = this.small_.getBounds();

		// Get the search image
		final FImage searchArea = this.small_.extractROI(searchAreaBounds);

		// Template match the template over the reduced size image.
		final FourierTemplateMatcher matcher = new FourierTemplateMatcher(
				f.templateImage,
				FourierTemplateMatcher.Mode.NORM_CORRELATION_COEFFICIENT);
		matcher.analyseImage(searchArea);

		// Get the response map
		final float[][] ncc_ = matcher.getResponseMap().pixels;

		// DisplayUtilities.displayName( matcher.getResponseMap(),
		// "responseMap" );
		// DisplayUtilities.displayName( f.templateImage, "template" );

		f.redetectedBounds = f.templateImage.getBounds();

		// Find the maximum template match in the image
		final int h = searchArea.height - f.templateImage.height + 1;
		final int w = searchArea.width - f.templateImage.width + 1;
		float vb = -2;
		for (int y = 0; y < h; y++) {
			for (int x = 0; x < w; x++) {
				final float v = ncc_[y][x];
				if (v > vb) {
					vb = v;
					f.redetectedBounds.x = x + searchAreaBounds.x;
					f.redetectedBounds.y = y + searchAreaBounds.y;
				}
			}
		}

		// Rescale the rectangle to full-size image coordinates.
		f.redetectedBounds.scale((float) (1d / MultiTracker.TSCALE));
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:67,代码来源:MultiTracker.java


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