• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PointMatch类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中mpicbg.models.PointMatch的典型用法代码示例。如果您正苦于以下问题:Java PointMatch类的具体用法?Java PointMatch怎么用?Java PointMatch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: convertMatchesToLocal

import mpicbg.models.PointMatch; //导入依赖的package包/类
public static List<PointMatch> convertMatchesToLocal(final List<PointMatch> worldMatchList,
                                               final TileSpec pMatchTileSpec,
                                               final TileSpec qMatchTileSpec) {

    final List<PointMatch> localMatchList = new ArrayList<>(worldMatchList.size());
    Point pPoint;
    Point qPoint;
    for (final PointMatch worldMatch : worldMatchList) {
        try {
            pPoint = getLocalPoint(worldMatch.getP1(), pMatchTileSpec);
            qPoint = getLocalPoint(worldMatch.getP2(), qMatchTileSpec);
            localMatchList.add(new PointMatch(pPoint, qPoint));
        } catch (final NoninvertibleModelException e) {
            LOG.warn("skipping match", e);
        }
    }
    return localMatchList;
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:19,代码来源:ResidualCalculator.java


示例2: sampleAverageScale

import mpicbg.models.PointMatch; //导入依赖的package包/类
/**
 * Sample the average scaling of a given {@link CoordinateTransform} by transferring a set of point samples using
 * the {@link CoordinateTransform} and then least-squares fitting a {@link SimilarityModel2D} to it.
 *
 * @param width  of the samples set
 * @param height of the samples set
 * @param dx     spacing between samples
 *
 * @return average scale factor
 */
public static double sampleAverageScale(final CoordinateTransform ct,
                                        final int width,
                                        final int height,
                                        final double dx) {
    final ArrayList<PointMatch> samples = new ArrayList<>();
    for (double y = 0; y < height; y += dx) {
        for (double x = 0; x < width; x += dx) {
            final Point p = new Point(new double[]{x, y});
            p.apply(ct);
            samples.add(new PointMatch(p, p));
        }
    }
    final AffineModel2D model = new AffineModel2D();
    try {
        model.fit(samples);
    } catch (final NotEnoughDataPointsException | IllDefinedDataPointsException e) {
        LOG.warn("failed to fit samples, returning scale factor of 1", e);
        return 1;
    }
    final double[] data = new double[6];
    model.toArray(data);
    // return 1;
    return Math.sqrt(Math.max(data[0] * data[0] + data[1] * data[1], data[2] * data[2] + data[3] * data[3]));
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:35,代码来源:Utils.java


示例3: testRANSACFilterWithMinValue

import mpicbg.models.PointMatch; //导入依赖的package包/类
private void testRANSACFilterWithMinValue(final List<PointMatch> candidates,
                                          final int minNumInliers,
                                          final int expectedInliersSizeAfterFilter)
        throws NotEnoughDataPointsException {

    final List<PointMatch> inliers = new ArrayList<>();

    final int iterations = 1000;
    final float maxEpsilon = 20f;
    final float minInlierRatio = 0.0f;
    final float maxTrust = 3.0f;

    final AffineModel2D model = new AffineModel2D();

    model.filterRansac(candidates,
                       inliers,
                       iterations,
                       maxEpsilon,
                       minInlierRatio,
                       minNumInliers,
                       maxTrust);

    Assert.assertEquals("invalid number of inliers found with min " + minNumInliers,
                        expectedInliersSizeAfterFilter, inliers.size());
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:26,代码来源:CanvasFeatureMatcherTest.java


示例4: calculateBoundingBox

import mpicbg.models.PointMatch; //导入依赖的package包/类
/**
 * 
 * @param pm PointMatches
 * @param min x = min[0], y = min[1]
 * @param max x = max[0], y = max[1]
 */
final static protected void calculateBoundingBox(
		final ArrayList< PointMatch > pm,
		final float[] min,
		final float[] max )
{
	final float[] first = pm.get( 0 ).getP2().getW();
	min[ 0 ] = first[ 0 ];
	min[ 1 ] = first[ 1 ];
	max[ 0 ] = first[ 0 ];
	max[ 1 ] = first[ 1 ];
	
	for ( final PointMatch p : pm )
	{
		final float[] t = p.getP2().getW();
		if ( t[ 0 ] < min[ 0 ] ) min[ 0 ] = t[ 0 ];
		else if ( t[ 0 ] > max[ 0 ] ) max[ 0 ] = t[ 0 ];
		if ( t[ 1 ] < min[ 1 ] ) min[ 1 ] = t[ 1 ];
		else if ( t[ 1 ] > max[ 1 ] ) max[ 1 ] = t[ 1 ];
	}
}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:27,代码来源:CrackTransformMeshMapping.java


示例5: calculateBoundingBoxInverse

import mpicbg.models.PointMatch; //导入依赖的package包/类
/**
 * 
 * @param pm PointMatches
 * @param min x = min[0], y = min[1]
 * @param max x = max[0], y = max[1]
 */
final static protected void calculateBoundingBoxInverse(
		final ArrayList< PointMatch > pm,
		final float[] min,
		final float[] max )
{
	final float[] first = pm.get( 0 ).getP1().getL();
	min[ 0 ] = first[ 0 ];
	min[ 1 ] = first[ 1 ];
	max[ 0 ] = first[ 0 ];
	max[ 1 ] = first[ 1 ];
	
	for ( final PointMatch p : pm )
	{
		final float[] t = p.getP1().getL();
		if ( t[ 0 ] < min[ 0 ] ) min[ 0 ] = t[ 0 ];
		else if ( t[ 0 ] > max[ 0 ] ) max[ 0 ] = t[ 0 ];
		if ( t[ 1 ] < min[ 1 ] ) min[ 1 ] = t[ 1 ];
		else if ( t[ 1 ] > max[ 1 ] ) max[ 1 ] = t[ 1 ];
	}
}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:27,代码来源:CrackTransformMeshMapping.java


示例6: updateWithDections

import mpicbg.models.PointMatch; //导入依赖的package包/类
/**
 * Apply the current {@link Model} to all local point coordinates.
 * Update {@link #cost} and {@link #distance}.
 *
 */
final public void updateWithDections()
{
	// call the original method
	update();
	
	if ( matches.size() > 0 )
	{
		for ( final PointMatch match : matches )
		{
			final double dl = match.getDistance();
			((AbstractDetection<?>)match.getP1()).setDistance( (float)dl );
			((AbstractDetection<?>)match.getP2()).setDistance( (float)dl );				
		}
	}

}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:22,代码来源:TileSPIM.java


示例7: assignPointMatches

import mpicbg.models.PointMatch; //导入依赖的package包/类
@Override
public ArrayList<PointMatch> assignPointMatches( final List<P> target, final List<P> reference )
{
	final ArrayList<PointMatch> pointMatches = new ArrayList<PointMatch>();

	final KDTree<P> kdTreeTarget = new KDTree<P>( target );
	final NearestNeighborSearch<P> nnSearchTarget = new NearestNeighborSearch<P>( kdTreeTarget );

	for ( final P point : reference )
	{
		final P correspondingPoint = nnSearchTarget.findNearestNeighbor( point );

		if ( correspondingPoint.distanceTo( point ) <= distanceThresold )
			pointMatches.add( new PointMatch ( correspondingPoint, point ) );
	}

	return pointMatches;
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:19,代码来源:SimplePointMatchIdentification.java


示例8: estimateIntialModel

import mpicbg.models.PointMatch; //导入依赖的package包/类
/**
 * Estimates an initial {@link Model} based on some given {@link PointMatch}es. Note that the {@link PointMatch}es have to be stored as PointMatch(target,reference). 
 * 
 * @param matches - The {@link List} of apriori known {@link PointMatch}es
 * @param model - The {@link Model} to use
 * @throws NotEnoughDataPointsException
 * @throws IllDefinedDataPointsException
 */
public void estimateIntialModel( final List<PointMatch> matches, final Model<?> model ) throws NotEnoughDataPointsException, IllDefinedDataPointsException
{
	/* remove ambigous correspondences */
	ambigousMatches = removeAmbigousMatches( matches );
	
	/* fit the model */
	model.fit( matches );

	/* apply the new model of the target to determine the error */
	for ( final P point : target )
		point.apply( model );

	/* compute the output */
	avgError = PointMatch.meanDistance( matches );
	maxError = PointMatch.maxDistance( matches );
	numMatches = matches.size();
	pointMatches = matches;		
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:27,代码来源:ICP.java


示例9: getSimilarity

import mpicbg.models.PointMatch; //导入依赖的package包/类
@Override
public double getSimilarity( final ArrayList<PointMatch> matches )
{
	final int numDimensions = matches.get( 0 ).getP1().getL().length;
	
	double difference = 0;
	
	for ( final PointMatch match : matches )
	{
		final double[] t1 = match.getP2().getW();
		final double[] t2 = match.getP1().getW();
	
		for ( int d = 0; d < numDimensions; ++d )
			difference += Math.abs( t1[ d ] - t2[ d ] );
	}
					
	return difference / (double)numDimensions;		
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:19,代码来源:ManhattanDistance.java


示例10: createCandidates

import mpicbg.models.PointMatch; //导入依赖的package包/类
@Override
public ArrayList<ArrayList<PointMatch>> createCandidates( final AbstractPointDescriptor<?, ?> pd1, final AbstractPointDescriptor<?, ?> pd2 )
{
	final ArrayList<ArrayList<PointMatch>> matchesList = new ArrayList<ArrayList<PointMatch>>();

	for ( int a = 0; a < numCombinations; ++a )
		for ( int b = 0; b < numCombinations; ++b )
		{
			final ArrayList<PointMatch> matches = new ArrayList<PointMatch>( subsetSize );

			for ( int i = 0; i < subsetSize; ++i )
			{
				final PointMatch pointMatch = new PointMatch( pd1.getDescriptorPoint( neighbors[ a ][ i ] ), pd2.getDescriptorPoint( neighbors[ b ][ i ] ) );
				matches.add( pointMatch );
			}

			matchesList.add( matches );

		}

	return matchesList;
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:23,代码来源:SubsetMatcher.java


示例11: createCandidates

import mpicbg.models.PointMatch; //导入依赖的package包/类
@Override
public ArrayList<ArrayList<PointMatch>> createCandidates( final AbstractPointDescriptor<?, ?> pd1, final AbstractPointDescriptor<?, ?> pd2 )
{
	final ArrayList<PointMatch> matches = new ArrayList<PointMatch>( numNeighbors );		
	
	for ( int i = 0; i < numNeighbors; ++i )
	{
		final PointMatch pointMatch = new PointMatch( pd1.getDescriptorPoint( i ), pd2.getDescriptorPoint( i ) );
		matches.add( pointMatch );
	}		

	final ArrayList<ArrayList<PointMatch>> matchesList = new ArrayList<ArrayList<PointMatch>>();		
	matchesList.add( matches );
	
	return matchesList;
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:17,代码来源:SimpleMatcher.java


示例12: fit

import mpicbg.models.PointMatch; //导入依赖的package包/类
/**
 * Closed form weighted least squares solution as described by
 * \citet{SchaeferAl06} and implemented by Johannes Schindelin.
 */
@Override
final public < P extends PointMatch >void fit( final Collection< P > matches )
	throws NotEnoughDataPointsException
{
	if ( matches.size() < MIN_NUM_MATCHES ) throw new NotEnoughDataPointsException( matches.size() + " data points are not enough to estimate a 2d rigid model, at least " + MIN_NUM_MATCHES + " data points required." );

	cos = 0;
	sin = 0;
	for ( final P m : matches )
	{
		final double[] p = m.getP1().getL();
		final double[] q = m.getP2().getW();
		final double w = m.getWeight();

		final double x1 = p[ 0 ];
		final double y1 = p[ 1 ]; // x2
		final double x2 = q[ 0 ]; // y1
		final double y2 = q[ 1 ]; // y2
		sin += w * ( x1 * y2 - y1 * x2 ); //   x1 * y2 - x2 * y1 // assuming p1 is x1,x2 and p2 is y1,y2
		cos += w * ( x1 * x2 + y1 * y2 ); //   x1 * y1 + x2 * y2
	}
	final double norm = Math.sqrt( cos * cos + sin * sin );
	cos /= norm;
	sin /= norm;
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:30,代码来源:TranslationInvariantRigidModel2D.java


示例13: minMax

import mpicbg.models.PointMatch; //导入依赖的package包/类
final static protected double[] minMax( final Iterable< PointMatch > matches )
{
	final Iterator< PointMatch > iter = matches.iterator();
	PointMatch m = iter.next();
	double min = m.getP1().getL()[ 0 ], max = min;
	while ( iter.hasNext() )
	{
		m = iter.next();
		final double x = m.getP1().getL()[ 0 ];
		if ( x < min )
			min = x;
		else if ( x > max )
			max = x;
	}
	return new double[]{ min, max };
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:17,代码来源:RansacRegressionReduceFilter.java


示例14: filter

import mpicbg.models.PointMatch; //导入依赖的package包/类
@Override
public void filter( List< PointMatch > candidates, Collection< PointMatch > inliers )
{
	try
	{
		if (
			!model.filterRansac(
					candidates,
					inliers,
					iterations,
					maxEpsilon,
					minInlierRatio,
					minNumInliers,
					maxTrust ) )
			inliers.clear();
	}
	catch ( Exception e )
	{
		inliers.clear();
	}
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:22,代码来源:RansacRegressionFilter.java


示例15: fit

import mpicbg.models.PointMatch; //导入依赖的package包/类
@Override
   public < P extends PointMatch >void fit(final Collection< P > matches)
		throws NotEnoughDataPointsException, IllDefinedDataPointsException
{

	final Stack< java.awt.Point > sourcePoints = new Stack<java.awt.Point>();
	final Stack< java.awt.Point > targetPoints = new Stack<java.awt.Point>();

	for ( final P pm : matches )
	{
		final double[] p1 = pm.getP1().getL();
		final double[] p2 = pm.getP2().getL();

		targetPoints.add( new java.awt.Point( ( int )Math.round( p1[ 0 ] ), ( int )Math.round( p1[ 1 ] ) ) );
		sourcePoints.add( new java.awt.Point( ( int )Math.round( p2[ 0 ] ), ( int )Math.round( p2[ 1 ] ) ) );
	}

	final Transformation transf = bUnwarpJ_.computeTransformationBatch(sourceWidth,
			sourceHeight, width, height, sourcePoints, targetPoints, parameter);
	this.set(transf.getIntervals(), transf.getDirectDeformationCoefficientsX(),
			transf.getDirectDeformationCoefficientsY(), width, height);
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:23,代码来源:CubicBSplineTransform.java


示例16: findModel

import mpicbg.models.PointMatch; //导入依赖的package包/类
final static public boolean findModel(
		final Model< ? > model,
		final List< PointMatch > candidates,
		final Collection< PointMatch > inliers,
		final float maxEpsilon,
		final float minInlierRatio,
		final int minNumInliers,
		final boolean rejectIdentity,
		final float identityTolerance )
{
	return findModel(
			model,
			candidates,
			inliers,
			maxEpsilon,
			minInlierRatio,
			minNumInliers,
			rejectIdentity,
			identityTolerance,
			false );
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:22,代码来源:Align.java


示例17: serializePointMatches

import mpicbg.models.PointMatch; //导入依赖的package包/类
/**
 * Save a {@link Collection} of {@link PointMatch PointMatches} two-sided.
 * Creates two serialization files which is desperately required to clean
 * up properly invalid serializations on change of a {@link Patch}.
 *
 * @param p
 * @param t1
 * @param t2
 * @param m
 * @return
 */
final static protected boolean serializePointMatches(
		final Param p,
		final AbstractAffineTile2D< ? > t1,
		final AbstractAffineTile2D< ? > t2,
		final Collection< PointMatch > m )
{
	final ArrayList< PointMatch > list = new ArrayList< PointMatch >();
	list.addAll( m );
	final ArrayList< PointMatch > tsil = new ArrayList< PointMatch >();
	PointMatch.flip( m, tsil );
	final Patch p1 = t1.getPatch();
	final Patch p2 = t2.getPatch();
	final Loader loader = p1.getProject().getLoader();
	return
		loader.serialize(
			new PointMatches( p, list ),
			new StringBuilder( loader.getUNUIdFolder() ).append( "pointmatches.ser/" ).append( FSLoader.createIdPath( Long.toString( p1.getId() ) + "_" + Long.toString( p2.getId() ), "pointmatches", ".ser" ) ).toString() ) &&
		loader.serialize(
			new PointMatches( p, tsil ),
			new StringBuilder( loader.getUNUIdFolder() ).append( "pointmatches.ser/" ).append( FSLoader.createIdPath( Long.toString( p2.getId() ) + "_" + Long.toString( p1.getId() ), "pointmatches", ".ser" ) ).toString() );
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:33,代码来源:Align.java


示例18: createMLST

import mpicbg.models.PointMatch; //导入依赖的package包/类
/**
 * Temporary helper method that creates
 * @param matches
 * @param alpha
 * @return
 * @throws Exception
 */
final static public MovingLeastSquaresTransform2 createMLST( final Collection< PointMatch > matches, final double alpha ) throws Exception
{
	final MovingLeastSquaresTransform2 mlst = new MovingLeastSquaresTransform2();
	mlst.setAlpha( alpha );
	Class< ? extends AbstractAffineModel2D< ? > > c = AffineModel2D.class;
	switch ( matches.size() )
	{
		case 1:
			c = TranslationModel2D.class;
			break;
		case 2:
			c = SimilarityModel2D.class;
			break;
		default:
			break;
	}
	mlst.setModel( c );
	mlst.setMatches( matches );

	return mlst;
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:29,代码来源:Align.java


示例19: BlockMatchResults

import mpicbg.models.PointMatch; //导入依赖的package包/类
public BlockMatchResults(final Collection<? extends Point> v1,
                         final Collection<? extends Point> v2,
                         final Collection<PointMatch> pm12,
                         final Collection<PointMatch> pm21,
                         final boolean layer1Fixed,
                         final boolean layer2Fixed,
                         final Triple<Integer, Integer, AbstractModel<?>> pair)
{
    this.v1 = v1;
    this.v2 = v2;
    this.pm12 = pm12;
    this.pm21 = pm21;
    this.layer1Fixed = layer1Fixed;
    this.layer2Fixed = layer2Fixed;
    this.pair = pair;
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:17,代码来源:BlockMatchPairCallable.java


示例20: squareP1LocalWidth

import mpicbg.models.PointMatch; //导入依赖的package包/类
/**
 * Return the maximum square distance among any pairwise point
 * distances in the P1 points of a list of point matches.
 * This is a rough estimate of the maximum spatial extent of a point
 * cloud that is used to find the 'widest' cloud.
 *
 * @param matches
 * @return
 */
final static private double squareP1LocalWidth( final List< PointMatch > matches )
{
	double dMax = 0;
	for ( int i = 0; i < matches.size(); ++i )
	{
		final PointMatch m1 = matches.get( i );
		for ( int j = i + 1; j < matches.size(); ++j )
		{
			final PointMatch m2 = matches.get( j );
			final double d = Point.squareLocalDistance( m1.getP1(), m2.getP1() );
			if ( d > dMax )
				dMax = d;
		}
	}
	return dMax;
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:26,代码来源:RegularizedAffineLayerAlignment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PlotOptions类代码示例发布时间:2022-05-23
下一篇:
Java WebUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap