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


Java PointMatch类代码示例

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


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


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