public static Mat thresholdAdaptive(Mat mat, boolean invert) { Imgproc.adaptiveThreshold(mat, mat, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, invert ? Imgproc.THRESH_BINARY_INV : Imgproc.THRESH_BINARY, 3, 5); return mat; }
public FluentCv thresholdAdaptive(boolean invert, String... tag) { Imgproc.adaptiveThreshold(mat, mat, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, invert ? Imgproc.THRESH_BINARY_INV : Imgproc.THRESH_BINARY, 3, 5); return store(mat, tag); }
protected void execute() { Mat gray = gray(); Imgproc.adaptiveThreshold(gray, out, 255, Imgproc.THRESH_BINARY_INV, Imgproc.ADAPTIVE_THRESH_MEAN_C, blocksize, reduction); }
protected void processOperation() { if(adaptiveMeanString.equals(thresholdMode)){ Imgproc.adaptiveThreshold(originalImage, image, maxval, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY, blockSize, constantC); } else if(noneString.equals(thresholdMode)){ image = originalImage.clone(); } else{ Imgproc.threshold(originalImage, image, level, maxval, modeMap.get(thresholdMode)); } updateView(image); }
@Override public Result process(CvPipeline pipeline) throws Exception { Mat mat = pipeline.getWorkingImage(); Imgproc.adaptiveThreshold(mat, mat, 255, adaptiveMethod.getCode(), invert ? Imgproc.THRESH_BINARY_INV : Imgproc.THRESH_BINARY, blockSize, cParm); return null; } }
protected void execute() { out = gray(); Imgproc.equalizeHist(out, out); Core.normalize(out, out, min, max, Core.NORM_MINMAX); Imgproc.adaptiveThreshold(out, out, 255, Imgproc.THRESH_BINARY, Imgproc.ADAPTIVE_THRESH_MEAN_C, blocksize, reduction); byte[] data = new byte[(int) out.total()]; out.get(0, 0, data); this.tessBaseAPI.setImage(data, out.width(), out.height(), out.channels(), (int) out.step1()); String utf8Text = this.tessBaseAPI.getUTF8Text(); int score = this.tessBaseAPI.meanConfidence(); this.tessBaseAPI.clear(); if (score >= SIMPLETEXT_MIN_SCORE && utf8Text.length() > 0) { simpleText = utf8Text; } else { simpleText = new String(); } }