@Override public void process(T input, GrayU8 output) { GThresholdImageOps.threshold(input,output,threshold,down); }
@Override public void process(T input, GrayU8 output) { double threshold = GThresholdImageOps.computeEntropy(input, minValue, maxValue); GThresholdImageOps.threshold(input,output,threshold,down); }
@Override public void process(T input, GrayU8 output) { double threshold = GThresholdImageOps.computeOtsu(input,minValue,maxValue); GThresholdImageOps.threshold(input,output,threshold,down); }
/** * Add a new pattern to be detected. This function takes in a raw gray scale image and thresholds it. * * @param pattern Gray scale image of the pattern * @param threshold Threshold used to convert it into a binary image * @param lengthSide Length of a side on the square in world units. */ public void addPatternImage(T pattern, double threshold, double lengthSide) { GrayU8 binary = new GrayU8(pattern.width,pattern.height); GThresholdImageOps.threshold(pattern,binary,threshold,false); alg.addPattern(binary, lengthSide); }
private synchronized void performWork() { if( filter == null ) return; GThresholdImageOps.threshold(imageInput, imageBinary, selectThresh.getThreshold(), selectThresh.isDown()); filter.process(imageBinary,imageOutput); SwingUtilities.invokeLater(new Runnable() { public void run() { if (work == null || work.getWidth() != imageInput.width || work.getHeight() != imageInput.height) { work = new BufferedImage(imageInput.width, imageInput.height, BufferedImage.TYPE_INT_BGR); } VisualizeBinaryData.renderBinary(selectedVisualize, false, work); gui.setImage(work); gui.setPreferredSize(new Dimension(imageInput.width, imageInput.height)); processedImage = true; gui.repaint(); } }); }
GThresholdImageOps.threshold(grayNoBorder,binary,threshold,false);
private synchronized void performWork() { if( filter1 == null || filter2 == null ) return; GThresholdImageOps.threshold(imageInput, imageBinary, selectThresh.getThreshold(), selectThresh.isDown()); filter1.process(imageBinary,imageOutput1); filter2.process(imageOutput1,imageOutput2); List<Contour> found = BinaryImageOps.contour(imageOutput2, connectRule, imageLabeled); if( colors == null || colors.length <= found.size() ) colors = BinaryImageOps.selectRandomColors(found.size(),rand); SwingUtilities.invokeLater(new Runnable() { public void run() { if (work == null || work.getWidth() != imageInput.width || work.getHeight() != imageInput.height) { work = new BufferedImage(imageInput.width, imageInput.height, BufferedImage.TYPE_INT_BGR); } renderVisualizeImage(); gui.setImage(work); gui.setPreferredSize(new Dimension(imageInput.width, imageInput.height)); processedImage = true; gui.repaint(); } }); }
GThresholdImageOps.threshold(edgeIntensity,detected,30,false);
new FDistort(inputGray,scaled).scaleExt().apply(); GThresholdImageOps.threshold(scaled,binary,255/2.0,false); } else { binary.setTo(inputBinary);
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(); }}); }
@Override public List<LineSegment2D_F32> detect(T input) { derivX.reshape(input.width,input.height); derivY.reshape(input.width,input.height); edgeIntensity.reshape(input.width,input.height); detected.reshape(input.width,input.height); gradient.process(input,derivX,derivY); GGradientToEdgeFeatures.intensityAbs(derivX, derivY, edgeIntensity); GThresholdImageOps.threshold(edgeIntensity, detected, edgeThreshold, false); detectorGrid.process(derivX,derivY,detected); MatrixOfList<LineSegment2D_F32> grid = detectorGrid.getFoundLines(); if( connect != null ) { connect.process(grid); } List<LineSegment2D_F32> found = grid.createSingleList(); LineImageOps.mergeSimilar(found, (float) (Math.PI * 0.03), 5f); return found; } }
@Override public void process(GrayU8 input) { GThresholdImageOps.threshold(input,binary,threshold, down);