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


Java AffineModel2D.applyInverseInPlace方法代码示例

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


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

示例1: mapTriangle

import mpicbg.models.AffineModel2D; //导入方法依赖的package包/类
final static protected void mapTriangle(
		final CrackTransformMesh m, 
		final AffineModel2D ai,
		final ImageProcessor source,
		final ImageProcessor target )
{
	final int w = target.getWidth() - 1;
	final int h = target.getHeight() - 1;
	final ArrayList< PointMatch > pm = m.getAV().get( ai );
	final float[] min = new float[ 2 ];
	final float[] max = new float[ 2 ];
	calculateBoundingBox( pm, min, max );
	final int minX = Math.max( 0, Util.roundPos( min[ 0 ] ) );
	final int minY = Math.max( 0, Util.roundPos( min[ 1 ] ) );
	final int maxX = Math.min( w, Util.roundPos( max[ 0 ] ) );
	final int maxY = Math.min( h, Util.roundPos( max[ 1 ] ) );
	
	final float[] a = pm.get( 0 ).getP2().getW();
	final float ax = a[ 0 ];
	final float ay = a[ 1 ];
	final float[] b = pm.get( 1 ).getP2().getW();
	final float bx = b[ 0 ];
	final float by = b[ 1 ];
	final float[] c = pm.get( 2 ).getP2().getW();
	final float cx = c[ 0 ];
	final float cy = c[ 1 ];
	final float[] t = new float[ 2 ];
	for ( int y = minY; y <= maxY; ++y )
	{
		for ( int x = minX; x <= maxX; ++x )
		{
			if ( isInTriangle( ax, ay, bx, by, cx, cy, x, y ) )
			{
				t[ 0 ] = x;
				t[ 1 ] = y;
				try
				{
					ai.applyInverseInPlace( t );
				}
				catch ( Exception e )
				{
					//e.printStackTrace( System.err );
					continue;
				}
				target.putPixel( x, y, source.getPixel( ( int )( t[ 0 ] + 0.5f ), ( int )( t[ 1 ] + 0.5f ) ) );
			}
		}
	}
}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:50,代码来源:CrackTransformMeshMapping.java

示例2: mapTriangleInterpolated

import mpicbg.models.AffineModel2D; //导入方法依赖的package包/类
final static protected void mapTriangleInterpolated(
			final CrackTransformMesh m, 
			final Collection<AffineModel2D> aiList,
			final ImageProcessor source,
			final ImageProcessor target )
	{
		final int w = target.getWidth() - 1;
		final int h = target.getHeight() - 1;

		final float[] t = new float[ 2 ];
		for ( int y = 0; y <= h; ++y )
		{
			for ( int x = 0; x <= w; ++x )
			{
				
				//boolean hitThis = false;
				boolean inTriangle = false;
				for( AffineModel2D ai : aiList ){
					
					ArrayList< PointMatch > pm = m.getAV().get( ai );
					
					float[] a = pm.get( 0 ).getP2().getW();
					float ax = a[ 0 ];
					float ay = a[ 1 ];
					float[] b = pm.get( 1 ).getP2().getW();
					float bx = b[ 0 ];
					float by = b[ 1 ];
					float[] c = pm.get( 2 ).getP2().getW();
					float cx = c[ 0 ];
					float cy = c[ 1 ];
					
					if ( isInTriangle( ax, ay, bx, by, cx, cy, x, y ) )
					{
						
						boolean isInCrack = m.getAC().get(ai).booleanValue();
//						if( isInCrack ){
//							System.out.println(" crack-tastic\n"  +
//							"("+ax + "," + ay + ")  (" + bx + ","+by+")  (" + cx+","+cy +")");
//						}
						
						t[ 0 ] = x;
						t[ 1 ] = y;
						try
						{
							ai.applyInverseInPlace( t );
						}
						catch ( Exception e )
						{
							//e.printStackTrace( System.err );
							System.out.println(" error at " + x + " " + y );
							continue;
						}
						
//						if( hitThis ){
//							System.out.println(" doubled up ");
//						}
						
						if( isInCrack ){
							target.putPixel( x, y, 0 );
							//hitThis = true;
						}else{
							target.putPixel( x, y, source.getPixelInterpolated( t[ 0 ], t[ 1 ] ) );
							//hitThis = true;
						}
						
						if( x == 109 && y ==95){
							ax += 0f;
						}
						
						inTriangle = true;
					}
				}
				
				if( !inTriangle ){
					target.putPixel( x, y, source.getPixel( x, y ) );
				}
			}
		}
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:80,代码来源:CrackTransformMeshMapping.java

示例3: mapMask

import mpicbg.models.AffineModel2D; //导入方法依赖的package包/类
final static protected <T extends NumericType<T>> void mapMask(
			final CrackTransformMesh m, 
			final IterableInterval<T> target)
	{
		Cursor<T> curs = target.cursor();
		Set<AffineModel2D> aiList = m.av.keySet();

		final float[] t = new float[ 2 ];
		while( curs.hasNext() )
		{
			curs.fwd();
			curs.localize( t );
			
			float x = t[0];
			float y = t[1];
			
			for( AffineModel2D ai : aiList ){

				ArrayList< PointMatch > pm = m.getAV().get( ai );

				float[] a = pm.get( 0 ).getP2().getW();
				float ax = a[ 0 ];
				float ay = a[ 1 ];
				float[] b = pm.get( 1 ).getP2().getW();
				float bx = b[ 0 ];
				float by = b[ 1 ];
				float[] c = pm.get( 2 ).getP2().getW();
				float cx = c[ 0 ];
				float cy = c[ 1 ];

				if ( isInTriangle( ax, ay, bx, by, cx, cy, x, y ) )
				{

					boolean isInCrack = m.getAC().get(ai).booleanValue();

					try
					{
						ai.applyInverseInPlace( t );
					}
					catch ( Exception e )
					{
						//e.printStackTrace( System.err );
//						System.out.println(" error at " + x + " " + y );
						continue;
					}

					if( isInCrack ){
						curs.get().setOne();
						curs.get().mul( 255 );
					
					}
				}
			}
		}
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:56,代码来源:CrackTransformMeshMapping.java

示例4: mapTriangle

import mpicbg.models.AffineModel2D; //导入方法依赖的package包/类
final static protected void mapTriangle(
		final TransformMesh m,
		final AffineModel2D ai,
		final ImageProcessor source,
		final ImageProcessor target,
		final ByteProcessor targetOutside )
{
	final int w = target.getWidth() - 1;
	final int h = target.getHeight() - 1;
	final ArrayList< PointMatch > pm = m.getAV().get( ai );
	final double[] min = new double[ 2 ];
	final double[] max = new double[ 2 ];
	calculateBoundingBox( pm, min, max );

	final int minX = Math.max( 0, Util.roundPos( min[ 0 ] ) );
	final int minY = Math.max( 0, Util.roundPos( min[ 1 ] ) );
	final int maxX = Math.min( w, Util.roundPos( max[ 0 ] ) );
	final int maxY = Math.min( h, Util.roundPos( max[ 1 ] ) );

	final double[] a = pm.get( 0 ).getP2().getW();
	final double ax = a[ 0 ];
	final double ay = a[ 1 ];
	final double[] b = pm.get( 1 ).getP2().getW();
	final double bx = b[ 0 ];
	final double by = b[ 1 ];
	final double[] c = pm.get( 2 ).getP2().getW();
	final double cx = c[ 0 ];
	final double cy = c[ 1 ];
	final double[] t = new double[ 2 ];
	for ( int y = minY; y <= maxY; ++y )
	{
		for ( int x = minX; x <= maxX; ++x )
		{
			if ( isInTriangle( ax, ay, bx, by, cx, cy, x, y ) )
			{
				t[ 0 ] = x;
				t[ 1 ] = y;
				try
				{
					ai.applyInverseInPlace( t );
				}
				catch ( final Exception e )
				{
					//e.printStackTrace( System.err );
					continue;
				}
				target.set( x, y, source.getPixel( ( int )( t[ 0 ] + 0.5f ), ( int )( t[ 1 ] + 0.5f ) ) );
				targetOutside.set( x, y, 0xff );
			}
		}
	}
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:53,代码来源:TransformMeshMappingWithMasks.java

示例5: mapTriangleInterpolated

import mpicbg.models.AffineModel2D; //导入方法依赖的package包/类
final static protected void mapTriangleInterpolated(
		final TransformMesh m,
		final AffineModel2D ai,
		final ImageProcessor source,
		final ImageProcessor target,
		final ByteProcessor targetOutside )
{
	final int w = target.getWidth() - 1;
	final int h = target.getHeight() - 1;
	final ArrayList< PointMatch > pm = m.getAV().get( ai );
	final double[] min = new double[ 2 ];
	final double[] max = new double[ 2 ];
	calculateBoundingBox( pm, min, max );

	final int minX = Math.max( 0, Util.roundPos( min[ 0 ] ) );
	final int minY = Math.max( 0, Util.roundPos( min[ 1 ] ) );
	final int maxX = Math.min( w, Util.roundPos( max[ 0 ] ) );
	final int maxY = Math.min( h, Util.roundPos( max[ 1 ] ) );

	final double[] a = pm.get( 0 ).getP2().getW();
	final double ax = a[ 0 ];
	final double ay = a[ 1 ];
	final double[] b = pm.get( 1 ).getP2().getW();
	final double bx = b[ 0 ];
	final double by = b[ 1 ];
	final double[] c = pm.get( 2 ).getP2().getW();
	final double cx = c[ 0 ];
	final double cy = c[ 1 ];
	final double[] t = new double[ 2 ];
	for ( int y = minY; y <= maxY; ++y )
	{
		for ( int x = minX; x <= maxX; ++x )
		{
			if ( isInTriangle( ax, ay, bx, by, cx, cy, x, y ) )
			{
				t[ 0 ] = x;
				t[ 1 ] = y;
				try
				{
					ai.applyInverseInPlace( t );
				}
				catch ( final Exception e )
				{
					//e.printStackTrace( System.err );
					continue;
				}
				target.set( x, y, source.getPixelInterpolated( t[ 0 ], t[ 1 ] ) );
				targetOutside.set( x, y, 0xff );
			}
		}
	}
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:53,代码来源:TransformMeshMappingWithMasks.java

示例6: mapShortAlphaTriangle

import mpicbg.models.AffineModel2D; //导入方法依赖的package包/类
final static protected void mapShortAlphaTriangle(
		final TransformMesh m,
		final AffineModel2D ai,
		final ShortProcessor source,
		final ByteProcessor alpha,
		final ShortProcessor target )
{
	final int w = target.getWidth() - 1;
	final int h = target.getHeight() - 1;
	final ArrayList< PointMatch > pm = m.getAV().get( ai );
	final double[] min = new double[ 2 ];
	final double[] max = new double[ 2 ];
	calculateBoundingBox( pm, min, max );

	final int minX = Math.max( 0, Util.roundPos( min[ 0 ] ) );
	final int minY = Math.max( 0, Util.roundPos( min[ 1 ] ) );
	final int maxX = Math.min( w, Util.roundPos( max[ 0 ] ) );
	final int maxY = Math.min( h, Util.roundPos( max[ 1 ] ) );

	final double[] a = pm.get( 0 ).getP2().getW();
	final double ax = a[ 0 ];
	final double ay = a[ 1 ];
	final double[] b = pm.get( 1 ).getP2().getW();
	final double bx = b[ 0 ];
	final double by = b[ 1 ];
	final double[] c = pm.get( 2 ).getP2().getW();
	final double cx = c[ 0 ];
	final double cy = c[ 1 ];
	final double[] t = new double[ 2 ];
	for ( int y = minY; y <= maxY; ++y )
	{
		for ( int x = minX; x <= maxX; ++x )
		{
			if ( isInTriangle( ax, ay, bx, by, cx, cy, x, y ) )
			{
				t[ 0 ] = x;
				t[ 1 ] = y;
				try
				{
					ai.applyInverseInPlace( t );
				}
				catch ( final Exception e )
				{
					//e.printStackTrace( System.err );
					continue;
				}
				final int is = source.getPixelInterpolated( t[ 0 ], t[ 1 ] );
				final int it = target.get( x, y );
				final double f = alpha.getPixelInterpolated( t[ 0 ], t[ 1 ] ) / 255.0;
				final double v = it + f  * ( is - it );
				target.set( x, y, ( int )Math.max(  0, Math.min( 65535, Math.round( v ) ) ) );
			}
		}
	}
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:56,代码来源:TransformMeshMappingWithMasks.java


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