private void draw( int x0 , int y0 , GrayU8 layer ) { output.subimage(x0,y0,x0+layer.width,y0+layer.height,sub); sub.setTo(layer); }
@Override public void process(GrayU8 gray) { detector.process(gray); synchronized ( lockGui ) { List<FiducialDetector.Detected> found = detector.getDetected(); // Select the largest quadrilaterals if( found.size() <= detected.length ) { numDetected = found.size(); for (int i = 0; i < numDetected; i++) { detected[i].binary.setTo(found.get(i).binary); detected[i].location.set(found.get(i).location); } } else { indexes.resize( found.size() ); area.resize( found.size()); for (int i = 0; i < found.size(); i++) { area.set(i, -Area2D_F64.quadrilateral(found.get(i).location)); } QuickSelect.selectIndex(area.data, detected.length, found.size(), indexes.data); numDetected = detected.length; for (int i = 0; i < numDetected; i++) { int index = indexes.data[i]; detected[i].binary.setTo(found.get(index).binary); detected[i].location.set(found.get(index).location); } } } }
/** * Applies a morphological thinning operation to the image. Also known as skeletonization. * * @see BinaryThinning * * @param input Input image. Not modified. * @param maxIterations Maximum number of cycles it will thin for. -1 for the maximum required * @param output If not null, the output image. If null a new image is declared and returned. Modified. * @return Output image. */ public static GrayU8 thin(GrayU8 input , int maxIterations, GrayU8 output ) { output = InputSanityCheck.checkDeclare(input, output); output.setTo(input); BinaryThinning thinning = new BinaryThinning(); thinning.apply(output,maxIterations); return output; }
GrayU8 band1 = dst.getBand(0); for (int i = 1; i < dst.getNumBands(); i++) { dst.getBand(i).setTo(band1);
output.setTo(tmp2);
@Override public synchronized void processImage(int sourceID, long frameID, final BufferedImage buffered, ImageBase input) { if( buffered != null ) { original = ConvertBufferedImage.checkCopy(buffered,original); work = ConvertBufferedImage.checkDeclare(buffered,work); binary.reshape(input.getWidth(), input.getHeight()); filtered.reshape(input.getWidth(),input.getHeight()); inputPrev.setTo((GrayU8)input); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Dimension d = gui.getPreferredSize(); if( d.getWidth() < buffered.getWidth() || d.getHeight() < buffered.getHeight() ) { gui.setPreferredSize(new Dimension(buffered.getWidth(), buffered.getHeight())); } }}); } else { input = inputPrev; } process((GrayU8)input); }
output.setTo(tmp2);
output.setTo(tmp2);
output.setTo(tmp2);
binary.setTo(inputBinary);
@Override public void onDraw(Canvas canvas, Matrix imageToView) { if( touched) { applyToPoint(viewToImage,touch.x,touch.y,touch); } boolean selected = false; synchronized (lockGui) { canvas.concat(imageToView); for (int i = 0; i < numDetected; i++) { FiducialDetector.Detected d = detected[i]; if (validQuadrilateral(d.location)) { drawQuad(canvas, d.location, 3, paintBorder); drawQuad(canvas, d.location, 0, paintInside); if (touched && Intersection2D_F64.contains(d.location, touch)) { touchedFiducial.setTo(d.binary); selected = true; } } } } if( selected ) { // it's in the GUI thread already so this call is OK dialogAcceptFiducial("",""); } else { touched = false; } }
to.setTo(from.getBand(0)); } else if( numBands == 3 ) { GrayU8 band0 = from.getBand(0);
afterOps.setTo(binary);
ImageMiscOps.fillBorder(border, 0, 1); border.subimage(1,1,border.width-1,border.height-1, null).setTo(binary);