@Override protected void detectorProcess(ImageGray input, GrayU8 binary) { // System.out.println("processing image "+count++); binaryToContour.process(binary,labeled); contours = BinaryImageOps.convertContours(binaryToContour); int minContourPixels = minimumContourSize.computeI(Math.min(input.width,input.height)); polylines.clear(); GrowQueue_I32 indices = new GrowQueue_I32(); for (int i = 0; i < contours.size(); i++) { List<Point2D_I32> contour = contours.get(i).external; if( contour.size() < minContourPixels ) continue; if( contourToPolyline.process(contour,indices) ) { List<Point2D_I32> l = new ArrayList<>(); for (int j = 0; j < indices.size; j++) { l.add( contour.get( indices.get(j))); } polylines.add(l); } } }
@Override protected List<Contour> getContours() { BinaryContourFinder contour = alg.getDetectorSquare().getDetector().getContourFinder(); List<Contour> contours = BinaryImageOps.convertContours(contour); return contours; }
/** * Finds the external contours only in the image * @param input Input binary image. Not modified. * @param rule Connectivity rule. Can be 4 or 8. 8 is more commonly used. * @return List of found contours for each blob. */ public static List<Contour> contourExternal(GrayU8 input, ConnectRule rule ) { BinaryContourFinder alg = FactoryBinaryContourFinder.linearExternal(); alg.setConnectRule(rule); alg.process(input); return convertContours(alg); }
@Override protected List<Contour> getContours() { BinaryLabelContourFinder contour = detector.getDetector().getEllipseDetector().getEllipseDetector().getContourFinder(); return BinaryImageOps.convertContours(contour); }
@Override protected List<Contour> getContours() { BinaryLabelContourFinder contour = detector.getDetector().getEllipseDetector().getEllipseDetector().getContourFinder(); return BinaryImageOps.convertContours(contour); }
@Override protected List<Contour> getContours() { BinaryContourFinder contour = alg.getFindSeeds().getDetectorSquare().getDetector().getContourFinder(); return BinaryImageOps.convertContours(contour); }
List<Contour> contours = BinaryImageOps.convertContours(contour); g2.setStroke(new BasicStroke(1)); VisualizeBinaryData.render(contours, null,Color.CYAN, scale, g2);
alg.process(input,output); return convertContours(alg);
private void doProcess() { if( input == null ) return; final BufferedImage temp; if( activeAlg == 0 ) { if( previousBlur != barCanny.getBlurRadius() ) { previousBlur = barCanny.getBlurRadius(); canny = FactoryEdgeDetectors.canny(previousBlur,true, true, imageType, derivType); } double thresh = barCanny.getThreshold()/100.0; canny.process(workImage,(float)thresh*0.1f,(float)thresh,null); List<EdgeContour> contours = canny.getContours(); temp = VisualizeBinaryData.renderContours(contours,null,workImage.width,workImage.height,null); } else { // create a binary image by thresholding GThresholdImageOps.threshold(workImage, binary, barBinary.getThreshold(), barBinary.isDown()); contour.process(binary,labeled); List<Contour> contours = BinaryImageOps.convertContours(contour); temp = VisualizeBinaryData.renderContours(contours,null,0xFF1010, workImage.width,workImage.height,null); } SwingUtilities.invokeLater(new Runnable() { public void run() { panel.setImage(temp); panel.repaint(); }}); }