@Override public void mouseReleased(MouseEvent e) { if( mode != Mode.DRAGGING_RECT ) return; setCornerC(e.getX(),e.getY()); double area = Area2D_F64.quadrilateral(quad); if( area < 10*10 ) { mode = Mode.IDLE; repaint(); } else { mode = Mode.TRACKING; listener.selectedTarget(quad); repaint(); } }
public double computeSize( SquareGrid grid ) { poly.vertexes.data[0] = grid.get(0,0).center; poly.vertexes.data[1] = grid.get(0,grid.columns-1).center; poly.vertexes.data[2] = grid.get(grid.rows-1,grid.columns-1).center; poly.vertexes.data[3] = grid.get(grid.rows-1,0).center; return Area2D_F64.polygonSimple(poly); }
double area = Area2D_F64.polygonSimple(workPoly);
@Override public void mouseReleased(MouseEvent e) { if( mode != Mode.DRAGGING_RECT ) return; setCornerC(e.getX(),e.getY()); double area = Area2D_F64.quadrilateral(quad); if( area < 10*10 ) { mode = Mode.IDLE; repaint(); } else { mode = Mode.TRACKING; listener.selectedTarget(quad); repaint(); } }
@Override public void process(GrayU8 gray) { detector.process(gray); synchronized ( lockGui ) { List<FiducialDetector.Detected> found = detector.getDetected(); // Select the largest quadrilaterals if( found.size() <= detected.length ) { numDetected = found.size(); for (int i = 0; i < numDetected; i++) { detected[i].binary.setTo(found.get(i).binary); detected[i].location.set(found.get(i).location); } } else { indexes.resize( found.size() ); area.resize( found.size()); for (int i = 0; i < found.size(); i++) { area.set(i, -Area2D_F64.quadrilateral(found.get(i).location)); } QuickSelect.selectIndex(area.data, detected.length, found.size(), indexes.data); numDetected = detected.length; for (int i = 0; i < numDetected; i++) { int index = indexes.data[i]; detected[i].binary.setTo(found.get(index).binary); detected[i].location.set(found.get(index).location); } } } }