public void add( float val ) { push(val); }
public void add( float val ) { push(val); }
@Override public void push(GrowQueue_F32 queue, double value) { queue.push((float)value); }
/** * Searches for local maximas and converts into lines. * * @return Found lines in the image. */ public FastQueue<LineParametric2D_F32> extractLines() { lines.reset(); foundLines.reset(); foundIntensity.reset(); extractor.process(transform,null, candidates,null, foundLines); for( int i = 0; i < foundLines.size(); i++ ) { Point2D_I16 p = foundLines.get(i); int x0 = p.x - originX; int y0 = p.y - originY; if( Math.abs(x0) >= minDistanceFromOrigin || Math.abs(y0) >= minDistanceFromOrigin ) { LineParametric2D_F32 l = lines.grow(); l.p.set(p.x,p.y); l.slope.set(-y0,x0); foundIntensity.push(transform.get(p.x,p.y)); } } return lines; }
@Test public void remove_two() { GrowQueue_F32 alg = new GrowQueue_F32(10); alg.push(1); alg.push(3); alg.push(4); alg.push(5); alg.push(6); alg.remove(1,1); assertEquals(4,alg.size); assertEquals(1,alg.get(0), UtilEjml.TEST_F32); assertEquals(4,alg.get(1), UtilEjml.TEST_F32); assertEquals(5,alg.get(2), UtilEjml.TEST_F32); assertEquals(6,alg.get(3), UtilEjml.TEST_F32); alg.remove(0,1); assertEquals(2,alg.size); assertEquals(5,alg.get(0), UtilEjml.TEST_F32); assertEquals(6,alg.get(1), UtilEjml.TEST_F32); }
@Test public void auto_grow() { GrowQueue_F32 alg = new GrowQueue_F32(3); assertEquals(3,alg.data.length); for( int i = 0; i < 10; i++ ) alg.push(i); assertEquals(10,alg.size); for( int i = 0; i < 10; i++ ) assertEquals(i,alg.get(i),1e-4f); }
/** * Searches for local maximas and converts into lines. * * @return Found lines in the image. */ public FastQueue<LineParametric2D_F32> extractLines() { lines.reset(); foundLines.reset(); foundIntensity.reset(); extractor.process(transform, null,null,null, foundLines); int w2 = transform.width/2; for( int i = 0; i < foundLines.size(); i++ ) { Point2D_I16 p = foundLines.get(i); float r = (float)(r_max*(p.x-w2)/w2); float c = tableTrig.c[p.y]; float s = tableTrig.s[p.y]; float x0 = r*c+originX; float y0 = r*s+originY; foundIntensity.push( transform.get(p.x,p.y)); LineParametric2D_F32 l = lines.grow(); l.p.set(x0,y0); l.slope.set(-s,c); Point2D_F64 p2 = new Point2D_F64(); lineToCoordinate(l,p2); } return lines; }