/** * Specifies which set the iterator should process * @param whichSet index of the set */ public void setup( int whichSet ) { set = sets.get(whichSet); pointIndex = 0; }
/** * Returns a precomputed likelihood function */ public Likelihood getLikelihood( int which ) { return precomputes.get(which); }
public TldRegion selectBest() { TldRegion best = null; double bestConfidence = 0; for( int i = 0; i < localMaximums.size; i++ ) { TldRegion r = localMaximums.get(i); if( r.confidence > bestConfidence ) { bestConfidence = r.confidence; best = r; } } return best; }
@Override public Point2D_F64 getLocation(int featureIndex) { return location.get(featureIndex); }
/** * Returns a precomputed likelihood function */ public Likelihood getLikelihood( int which ) { return precomputes.get(which); }
/** * Sets the distorted location of a specific control point * @param which Which control point * @param x distorted coordinate x-axis in image pixels * @param y distorted coordinate y-axis in image pixels */ public void setDistorted( int which , float x , float y ) { controls.get(which).q.set(x,y); }
public Point2D_I32 next() { int index = set.start + pointIndex*2; int blockIndex = set.block + index/blockLength; index %= blockLength; int block[] = blocks.get( blockIndex ); p.set( block[index] , block[index+1] ); pointIndex++; return p; } }
/** * Sets the location of a control point. * @param x coordinate x-axis in image pixels * @param y coordinate y-axis in image pixels */ public void setUndistorted(int which, float x, float y) { if( scaleX <= 0 || scaleY <= 0 ) throw new IllegalArgumentException("Must call configure first"); controls.get(which).p.set(x/scaleX,y/scaleY); }
private void examineChanges() { for( int i = 0; i < changeOld.size; i++ ) { ChangeInfo p = changeOld.get(i); checkNeighhood8(p.x,p.y); } }
private void printDetectedConfidence() { FastQueue<TldRegion> detected = tracker.getDetection().getLocalMaximums(); System.out.println("Target: "+target); for( int i = 0; i < detected.size; i++ ) { TldRegion r = detected.get(i); System.out.println(r.rect+" confidence: "+r.confidence+" connections "+r.connections); } }
/** * Precomputes likelihood for all the mixtures */ public void precomputeAll() { precomputes.resize(mixtures.size()); for (int i = 0; i < precomputes.size; i++) { precomputes.get(i).setGaussian(mixtures.get(i)); } }
/** * Precomputes likelihood for all the mixtures */ public void precomputeAll() { precomputes.resize(mixtures.size()); for (int i = 0; i < precomputes.size; i++) { precomputes.get(i).setGaussian(mixtures.get(i)); } }
@Override public void onDraw(Canvas canvas, Matrix imageToView) { canvas.concat(imageToView); synchronized (lockGui) { for (int i = 0; i < foundGUI.size(); i++) { ScalePoint p = foundGUI.get(i); float radius = (float)(p.scale*density); canvas.drawCircle((float) p.x, (float) p.y, radius, paintMax); } } }
/** * Removes the current point set from the end */ public void removeTail() { while( blocks.size-1 != tail.block ) blocks.removeTail(); tailBlockSize = tail.start; sets.removeTail(); tail = sets.size > 0 ? sets.get( sets.size-1 ) : null; }
/** * Remove grids which cannot possible match the expected shape */ static void pruneIncorrectShape(FastQueue<Grid> grids , int numRows, int numCols ) { // prune clusters which can't be a member calibration target for (int i = grids.size()-1; i >= 0; i--) { Grid g = grids.get(i); if ((g.rows != numRows || g.columns != numCols) && (g.rows != numCols || g.columns != numRows)) { grids.remove(i); } } }
@Override protected List<PointIndex2D_F64> getDetectedControl(int which) { FoundFiducial found = getAlgorithm().getFound().get(which); listQuad.get(0).set( found.distortedPixels.a ); listQuad.get(1).set( found.distortedPixels.b ); listQuad.get(2).set( found.distortedPixels.c ); listQuad.get(3).set( found.distortedPixels.d ); return listQuad; }
@Override protected void finalizeShapes() { synchronized (lockGui) { visPoly.reset(); for (int i = 0; i < workPoly.size; i++) { visPoly.grow().set(workPoly.get(i)); } } }
/** * Sets up data structures for nearest-neighbor search used in {@link #connectNodes()} */ private void setupSearch() { searchPoints.reset(); for (int i = 0; i < nodes.size(); i++) { SquareNode n = nodes.get(i); double[] point = searchPoints.grow(); point[0] = n.center.x; point[1] = n.center.y; } search.setPoints(searchPoints.toList(), nodes.toList()); }
@Test public void findNearestN_checkData() { List<double[]> points = new ArrayList<>(); points.add(new double[]{3,4}); points.add(new double[]{6,8}); alg.setPoints(points,true); foundN.reset(); alg.findNearest(new double[]{6, 7}, 10, 1, foundN); assertEquals(1, foundN.get(0).index); }