@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; } }
BinaryImageOps.removePointNoise(binary, afterOps); break;