@Override public void process(GrayU8 binary, GrayS32 labeled) { finder.process(binary,labeled); }
/** * Finds all valid ellipses in the binary image * @param binary binary image */ public void process( GrayU8 binary ) { found.reset(); labeled.reshape(binary.width, binary.height); contourFinder.process(binary, labeled); FastQueue<Contour> blobs = contourFinder.getContours(); for (int i = 0; i < blobs.size; i++) { Contour c = blobs.get(i); proccessContour(c.external); if(internalContour) { for( int j = 0; j < c.internal.size(); j++ ) { proccessContour(c.internal.get(j)); } } } }
@Override public void process(GrayU8 input) { // Select a reasonable threshold double mean = GThresholdImageOps.computeOtsu(input,0,255); // create a binary image by thresholding ThresholdImageOps.threshold(input, binary, (int)mean, down); // reduce noise with some filtering BinaryImageOps.removePointNoise(binary, filtered1); // draw binary image for output if( showBinary ) { VisualizeImageData.binaryToBitmap(filtered1, false, bitmap, bitmapTmp); } else { ConvertBitmap.boofToBitmap(input,bitmap,bitmapTmp); } // draw the ellipses findContours.process(filtered1,contourOutput); List<Contour> contours = BinaryImageOps.contour(filtered1, ConnectRule.EIGHT,null); resetShapes(); for (Contour contour : contours) { List<Point2D_I32> points = contour.external; if (points.size() < 20) continue; fitShape(points); } finalizeShapes(); visualizationPending = true; } }
contourFinder.process(binary, labeled);