id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
49,600
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java
PnPLepetitEPnP.estimateCase3_planar
protected void estimateCase3_planar( double betas[] ) { relinearizeBeta.setNumberControl(3); relinearizeBeta.process(L_full,y,betas); refine(betas); }
java
protected void estimateCase3_planar( double betas[] ) { relinearizeBeta.setNumberControl(3); relinearizeBeta.process(L_full,y,betas); refine(betas); }
[ "protected", "void", "estimateCase3_planar", "(", "double", "betas", "[", "]", ")", "{", "relinearizeBeta", ".", "setNumberControl", "(", "3", ")", ";", "relinearizeBeta", ".", "process", "(", "L_full", ",", "y", ",", "betas", ")", ";", "refine", "(", "bet...
If the data is planar use relinearize to estimate betas
[ "If", "the", "data", "is", "planar", "use", "relinearize", "to", "estimate", "betas" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L629-L634
49,601
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java
PnPLepetitEPnP.gaussNewton
private void gaussNewton( double betas[] ) { A_temp.reshape(L_full.numRows, numControl); v_temp.reshape(L_full.numRows, 1); x.reshape(numControl,1,false); // don't check numControl inside in hope that the JVM can optimize the code better if( numControl == 4 ) { for( int i = 0; i < numIterations; i++ ) { ...
java
private void gaussNewton( double betas[] ) { A_temp.reshape(L_full.numRows, numControl); v_temp.reshape(L_full.numRows, 1); x.reshape(numControl,1,false); // don't check numControl inside in hope that the JVM can optimize the code better if( numControl == 4 ) { for( int i = 0; i < numIterations; i++ ) { ...
[ "private", "void", "gaussNewton", "(", "double", "betas", "[", "]", ")", "{", "A_temp", ".", "reshape", "(", "L_full", ".", "numRows", ",", "numControl", ")", ";", "v_temp", ".", "reshape", "(", "L_full", ".", "numRows", ",", "1", ")", ";", "x", ".",...
Optimize beta values using Gauss Newton. @param betas Beta values being optimized.
[ "Optimize", "beta", "values", "using", "Gauss", "Newton", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L649-L685
49,602
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java
QrCodeEncoder.addAutomatic
public QrCodeEncoder addAutomatic(String message) { // very simple coding algorithm. Doesn't try to compress by using multiple formats if(containsKanji(message)) { // split into kanji and non-kanji segments int start = 0; boolean kanji = isKanji(message.charAt(0)); for (int i = 0; i < message.length(); ...
java
public QrCodeEncoder addAutomatic(String message) { // very simple coding algorithm. Doesn't try to compress by using multiple formats if(containsKanji(message)) { // split into kanji and non-kanji segments int start = 0; boolean kanji = isKanji(message.charAt(0)); for (int i = 0; i < message.length(); ...
[ "public", "QrCodeEncoder", "addAutomatic", "(", "String", "message", ")", "{", "// very simple coding algorithm. Doesn't try to compress by using multiple formats", "if", "(", "containsKanji", "(", "message", ")", ")", "{", "// split into kanji and non-kanji segments", "int", "...
Select the encoding based on the letters in the message. A very simple algorithm is used internally.
[ "Select", "the", "encoding", "based", "on", "the", "letters", "in", "the", "message", ".", "A", "very", "simple", "algorithm", "is", "used", "internally", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java#L121-L155
49,603
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java
QrCodeEncoder.addAlphanumeric
public QrCodeEncoder addAlphanumeric(String alphaNumeric) { byte values[] = alphanumericToValues(alphaNumeric); MessageSegment segment = new MessageSegment(); segment.message = alphaNumeric; segment.data = values; segment.length = values.length; segment.mode = QrCode.Mode.ALPHANUMERIC; segment.encodedSi...
java
public QrCodeEncoder addAlphanumeric(String alphaNumeric) { byte values[] = alphanumericToValues(alphaNumeric); MessageSegment segment = new MessageSegment(); segment.message = alphaNumeric; segment.data = values; segment.length = values.length; segment.mode = QrCode.Mode.ALPHANUMERIC; segment.encodedSi...
[ "public", "QrCodeEncoder", "addAlphanumeric", "(", "String", "alphaNumeric", ")", "{", "byte", "values", "[", "]", "=", "alphanumericToValues", "(", "alphaNumeric", ")", ";", "MessageSegment", "segment", "=", "new", "MessageSegment", "(", ")", ";", "segment", "....
Creates a QR-Code which encodes data in the alphanumeric format @param alphaNumeric String containing only alphanumeric values. @return The QR-Code
[ "Creates", "a", "QR", "-", "Code", "which", "encodes", "data", "in", "the", "alphanumeric", "format" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java#L274-L292
49,604
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java
QrCodeEncoder.addBytes
public QrCodeEncoder addBytes(byte[] data) { StringBuilder builder = new StringBuilder(data.length); for (int i = 0; i < data.length; i++) { builder.append((char)data[i]); } MessageSegment segment = new MessageSegment(); segment.message = builder.toString(); segment.data = data; segment.length = data....
java
public QrCodeEncoder addBytes(byte[] data) { StringBuilder builder = new StringBuilder(data.length); for (int i = 0; i < data.length; i++) { builder.append((char)data[i]); } MessageSegment segment = new MessageSegment(); segment.message = builder.toString(); segment.data = data; segment.length = data....
[ "public", "QrCodeEncoder", "addBytes", "(", "byte", "[", "]", "data", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "data", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "data", ".", "length", ";"...
Creates a QR-Code which encodes data in the byte format. @param data Data to be encoded @return The QR-Code
[ "Creates", "a", "QR", "-", "Code", "which", "encodes", "data", "in", "the", "byte", "format", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java#L347-L365
49,605
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java
QrCodeEncoder.addKanji
public QrCodeEncoder addKanji(String message) { byte[] bytes; try { bytes = message.getBytes("Shift_JIS"); } catch (UnsupportedEncodingException ex) { throw new IllegalArgumentException(ex); } MessageSegment segment = new MessageSegment(); segment.message = message; segment.data = bytes; segment....
java
public QrCodeEncoder addKanji(String message) { byte[] bytes; try { bytes = message.getBytes("Shift_JIS"); } catch (UnsupportedEncodingException ex) { throw new IllegalArgumentException(ex); } MessageSegment segment = new MessageSegment(); segment.message = message; segment.data = bytes; segment....
[ "public", "QrCodeEncoder", "addKanji", "(", "String", "message", ")", "{", "byte", "[", "]", "bytes", ";", "try", "{", "bytes", "=", "message", ".", "getBytes", "(", "\"Shift_JIS\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "ex", ")", "...
Creates a QR-Code which encodes Kanji characters @param message Data to be encoded @return The QR-Code
[ "Creates", "a", "QR", "-", "Code", "which", "encodes", "Kanji", "characters" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java#L390-L410
49,606
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java
QrCodeEncoder.getLengthBits
private static int getLengthBits(int version, int bitsA, int bitsB, int bitsC) { int lengthBits; if (version < 10) lengthBits = bitsA; else if (version < 27) lengthBits = bitsB; else lengthBits = bitsC; return lengthBits; }
java
private static int getLengthBits(int version, int bitsA, int bitsB, int bitsC) { int lengthBits; if (version < 10) lengthBits = bitsA; else if (version < 27) lengthBits = bitsB; else lengthBits = bitsC; return lengthBits; }
[ "private", "static", "int", "getLengthBits", "(", "int", "version", ",", "int", "bitsA", ",", "int", "bitsB", ",", "int", "bitsC", ")", "{", "int", "lengthBits", ";", "if", "(", "version", "<", "10", ")", "lengthBits", "=", "bitsA", ";", "else", "if", ...
Returns the length of the message length variable in bits. Dependent on version
[ "Returns", "the", "length", "of", "the", "message", "length", "variable", "in", "bits", ".", "Dependent", "on", "version" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java#L459-L469
49,607
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java
QrCodeEncoder.fixate
public QrCode fixate() { autoSelectVersionAndError(); // sanity check of code int expectedBitSize = bitsAtVersion(qr.version); qr.message = ""; for( MessageSegment m : segments ) { qr.message += m.message; switch( m.mode ) { case NUMERIC:encodeNumeric(m.data,m.length);break; case ALPHANUMERIC:...
java
public QrCode fixate() { autoSelectVersionAndError(); // sanity check of code int expectedBitSize = bitsAtVersion(qr.version); qr.message = ""; for( MessageSegment m : segments ) { qr.message += m.message; switch( m.mode ) { case NUMERIC:encodeNumeric(m.data,m.length);break; case ALPHANUMERIC:...
[ "public", "QrCode", "fixate", "(", ")", "{", "autoSelectVersionAndError", "(", ")", ";", "// sanity check of code", "int", "expectedBitSize", "=", "bitsAtVersion", "(", "qr", ".", "version", ")", ";", "qr", ".", "message", "=", "\"\"", ";", "for", "(", "Mess...
Call this function after you are done adding to the QR code @return The generated QR Code
[ "Call", "this", "function", "after", "you", "are", "done", "adding", "to", "the", "QR", "code" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java#L481-L521
49,608
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java
QrCodeEncoder.selectMask
static QrCodeMaskPattern selectMask( QrCode qr ) { int N = qr.getNumberOfModules(); int totalBytes = QrCode.VERSION_INFO[qr.version].codewords; List<Point2D_I32> locations = QrCode.LOCATION_BITS[qr.version]; QrCodeMaskPattern bestMask = null; double bestScore = Double.MAX_VALUE; PackedBits8 bits = new Pac...
java
static QrCodeMaskPattern selectMask( QrCode qr ) { int N = qr.getNumberOfModules(); int totalBytes = QrCode.VERSION_INFO[qr.version].codewords; List<Point2D_I32> locations = QrCode.LOCATION_BITS[qr.version]; QrCodeMaskPattern bestMask = null; double bestScore = Double.MAX_VALUE; PackedBits8 bits = new Pac...
[ "static", "QrCodeMaskPattern", "selectMask", "(", "QrCode", "qr", ")", "{", "int", "N", "=", "qr", ".", "getNumberOfModules", "(", ")", ";", "int", "totalBytes", "=", "QrCode", ".", "VERSION_INFO", "[", "qr", ".", "version", "]", ".", "codewords", ";", "...
Selects a mask by minimizing the appearance of certain patterns. This is inspired by what was described in the reference manual. I had a hard time understanding some of the specifics so I improvised.
[ "Selects", "a", "mask", "by", "minimizing", "the", "appearance", "of", "certain", "patterns", ".", "This", "is", "inspired", "by", "what", "was", "described", "in", "the", "reference", "manual", ".", "I", "had", "a", "hard", "time", "understanding", "some", ...
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java#L528-L553
49,609
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java
QrCodeEncoder.detectAdjacentAndPositionPatterns
static void detectAdjacentAndPositionPatterns(int N, QrCodeCodeWordLocations matrix, FoundFeatures features) { for (int foo = 0; foo < 2; foo++) { for (int row = 0; row < N; row++) { int index = row * N; for (int col = 1; col < N; col++, index++) { if (matrix.data[index] == matrix.data[index + 1]) ...
java
static void detectAdjacentAndPositionPatterns(int N, QrCodeCodeWordLocations matrix, FoundFeatures features) { for (int foo = 0; foo < 2; foo++) { for (int row = 0; row < N; row++) { int index = row * N; for (int col = 1; col < N; col++, index++) { if (matrix.data[index] == matrix.data[index + 1]) ...
[ "static", "void", "detectAdjacentAndPositionPatterns", "(", "int", "N", ",", "QrCodeCodeWordLocations", "matrix", ",", "FoundFeatures", "features", ")", "{", "for", "(", "int", "foo", "=", "0", ";", "foo", "<", "2", ";", "foo", "++", ")", "{", "for", "(", ...
Look for adjacent blocks that are the same color as well as patterns that could be confused for position patterns 1,1,3,1,1 in vertical and horizontal directions
[ "Look", "for", "adjacent", "blocks", "that", "are", "the", "same", "color", "as", "well", "as", "patterns", "that", "could", "be", "confused", "for", "position", "patterns", "1", "1", "3", "1", "1", "in", "vertical", "and", "horizontal", "directions" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java#L606-L628
49,610
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java
QrCodeEncoder.bitsAtVersion
private int bitsAtVersion( int version ) { int total = 0; for (int i = 0; i < segments.size(); i++) { total += segments.get(i).sizeInBits(version); } return total; }
java
private int bitsAtVersion( int version ) { int total = 0; for (int i = 0; i < segments.size(); i++) { total += segments.get(i).sizeInBits(version); } return total; }
[ "private", "int", "bitsAtVersion", "(", "int", "version", ")", "{", "int", "total", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "segments", ".", "size", "(", ")", ";", "i", "++", ")", "{", "total", "+=", "segments", ".", "ge...
Computes how many bits it takes to encode the message at this version number @param version @return
[ "Computes", "how", "many", "bits", "it", "takes", "to", "encode", "the", "message", "at", "this", "version", "number" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeEncoder.java#L690-L696
49,611
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/f/EpipolarMinimizeGeometricError.java
EpipolarMinimizeGeometricError.process
public boolean process(DMatrixRMaj F21 , double x1 , double y1, double x2, double y2, Point2D_F64 p1 , Point2D_F64 p2 ) { // translations used to move points to the origin assignTinv(T1,x1,y1); assignTinv(T2,x2,y2); // take F to the new coordinate system // F1 = T2'*F*T1 PerspectiveOps.m...
java
public boolean process(DMatrixRMaj F21 , double x1 , double y1, double x2, double y2, Point2D_F64 p1 , Point2D_F64 p2 ) { // translations used to move points to the origin assignTinv(T1,x1,y1); assignTinv(T2,x2,y2); // take F to the new coordinate system // F1 = T2'*F*T1 PerspectiveOps.m...
[ "public", "boolean", "process", "(", "DMatrixRMaj", "F21", ",", "double", "x1", ",", "double", "y1", ",", "double", "x2", ",", "double", "y2", ",", "Point2D_F64", "p1", ",", "Point2D_F64", "p2", ")", "{", "// translations used to move points to the origin", "ass...
Minimizes the geometric error @param F21 (Input) Fundamental matrix x2 * F21 * x1 == 0 @param x1 (Input) Point 1 x-coordinate. Pixels @param y1 (Input) Point 1 y-coordinate. Pixels @param x2 (Input) Point 2 x-coordinate. Pixels @param y2 (Input) Point 2 y-coordinate. Pixels @param p1 (Output) Point 1. Pixels @param p2...
[ "Minimizes", "the", "geometric", "error" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/f/EpipolarMinimizeGeometricError.java#L87-L140
49,612
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/UtilShapePolygon.java
UtilShapePolygon.convert
public static boolean convert( LineGeneral2D_F64[] lines , Polygon2D_F64 poly ) { for (int i = 0; i < poly.size(); i++) { int j = (i + 1) % poly.size(); if( null == Intersection2D_F64.intersection(lines[i], lines[j], poly.get(j)) ) return false; } return true; }
java
public static boolean convert( LineGeneral2D_F64[] lines , Polygon2D_F64 poly ) { for (int i = 0; i < poly.size(); i++) { int j = (i + 1) % poly.size(); if( null == Intersection2D_F64.intersection(lines[i], lines[j], poly.get(j)) ) return false; } return true; }
[ "public", "static", "boolean", "convert", "(", "LineGeneral2D_F64", "[", "]", "lines", ",", "Polygon2D_F64", "poly", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "poly", ".", "size", "(", ")", ";", "i", "++", ")", "{", "int", "j", "...
Finds the intersections between the four lines and converts it into a quadrilateral @param lines Assumes lines are ordered
[ "Finds", "the", "intersections", "between", "the", "four", "lines", "and", "converts", "it", "into", "a", "quadrilateral" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/UtilShapePolygon.java#L37-L46
49,613
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/derivative/DerivativeLaplacian.java
DerivativeLaplacian.process
public static void process(GrayU8 orig, GrayF32 deriv) { deriv.reshape(orig.width,orig.height); if( BoofConcurrency.USE_CONCURRENT ) { DerivativeLaplacian_Inner_MT.process(orig,deriv); } else { DerivativeLaplacian_Inner.process(orig,deriv); } // if( border != null ) { // border.setImage(orig); // C...
java
public static void process(GrayU8 orig, GrayF32 deriv) { deriv.reshape(orig.width,orig.height); if( BoofConcurrency.USE_CONCURRENT ) { DerivativeLaplacian_Inner_MT.process(orig,deriv); } else { DerivativeLaplacian_Inner.process(orig,deriv); } // if( border != null ) { // border.setImage(orig); // C...
[ "public", "static", "void", "process", "(", "GrayU8", "orig", ",", "GrayF32", "deriv", ")", "{", "deriv", ".", "reshape", "(", "orig", ".", "width", ",", "orig", ".", "height", ")", ";", "if", "(", "BoofConcurrency", ".", "USE_CONCURRENT", ")", "{", "D...
Computes Laplacian on an U8 image but outputs derivative in a F32 image. Removes a step when processing images for feature detection
[ "Computes", "Laplacian", "on", "an", "U8", "image", "but", "outputs", "derivative", "in", "a", "F32", "image", ".", "Removes", "a", "step", "when", "processing", "images", "for", "feature", "detection" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/derivative/DerivativeLaplacian.java#L93-L106
49,614
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.process
public void process( List<List<SquareNode>> clusters ) { grids.reset(); for (int i = 0; i < clusters.size(); i++) { if( checkPreconditions(clusters.get(i))) processCluster(clusters.get(i)); } }
java
public void process( List<List<SquareNode>> clusters ) { grids.reset(); for (int i = 0; i < clusters.size(); i++) { if( checkPreconditions(clusters.get(i))) processCluster(clusters.get(i)); } }
[ "public", "void", "process", "(", "List", "<", "List", "<", "SquareNode", ">", ">", "clusters", ")", "{", "grids", ".", "reset", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "clusters", ".", "size", "(", ")", ";", "i", "++", ...
Converts all the found clusters into grids, if they are valid. @param clusters List of clusters
[ "Converts", "all", "the", "found", "clusters", "into", "grids", "if", "they", "are", "valid", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L51-L57
49,615
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.checkPreconditions
protected boolean checkPreconditions(List<SquareNode> cluster) { for( int i = 0; i < cluster.size(); i++ ) { SquareNode n = cluster.get(i); for (int j = 0; j < n.square.size(); j++) { SquareEdge e0 = n.edges[j]; if( e0 == null) continue; for (int k = j+1; k < n.square.size(); k++) { Square...
java
protected boolean checkPreconditions(List<SquareNode> cluster) { for( int i = 0; i < cluster.size(); i++ ) { SquareNode n = cluster.get(i); for (int j = 0; j < n.square.size(); j++) { SquareEdge e0 = n.edges[j]; if( e0 == null) continue; for (int k = j+1; k < n.square.size(); k++) { Square...
[ "protected", "boolean", "checkPreconditions", "(", "List", "<", "SquareNode", ">", "cluster", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cluster", ".", "size", "(", ")", ";", "i", "++", ")", "{", "SquareNode", "n", "=", "cluster", ...
Checks basic preconditions. 1) No node may be linked two more than once
[ "Checks", "basic", "preconditions", ".", "1", ")", "No", "node", "may", "be", "linked", "two", "more", "than", "once" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L63-L81
49,616
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.processCluster
protected void processCluster( List<SquareNode> cluster ) { invalid = false; // handle a special case if( cluster.size() == 1 ) { SquareNode n = cluster.get(0); if( n.getNumberOfConnections() == 0 ) { SquareGrid grid = grids.grow(); grid.reset(); grid.columns = grid.rows = 1; grid.nodes.add(...
java
protected void processCluster( List<SquareNode> cluster ) { invalid = false; // handle a special case if( cluster.size() == 1 ) { SquareNode n = cluster.get(0); if( n.getNumberOfConnections() == 0 ) { SquareGrid grid = grids.grow(); grid.reset(); grid.columns = grid.rows = 1; grid.nodes.add(...
[ "protected", "void", "processCluster", "(", "List", "<", "SquareNode", ">", "cluster", ")", "{", "invalid", "=", "false", ";", "// handle a special case", "if", "(", "cluster", ".", "size", "(", ")", "==", "1", ")", "{", "SquareNode", "n", "=", "cluster", ...
Converts the cluster into a grid data structure. If its not a grid then nothing happens
[ "Converts", "the", "cluster", "into", "a", "grid", "data", "structure", ".", "If", "its", "not", "a", "grid", "then", "nothing", "happens" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L87-L142
49,617
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.assembleGrid
private SquareGrid assembleGrid( List<List<SquareNode>> listRows) { SquareGrid grid = grids.grow(); grid.reset(); List<SquareNode> row0 = listRows.get(0); List<SquareNode> row1 = listRows.get(1); int offset = row0.get(0).getNumberOfConnections() == 1 ? 0 : 1; grid.columns = row0.size() + row1.size(); g...
java
private SquareGrid assembleGrid( List<List<SquareNode>> listRows) { SquareGrid grid = grids.grow(); grid.reset(); List<SquareNode> row0 = listRows.get(0); List<SquareNode> row1 = listRows.get(1); int offset = row0.get(0).getNumberOfConnections() == 1 ? 0 : 1; grid.columns = row0.size() + row1.size(); g...
[ "private", "SquareGrid", "assembleGrid", "(", "List", "<", "List", "<", "SquareNode", ">", ">", "listRows", ")", "{", "SquareGrid", "grid", "=", "grids", ".", "grow", "(", ")", ";", "grid", ".", "reset", "(", ")", ";", "List", "<", "SquareNode", ">", ...
Converts the list of rows into a grid. Since it is a chessboard pattern some of the grid elements will be null.
[ "Converts", "the", "list", "of", "rows", "into", "a", "grid", ".", "Since", "it", "is", "a", "chessboard", "pattern", "some", "of", "the", "grid", "elements", "will", "be", "null", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L148-L180
49,618
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.checkEdgeCount
private boolean checkEdgeCount( SquareGrid grid ) { int left = 0, right = grid.columns-1; int top = 0, bottom = grid.rows-1; for (int row = 0; row < grid.rows; row++) { boolean skip = grid.get(row,0) == null; for (int col = 0; col < grid.columns; col++) { SquareNode n = grid.get(row,col); if( ski...
java
private boolean checkEdgeCount( SquareGrid grid ) { int left = 0, right = grid.columns-1; int top = 0, bottom = grid.rows-1; for (int row = 0; row < grid.rows; row++) { boolean skip = grid.get(row,0) == null; for (int col = 0; col < grid.columns; col++) { SquareNode n = grid.get(row,col); if( ski...
[ "private", "boolean", "checkEdgeCount", "(", "SquareGrid", "grid", ")", "{", "int", "left", "=", "0", ",", "right", "=", "grid", ".", "columns", "-", "1", ";", "int", "top", "=", "0", ",", "bottom", "=", "grid", ".", "rows", "-", "1", ";", "for", ...
Looks at the edge count in each node and sees if it has the expected number
[ "Looks", "at", "the", "edge", "count", "in", "each", "node", "and", "sees", "if", "it", "has", "the", "expected", "number" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L185-L220
49,619
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.firstRow1
List<SquareNode> firstRow1( SquareNode seed ) { for (int i = 0; i < seed.square.size(); i++) { if( isOpenEdge(seed,i) ) { List<SquareNode> list = new ArrayList<>(); seed.graph = 0; // Doesn't know which direction it can traverse along. See figure that out // by looking at the node its linked to ...
java
List<SquareNode> firstRow1( SquareNode seed ) { for (int i = 0; i < seed.square.size(); i++) { if( isOpenEdge(seed,i) ) { List<SquareNode> list = new ArrayList<>(); seed.graph = 0; // Doesn't know which direction it can traverse along. See figure that out // by looking at the node its linked to ...
[ "List", "<", "SquareNode", ">", "firstRow1", "(", "SquareNode", "seed", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "seed", ".", "square", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "isOpenEdge", "(", "seed", ","...
Adds the first row to the list of rows when the seed element has only one edge
[ "Adds", "the", "first", "row", "to", "the", "list", "of", "rows", "when", "the", "seed", "element", "has", "only", "one", "edge" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L225-L255
49,620
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.firstRow2
List<SquareNode> firstRow2(SquareNode seed ) { int indexLower = lowerEdgeIndex(seed); int indexUpper = addOffset(indexLower,1,seed.square.size()); List<SquareNode> listDown = new ArrayList<>(); List<SquareNode> list = new ArrayList<>(); if( !addToRow(seed,indexUpper,1,true,listDown) ) return null; flipAdd...
java
List<SquareNode> firstRow2(SquareNode seed ) { int indexLower = lowerEdgeIndex(seed); int indexUpper = addOffset(indexLower,1,seed.square.size()); List<SquareNode> listDown = new ArrayList<>(); List<SquareNode> list = new ArrayList<>(); if( !addToRow(seed,indexUpper,1,true,listDown) ) return null; flipAdd...
[ "List", "<", "SquareNode", ">", "firstRow2", "(", "SquareNode", "seed", ")", "{", "int", "indexLower", "=", "lowerEdgeIndex", "(", "seed", ")", ";", "int", "indexUpper", "=", "addOffset", "(", "indexLower", ",", "1", ",", "seed", ".", "square", ".", "siz...
Adds the first row to the list of rows when the seed element has two edges
[ "Adds", "the", "first", "row", "to", "the", "list", "of", "rows", "when", "the", "seed", "element", "has", "two", "edges" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L260-L274
49,621
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.lowerEdgeIndex
static int lowerEdgeIndex( SquareNode node ) { for (int i = 0; i < node.square.size(); i++) { if( isOpenEdge(node,i) ) { int next = addOffset(i,1,node.square.size()); if( isOpenEdge(node,next)) { return i; } if( i == 0 ) { int previous = node.square.size()-1; if( isOpenEdge(node,prev...
java
static int lowerEdgeIndex( SquareNode node ) { for (int i = 0; i < node.square.size(); i++) { if( isOpenEdge(node,i) ) { int next = addOffset(i,1,node.square.size()); if( isOpenEdge(node,next)) { return i; } if( i == 0 ) { int previous = node.square.size()-1; if( isOpenEdge(node,prev...
[ "static", "int", "lowerEdgeIndex", "(", "SquareNode", "node", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "square", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "isOpenEdge", "(", "node", ",", "i", ")"...
Returns the open corner index which is first. Assuming that there are two adjacent corners.
[ "Returns", "the", "open", "corner", "index", "which", "is", "first", ".", "Assuming", "that", "there", "are", "two", "adjacent", "corners", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L340-L358
49,622
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.isOpenEdge
static boolean isOpenEdge( SquareNode node , int index ) { if( node.edges[index] == null ) return false; int marker = node.edges[index].destination(node).graph; return marker == SquareNode.RESET_GRAPH; }
java
static boolean isOpenEdge( SquareNode node , int index ) { if( node.edges[index] == null ) return false; int marker = node.edges[index].destination(node).graph; return marker == SquareNode.RESET_GRAPH; }
[ "static", "boolean", "isOpenEdge", "(", "SquareNode", "node", ",", "int", "index", ")", "{", "if", "(", "node", ".", "edges", "[", "index", "]", "==", "null", ")", "return", "false", ";", "int", "marker", "=", "node", ".", "edges", "[", "index", "]",...
Is the edge open and can be traversed to? Can't be null and can't have the marker set to a none RESET_GRAPH value.
[ "Is", "the", "edge", "open", "and", "can", "be", "traversed", "to?", "Can", "t", "be", "null", "and", "can", "t", "have", "the", "marker", "set", "to", "a", "none", "RESET_GRAPH", "value", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L373-L378
49,623
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.addToRow
boolean addToRow( SquareNode n , int corner , int sign , boolean skip , List<SquareNode> row ) { SquareEdge e; while( (e = n.edges[corner]) != null ) { if( e.a == n ) { n = e.b; corner = e.sideB; } else { n = e.a; corner = e.sideA; } if( !skip ) { if( n.graph != SquareNode.R...
java
boolean addToRow( SquareNode n , int corner , int sign , boolean skip , List<SquareNode> row ) { SquareEdge e; while( (e = n.edges[corner]) != null ) { if( e.a == n ) { n = e.b; corner = e.sideB; } else { n = e.a; corner = e.sideA; } if( !skip ) { if( n.graph != SquareNode.R...
[ "boolean", "addToRow", "(", "SquareNode", "n", ",", "int", "corner", ",", "int", "sign", ",", "boolean", "skip", ",", "List", "<", "SquareNode", ">", "row", ")", "{", "SquareEdge", "e", ";", "while", "(", "(", "e", "=", "n", ".", "edges", "[", "cor...
Given a node and the corner to the next node down the line, add to the list every other node until it hits the end of the row. @param n Initial node @param corner Which corner points to the next node @param sign Determines the direction it will traverse. -1 or 1 @param skip true = start adding nodes at second, false =...
[ "Given", "a", "node", "and", "the", "corner", "to", "the", "next", "node", "down", "the", "line", "add", "to", "the", "list", "every", "other", "node", "until", "it", "hits", "the", "end", "of", "the", "row", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L399-L425
49,624
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java
SquareCrossClustersIntoGrids.findSeedNode
static SquareNode findSeedNode(List<SquareNode> cluster) { SquareNode seed = null; for (int i = 0; i < cluster.size(); i++) { SquareNode n = cluster.get(i); int numConnections = n.getNumberOfConnections(); if( numConnections == 0 || numConnections > 2 ) continue; seed = n; break; } return se...
java
static SquareNode findSeedNode(List<SquareNode> cluster) { SquareNode seed = null; for (int i = 0; i < cluster.size(); i++) { SquareNode n = cluster.get(i); int numConnections = n.getNumberOfConnections(); if( numConnections == 0 || numConnections > 2 ) continue; seed = n; break; } return se...
[ "static", "SquareNode", "findSeedNode", "(", "List", "<", "SquareNode", ">", "cluster", ")", "{", "SquareNode", "seed", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cluster", ".", "size", "(", ")", ";", "i", "++", ")", "{", ...
Finds a seed with 1 or 2 edges.
[ "Finds", "a", "seed", "with", "1", "or", "2", "edges", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareCrossClustersIntoGrids.java#L430-L442
49,625
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/chess/DetectChessboardCorners.java
DetectChessboardCorners.process
public void process( GrayF32 input ) { // System.out.println("ENTER CHESSBOARD CORNER "+input.width+" x "+input.height); borderImg.setImage(input); gradient.process(input,derivX,derivY); interpX.setImage(derivX); interpY.setImage(derivY); cornerIntensity.process(derivX,derivY,intensity); intensityInterp....
java
public void process( GrayF32 input ) { // System.out.println("ENTER CHESSBOARD CORNER "+input.width+" x "+input.height); borderImg.setImage(input); gradient.process(input,derivX,derivY); interpX.setImage(derivX); interpY.setImage(derivY); cornerIntensity.process(derivX,derivY,intensity); intensityInterp....
[ "public", "void", "process", "(", "GrayF32", "input", ")", "{", "//\t\tSystem.out.println(\"ENTER CHESSBOARD CORNER \"+input.width+\" x \"+input.height);", "borderImg", ".", "setImage", "(", "input", ")", ";", "gradient", ".", "process", "(", "input", ",", "derivX", ","...
Computes chessboard corners inside the image @param input Gray image. Not modified.
[ "Computes", "chessboard", "corners", "inside", "the", "image" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/chess/DetectChessboardCorners.java#L144-L199
49,626
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/chess/DetectChessboardCorners.java
DetectChessboardCorners.meanShiftLocation
public void meanShiftLocation( ChessboardCorner c ) { float meanX = (float)c.x; float meanY = (float)c.y; // The peak in intensity will be in -r to r region, but smaller values will be -2*r to 2*r int radius = this.shiRadius*2; for (int iteration = 0; iteration < 5; iteration++) { float adjX = 0; float...
java
public void meanShiftLocation( ChessboardCorner c ) { float meanX = (float)c.x; float meanY = (float)c.y; // The peak in intensity will be in -r to r region, but smaller values will be -2*r to 2*r int radius = this.shiRadius*2; for (int iteration = 0; iteration < 5; iteration++) { float adjX = 0; float...
[ "public", "void", "meanShiftLocation", "(", "ChessboardCorner", "c", ")", "{", "float", "meanX", "=", "(", "float", ")", "c", ".", "x", ";", "float", "meanY", "=", "(", "float", ")", "c", ".", "y", ";", "// The peak in intensity will be in -r to r region, but ...
Use mean shift to improve the accuracy of the corner's location. A kernel is selected which is slightly larger than the "flat" intensity of the corner should be when over a chess pattern.
[ "Use", "mean", "shift", "to", "improve", "the", "accuracy", "of", "the", "corner", "s", "location", ".", "A", "kernel", "is", "selected", "which", "is", "slightly", "larger", "than", "the", "flat", "intensity", "of", "the", "corner", "should", "be", "when"...
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/chess/DetectChessboardCorners.java#L283-L312
49,627
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java
VisualizeCamera2Activity.setThreadPoolSize
public void setThreadPoolSize( int threads ) { if( threads <= 0 ) throw new IllegalArgumentException("Number of threads must be greater than 0"); if( verbose ) Log.i(TAG,"setThreadPoolSize("+threads+")"); threadPool.setCorePoolSize(threads); threadPool.setMaximumPoolSize(threads); }
java
public void setThreadPoolSize( int threads ) { if( threads <= 0 ) throw new IllegalArgumentException("Number of threads must be greater than 0"); if( verbose ) Log.i(TAG,"setThreadPoolSize("+threads+")"); threadPool.setCorePoolSize(threads); threadPool.setMaximumPoolSize(threads); }
[ "public", "void", "setThreadPoolSize", "(", "int", "threads", ")", "{", "if", "(", "threads", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Number of threads must be greater than 0\"", ")", ";", "if", "(", "verbose", ")", "Log", ".", "i", ...
Specifies the number of threads in the thread-pool. If this is set to a value greater than one you better know how to write concurrent code or else you're going to have a bad time.
[ "Specifies", "the", "number", "of", "threads", "in", "the", "thread", "-", "pool", ".", "If", "this", "is", "set", "to", "a", "value", "greater", "than", "one", "you", "better", "know", "how", "to", "write", "concurrent", "code", "or", "else", "you", "...
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java#L163-L171
49,628
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java
VisualizeCamera2Activity.selectResolution
@Override protected int selectResolution( int widthTexture, int heightTexture, Size[] resolutions ) { // just wanted to make sure this has been cleaned up timeOfLastUpdated = 0; // select the resolution here int bestIndex = -1; double bestAspect = Double.MAX_VALUE; double bestArea = 0; for( int i = 0;...
java
@Override protected int selectResolution( int widthTexture, int heightTexture, Size[] resolutions ) { // just wanted to make sure this has been cleaned up timeOfLastUpdated = 0; // select the resolution here int bestIndex = -1; double bestAspect = Double.MAX_VALUE; double bestArea = 0; for( int i = 0;...
[ "@", "Override", "protected", "int", "selectResolution", "(", "int", "widthTexture", ",", "int", "heightTexture", ",", "Size", "[", "]", "resolutions", ")", "{", "// just wanted to make sure this has been cleaned up", "timeOfLastUpdated", "=", "0", ";", "// select the r...
Selects a resolution which has the number of pixels closest to the requested value
[ "Selects", "a", "resolution", "which", "has", "the", "number", "of", "pixels", "closest", "to", "the", "requested", "value" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java#L209-L240
49,629
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java
VisualizeCamera2Activity.setImageType
protected void setImageType( ImageType type , ColorFormat colorFormat ) { synchronized (boofImage.imageLock){ boofImage.colorFormat = colorFormat; if( !boofImage.imageType.isSameType( type ) ) { boofImage.imageType = type; boofImage.stackImages.clear(); } synchronized (lockTiming) { totalConv...
java
protected void setImageType( ImageType type , ColorFormat colorFormat ) { synchronized (boofImage.imageLock){ boofImage.colorFormat = colorFormat; if( !boofImage.imageType.isSameType( type ) ) { boofImage.imageType = type; boofImage.stackImages.clear(); } synchronized (lockTiming) { totalConv...
[ "protected", "void", "setImageType", "(", "ImageType", "type", ",", "ColorFormat", "colorFormat", ")", "{", "synchronized", "(", "boofImage", ".", "imageLock", ")", "{", "boofImage", ".", "colorFormat", "=", "colorFormat", ";", "if", "(", "!", "boofImage", "."...
Changes the type of image the camera frame is converted to
[ "Changes", "the", "type", "of", "image", "the", "camera", "frame", "is", "converted", "to" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java#L325-L338
49,630
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java
VisualizeCamera2Activity.renderBitmapImage
protected void renderBitmapImage( BitmapMode mode , ImageBase image ) { switch( mode ) { case UNSAFE: { if (image.getWidth() == bitmap.getWidth() && image.getHeight() == bitmap.getHeight()) ConvertBitmap.boofToBitmap(image, bitmap, bitmapTmp); } break; case DOUBLE_BUFFER: { // TODO if there are...
java
protected void renderBitmapImage( BitmapMode mode , ImageBase image ) { switch( mode ) { case UNSAFE: { if (image.getWidth() == bitmap.getWidth() && image.getHeight() == bitmap.getHeight()) ConvertBitmap.boofToBitmap(image, bitmap, bitmapTmp); } break; case DOUBLE_BUFFER: { // TODO if there are...
[ "protected", "void", "renderBitmapImage", "(", "BitmapMode", "mode", ",", "ImageBase", "image", ")", "{", "switch", "(", "mode", ")", "{", "case", "UNSAFE", ":", "{", "if", "(", "image", ".", "getWidth", "(", ")", "==", "bitmap", ".", "getWidth", "(", ...
Renders the bitmap image to output. If you don't wish to have this behavior then override this function. Jsut make sure you respect the bitmap mode or the image might not render as desired or you could crash the app.
[ "Renders", "the", "bitmap", "image", "to", "output", ".", "If", "you", "don", "t", "wish", "to", "have", "this", "behavior", "then", "override", "this", "function", ".", "Jsut", "make", "sure", "you", "respect", "the", "bitmap", "mode", "or", "the", "ima...
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java#L420-L447
49,631
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java
VisualizeCamera2Activity.onDrawFrame
protected void onDrawFrame( SurfaceView view , Canvas canvas ) { // Code below is usefull when debugging display issues // Paint paintFill = new Paint(); // paintFill.setColor(Color.RED); // paintFill.setStyle(Paint.Style.FILL); // Paint paintBorder = new Paint(); // paintBorder.setColor(Color.BLUE); // paintB...
java
protected void onDrawFrame( SurfaceView view , Canvas canvas ) { // Code below is usefull when debugging display issues // Paint paintFill = new Paint(); // paintFill.setColor(Color.RED); // paintFill.setStyle(Paint.Style.FILL); // Paint paintBorder = new Paint(); // paintBorder.setColor(Color.BLUE); // paintB...
[ "protected", "void", "onDrawFrame", "(", "SurfaceView", "view", ",", "Canvas", "canvas", ")", "{", "// Code below is usefull when debugging display issues", "//\t\tPaint paintFill = new Paint();", "//\t\tpaintFill.setColor(Color.RED);", "//\t\tpaintFill.setStyle(Paint.Style.FILL);", "/...
Renders the visualizations. Override and invoke super to add your own
[ "Renders", "the", "visualizations", ".", "Override", "and", "invoke", "super", "to", "add", "your", "own" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java#L452-L480
49,632
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/intensity/FactoryIntensityPoint.java
FactoryIntensityPoint.median
public static <I extends ImageGray<I>, D extends ImageGray<D>> GeneralFeatureIntensity<I,D> median( int radius , Class<I> imageType ) { BlurStorageFilter<I> filter = FactoryBlurFilter.median(ImageType.single(imageType),radius); return new WrapperMedianCornerIntensity<>(filter); }
java
public static <I extends ImageGray<I>, D extends ImageGray<D>> GeneralFeatureIntensity<I,D> median( int radius , Class<I> imageType ) { BlurStorageFilter<I> filter = FactoryBlurFilter.median(ImageType.single(imageType),radius); return new WrapperMedianCornerIntensity<>(filter); }
[ "public", "static", "<", "I", "extends", "ImageGray", "<", "I", ">", ",", "D", "extends", "ImageGray", "<", "D", ">", ">", "GeneralFeatureIntensity", "<", "I", ",", "D", ">", "median", "(", "int", "radius", ",", "Class", "<", "I", ">", "imageType", "...
Feature intensity for median corner detector. @param radius Size of the feature it detects, @param <I> Input image type. @return Median feature intensity
[ "Feature", "intensity", "for", "median", "corner", "detector", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/intensity/FactoryIntensityPoint.java#L112-L116
49,633
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/intensity/FactoryIntensityPoint.java
FactoryIntensityPoint.hessian
public static <I extends ImageGray<I>, D extends ImageGray<D>> GeneralFeatureIntensity<I,D> hessian(HessianBlobIntensity.Type type, Class<D> derivType) { return new WrapperHessianBlobIntensity<>(type, derivType); }
java
public static <I extends ImageGray<I>, D extends ImageGray<D>> GeneralFeatureIntensity<I,D> hessian(HessianBlobIntensity.Type type, Class<D> derivType) { return new WrapperHessianBlobIntensity<>(type, derivType); }
[ "public", "static", "<", "I", "extends", "ImageGray", "<", "I", ">", ",", "D", "extends", "ImageGray", "<", "D", ">", ">", "GeneralFeatureIntensity", "<", "I", ",", "D", ">", "hessian", "(", "HessianBlobIntensity", ".", "Type", "type", ",", "Class", "<",...
Blob detector which uses the image's second order derivatives directly. @see HessianBlobIntensity @param type Type of Hessian @param <I> Input image type. @param <D> Derivative type. @return Hessian based blob intensity
[ "Blob", "detector", "which", "uses", "the", "image", "s", "second", "order", "derivatives", "directly", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/intensity/FactoryIntensityPoint.java#L128-L131
49,634
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/PointTrackerKltPyramid.java
PointTrackerKltPyramid.getInactiveTracks
@Override public List<PointTrack> getInactiveTracks(List<PointTrack> list) { if( list == null ) list = new ArrayList<>(); return list; }
java
@Override public List<PointTrack> getInactiveTracks(List<PointTrack> list) { if( list == null ) list = new ArrayList<>(); return list; }
[ "@", "Override", "public", "List", "<", "PointTrack", ">", "getInactiveTracks", "(", "List", "<", "PointTrack", ">", "list", ")", "{", "if", "(", "list", "==", "null", ")", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "return", "list", ";", ...
KLT does not have inactive tracks since all tracks are dropped if a problem occurs.
[ "KLT", "does", "not", "have", "inactive", "tracks", "since", "all", "tracks", "are", "dropped", "if", "a", "problem", "occurs", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/PointTrackerKltPyramid.java#L305-L311
49,635
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/impl/ImplSsdCorner_F32_MT.java
ImplSsdCorner_F32_MT.horizontal
@Override protected void horizontal() { float[] dataX = derivX.data; float[] dataY = derivY.data; float[] hXX = horizXX.data; float[] hXY = horizXY.data; float[] hYY = horizYY.data; final int imgHeight = derivX.getHeight(); final int imgWidth = derivX.getWidth(); int windowWidth = radius * 2 + 1; ...
java
@Override protected void horizontal() { float[] dataX = derivX.data; float[] dataY = derivY.data; float[] hXX = horizXX.data; float[] hXY = horizXY.data; float[] hYY = horizYY.data; final int imgHeight = derivX.getHeight(); final int imgWidth = derivX.getWidth(); int windowWidth = radius * 2 + 1; ...
[ "@", "Override", "protected", "void", "horizontal", "(", ")", "{", "float", "[", "]", "dataX", "=", "derivX", ".", "data", ";", "float", "[", "]", "dataY", "=", "derivY", ".", "data", ";", "float", "[", "]", "hXX", "=", "horizXX", ".", "data", ";",...
Compute the derivative sum along the x-axis while taking advantage of duplicate calculations for each window.
[ "Compute", "the", "derivative", "sum", "along", "the", "x", "-", "axis", "while", "taking", "advantage", "of", "duplicate", "calculations", "for", "each", "window", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/impl/ImplSsdCorner_F32_MT.java#L59-L124
49,636
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/impl/ImplSsdCorner_F32_MT.java
ImplSsdCorner_F32_MT.vertical
@Override protected void vertical( GrayF32 intensity ) { float[] hXX = horizXX.data; float[] hXY = horizXY.data; float[] hYY = horizYY.data; final float[] inten = intensity.data; final int imgHeight = horizXX.getHeight(); final int imgWidth = horizXX.getWidth(); final int kernelWidth = radius * 2 + 1; ...
java
@Override protected void vertical( GrayF32 intensity ) { float[] hXX = horizXX.data; float[] hXY = horizXY.data; float[] hYY = horizYY.data; final float[] inten = intensity.data; final int imgHeight = horizXX.getHeight(); final int imgWidth = horizXX.getWidth(); final int kernelWidth = radius * 2 + 1; ...
[ "@", "Override", "protected", "void", "vertical", "(", "GrayF32", "intensity", ")", "{", "float", "[", "]", "hXX", "=", "horizXX", ".", "data", ";", "float", "[", "]", "hXY", "=", "horizXY", ".", "data", ";", "float", "[", "]", "hYY", "=", "horizYY",...
Compute the derivative sum along the y-axis while taking advantage of duplicate calculations for each window and avoiding cache misses. Then compute the eigen values
[ "Compute", "the", "derivative", "sum", "along", "the", "y", "-", "axis", "while", "taking", "advantage", "of", "duplicate", "calculations", "for", "each", "window", "and", "avoiding", "cache", "misses", ".", "Then", "compute", "the", "eigen", "values" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/impl/ImplSsdCorner_F32_MT.java#L130-L193
49,637
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/distort/DistortImageOps.java
DistortImageOps.distortSingle
public static <Input extends ImageGray<Input>,Output extends ImageGray<Output>> void distortSingle(Input input, Output output, PixelTransform<Point2D_F32> transform, InterpolationType interpType, BorderType borderType) { boolean skip = borderType == BorderType.SKIP; if( skip ) borderType = Bord...
java
public static <Input extends ImageGray<Input>,Output extends ImageGray<Output>> void distortSingle(Input input, Output output, PixelTransform<Point2D_F32> transform, InterpolationType interpType, BorderType borderType) { boolean skip = borderType == BorderType.SKIP; if( skip ) borderType = Bord...
[ "public", "static", "<", "Input", "extends", "ImageGray", "<", "Input", ">", ",", "Output", "extends", "ImageGray", "<", "Output", ">", ">", "void", "distortSingle", "(", "Input", "input", ",", "Output", "output", ",", "PixelTransform", "<", "Point2D_F32", "...
Applies a pixel transform to a single band image. Easier to use function. @deprecated As of v0.19. Use {@link FDistort} instead @param input Input (source) image. @param output Where the result of transforming the image image is written to. @param transform The transform that is being applied to the image @param in...
[ "Applies", "a", "pixel", "transform", "to", "a", "single", "band", "image", ".", "Easier", "to", "use", "function", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/DistortImageOps.java#L105-L122
49,638
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/distort/DistortImageOps.java
DistortImageOps.distortSingle
public static <Input extends ImageGray<Input>,Output extends ImageGray<Output>> void distortSingle(Input input, Output output, boolean renderAll, PixelTransform<Point2D_F32> transform, InterpolatePixelS<Input> interp) { Class<Output> inputType = (Class<Output>)input.getClass(); ImageDistort<Input,...
java
public static <Input extends ImageGray<Input>,Output extends ImageGray<Output>> void distortSingle(Input input, Output output, boolean renderAll, PixelTransform<Point2D_F32> transform, InterpolatePixelS<Input> interp) { Class<Output> inputType = (Class<Output>)input.getClass(); ImageDistort<Input,...
[ "public", "static", "<", "Input", "extends", "ImageGray", "<", "Input", ">", ",", "Output", "extends", "ImageGray", "<", "Output", ">", ">", "void", "distortSingle", "(", "Input", "input", ",", "Output", "output", ",", "boolean", "renderAll", ",", "PixelTran...
Applies a pixel transform to a single band image. More flexible but order to use function. @deprecated As of v0.19. Use {@link FDistort} instead @param input Input (source) image. @param output Where the result of transforming the image image is written to. @param renderAll true it renders all pixels, even ones out...
[ "Applies", "a", "pixel", "transform", "to", "a", "single", "band", "image", ".", "More", "flexible", "but", "order", "to", "use", "function", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/DistortImageOps.java#L135-L145
49,639
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/distort/DistortImageOps.java
DistortImageOps.scale
@Deprecated public static <T extends ImageBase<T>> void scale(T input, T output, BorderType borderType, InterpolationType interpType) { PixelTransformAffine_F32 model = DistortSupport.transformScale(output, input, null); if( input instanceof ImageGray) { distortSingle((ImageGray) input, (ImageGray) output, m...
java
@Deprecated public static <T extends ImageBase<T>> void scale(T input, T output, BorderType borderType, InterpolationType interpType) { PixelTransformAffine_F32 model = DistortSupport.transformScale(output, input, null); if( input instanceof ImageGray) { distortSingle((ImageGray) input, (ImageGray) output, m...
[ "@", "Deprecated", "public", "static", "<", "T", "extends", "ImageBase", "<", "T", ">", ">", "void", "scale", "(", "T", "input", ",", "T", "output", ",", "BorderType", "borderType", ",", "InterpolationType", "interpType", ")", "{", "PixelTransformAffine_F32", ...
Rescales the input image and writes the results into the output image. The scale factor is determined independently of the width and height. @param input Input image. Not modified. @param output Rescaled input image. Modified. @param borderType Describes how pixels outside the image border should be handled. @param in...
[ "Rescales", "the", "input", "image", "and", "writes", "the", "results", "into", "the", "output", "image", ".", "The", "scale", "factor", "is", "determined", "independently", "of", "the", "width", "and", "height", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/DistortImageOps.java#L209-L220
49,640
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/distort/DistortImageOps.java
DistortImageOps.boundBox
public static RectangleLength2D_I32 boundBox( int srcWidth , int srcHeight , int dstWidth , int dstHeight , Point2D_F32 work, PixelTransform<Point2D_F32> transform ) { RectangleLength2D_I32 ret = boundBox(srcWidth,srcHeight,work,transform); int x0 = ret.x0; int y0 = ret...
java
public static RectangleLength2D_I32 boundBox( int srcWidth , int srcHeight , int dstWidth , int dstHeight , Point2D_F32 work, PixelTransform<Point2D_F32> transform ) { RectangleLength2D_I32 ret = boundBox(srcWidth,srcHeight,work,transform); int x0 = ret.x0; int y0 = ret...
[ "public", "static", "RectangleLength2D_I32", "boundBox", "(", "int", "srcWidth", ",", "int", "srcHeight", ",", "int", "dstWidth", ",", "int", "dstHeight", ",", "Point2D_F32", "work", ",", "PixelTransform", "<", "Point2D_F32", ">", "transform", ")", "{", "Rectang...
Finds an axis-aligned bounding box which would contain a image after it has been transformed. A sanity check is done to made sure it is contained inside the destination image's bounds. If it is totally outside then a rectangle with negative width or height is returned. @param srcWidth Width of the source image @param ...
[ "Finds", "an", "axis", "-", "aligned", "bounding", "box", "which", "would", "contain", "a", "image", "after", "it", "has", "been", "transformed", ".", "A", "sanity", "check", "is", "done", "to", "made", "sure", "it", "is", "contained", "inside", "the", "...
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/DistortImageOps.java#L289-L307
49,641
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/sfot/SparseFlowObjectTracker.java
SparseFlowObjectTracker.update
public boolean update( Image input , RectangleRotate_F64 output ) { if( trackLost ) return false; trackFeatures(input, region); // See if there are enough points remaining. use of config.numberOfSamples is some what arbitrary if( pairs.size() < config.numberOfSamples ) { System.out.println("Lack of sa...
java
public boolean update( Image input , RectangleRotate_F64 output ) { if( trackLost ) return false; trackFeatures(input, region); // See if there are enough points remaining. use of config.numberOfSamples is some what arbitrary if( pairs.size() < config.numberOfSamples ) { System.out.println("Lack of sa...
[ "public", "boolean", "update", "(", "Image", "input", ",", "RectangleRotate_F64", "output", ")", "{", "if", "(", "trackLost", ")", "return", "false", ";", "trackFeatures", "(", "input", ",", "region", ")", ";", "// See if there are enough points remaining. use of c...
Given the input image compute the new location of the target region and store the results in output. @param input next image in the sequence. @param output Storage for the output. @return true if tracking is successful
[ "Given", "the", "input", "image", "compute", "the", "new", "location", "of", "the", "target", "region", "and", "store", "the", "results", "in", "output", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/sfot/SparseFlowObjectTracker.java#L136-L186
49,642
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/sfot/SparseFlowObjectTracker.java
SparseFlowObjectTracker.trackFeatures
private void trackFeatures(Image input, RectangleRotate_F64 region) { pairs.reset(); currentImage.process(input); for( int i = 0; i < currentImage.getNumLayers(); i++ ) { Image layer = currentImage.getLayer(i); gradient.process(layer,currentDerivX[i],currentDerivY[i]); } // convert to float to avoid e...
java
private void trackFeatures(Image input, RectangleRotate_F64 region) { pairs.reset(); currentImage.process(input); for( int i = 0; i < currentImage.getNumLayers(); i++ ) { Image layer = currentImage.getLayer(i); gradient.process(layer,currentDerivX[i],currentDerivY[i]); } // convert to float to avoid e...
[ "private", "void", "trackFeatures", "(", "Image", "input", ",", "RectangleRotate_F64", "region", ")", "{", "pairs", ".", "reset", "(", ")", ";", "currentImage", ".", "process", "(", "input", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", ...
Tracks features from the previous image into the current image. Tracks are created inside the specified region in a grid pattern.
[ "Tracks", "features", "from", "the", "previous", "image", "into", "the", "current", "image", ".", "Tracks", "are", "created", "inside", "the", "specified", "region", "in", "a", "grid", "pattern", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/sfot/SparseFlowObjectTracker.java#L192-L262
49,643
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/sfot/SparseFlowObjectTracker.java
SparseFlowObjectTracker.declarePyramid
private void declarePyramid( int imageWidth , int imageHeight ) { int minSize = (config.trackerFeatureRadius*2+1)*5; int scales[] = TldTracker.selectPyramidScale(imageWidth, imageHeight, minSize); currentImage = FactoryPyramid.discreteGaussian(scales,-1,1,false, ImageType.single(imageType)); currentImage.initia...
java
private void declarePyramid( int imageWidth , int imageHeight ) { int minSize = (config.trackerFeatureRadius*2+1)*5; int scales[] = TldTracker.selectPyramidScale(imageWidth, imageHeight, minSize); currentImage = FactoryPyramid.discreteGaussian(scales,-1,1,false, ImageType.single(imageType)); currentImage.initia...
[ "private", "void", "declarePyramid", "(", "int", "imageWidth", ",", "int", "imageHeight", ")", "{", "int", "minSize", "=", "(", "config", ".", "trackerFeatureRadius", "*", "2", "+", "1", ")", "*", "5", ";", "int", "scales", "[", "]", "=", "TldTracker", ...
Declares internal data structures
[ "Declares", "internal", "data", "structures" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/sfot/SparseFlowObjectTracker.java#L267-L293
49,644
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/sfot/SparseFlowObjectTracker.java
SparseFlowObjectTracker.swapImages
private void swapImages() { ImagePyramid<Image> tempP; tempP = currentImage; currentImage = previousImage; previousImage = tempP; Derivative[] tempD; tempD = previousDerivX; previousDerivX = currentDerivX; currentDerivX = tempD; tempD = previousDerivY; previousDerivY = currentDerivY; currentDe...
java
private void swapImages() { ImagePyramid<Image> tempP; tempP = currentImage; currentImage = previousImage; previousImage = tempP; Derivative[] tempD; tempD = previousDerivX; previousDerivX = currentDerivX; currentDerivX = tempD; tempD = previousDerivY; previousDerivY = currentDerivY; currentDe...
[ "private", "void", "swapImages", "(", ")", "{", "ImagePyramid", "<", "Image", ">", "tempP", ";", "tempP", "=", "currentImage", ";", "currentImage", "=", "previousImage", ";", "previousImage", "=", "tempP", ";", "Derivative", "[", "]", "tempD", ";", "tempD", ...
Swaps the current and previous so that image derivative doesn't need to be recomputed or compied.
[ "Swaps", "the", "current", "and", "previous", "so", "that", "image", "derivative", "doesn", "t", "need", "to", "be", "recomputed", "or", "compied", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/sfot/SparseFlowObjectTracker.java#L298-L314
49,645
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/struct/flow/ImageFlow.java
ImageFlow.invalidateAll
public void invalidateAll() { int N = width*height; for( int i = 0; i < N; i++ ) data[i].x = Float.NaN; }
java
public void invalidateAll() { int N = width*height; for( int i = 0; i < N; i++ ) data[i].x = Float.NaN; }
[ "public", "void", "invalidateAll", "(", ")", "{", "int", "N", "=", "width", "*", "height", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "N", ";", "i", "++", ")", "data", "[", "i", "]", ".", "x", "=", "Float", ".", "NaN", ";", "}" ]
Marks all pixels as having an invalid flow
[ "Marks", "all", "pixels", "as", "having", "an", "invalid", "flow" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/struct/flow/ImageFlow.java#L61-L65
49,646
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/EdgeIntensityEllipse.java
EdgeIntensityEllipse.process
public boolean process(EllipseRotated_F64 ellipse ) { // see if it's disabled if( numContourPoints <= 0 ) { score = 0; return true; } double cphi = Math.cos(ellipse.phi); double sphi = Math.sin(ellipse.phi); averageInside = 0; averageOutside = 0; int total = 0; for (int contourIndex = 0; con...
java
public boolean process(EllipseRotated_F64 ellipse ) { // see if it's disabled if( numContourPoints <= 0 ) { score = 0; return true; } double cphi = Math.cos(ellipse.phi); double sphi = Math.sin(ellipse.phi); averageInside = 0; averageOutside = 0; int total = 0; for (int contourIndex = 0; con...
[ "public", "boolean", "process", "(", "EllipseRotated_F64", "ellipse", ")", "{", "// see if it's disabled", "if", "(", "numContourPoints", "<=", "0", ")", "{", "score", "=", "0", ";", "return", "true", ";", "}", "double", "cphi", "=", "Math", ".", "cos", "(...
Processes the edge along the ellipse and determines if the edge intensity is strong enough to pass or not @param ellipse The ellipse in undistorted image coordinates. @return true if it passes or false if not
[ "Processes", "the", "edge", "along", "the", "ellipse", "and", "determines", "if", "the", "edge", "intensity", "is", "strong", "enough", "to", "pass", "or", "not" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/EdgeIntensityEllipse.java#L79-L136
49,647
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/UnrollSiftScaleSpaceGradient.java
UnrollSiftScaleSpaceGradient.setImage
public void setImage(GrayF32 image) { scaleSpace.initialize(image); usedScales.clear(); do { for (int i = 0; i < scaleSpace.getNumScales(); i++) { GrayF32 scaleImage = scaleSpace.getImageScale(i); double sigma = scaleSpace.computeSigmaScale(i); double pixelCurrentToInput = scaleSpace.pixelScaleCu...
java
public void setImage(GrayF32 image) { scaleSpace.initialize(image); usedScales.clear(); do { for (int i = 0; i < scaleSpace.getNumScales(); i++) { GrayF32 scaleImage = scaleSpace.getImageScale(i); double sigma = scaleSpace.computeSigmaScale(i); double pixelCurrentToInput = scaleSpace.pixelScaleCu...
[ "public", "void", "setImage", "(", "GrayF32", "image", ")", "{", "scaleSpace", ".", "initialize", "(", "image", ")", ";", "usedScales", ".", "clear", "(", ")", ";", "do", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "scaleSpace", ".", "get...
Sets the input image. Scale-space is computed and unrolled from this image @param image
[ "Sets", "the", "input", "image", ".", "Scale", "-", "space", "is", "computed", "and", "unrolled", "from", "this", "image" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/UnrollSiftScaleSpaceGradient.java#L61-L83
49,648
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/UnrollSiftScaleSpaceGradient.java
UnrollSiftScaleSpaceGradient.lookup
public ImageScale lookup( double sigma ) { ImageScale best = null; double bestValue = Double.MAX_VALUE; for (int i = 0; i < usedScales.size(); i++) { ImageScale image = usedScales.get(i); double difference = Math.abs(sigma-image.sigma); if( difference < bestValue ) { bestValue = difference; best...
java
public ImageScale lookup( double sigma ) { ImageScale best = null; double bestValue = Double.MAX_VALUE; for (int i = 0; i < usedScales.size(); i++) { ImageScale image = usedScales.get(i); double difference = Math.abs(sigma-image.sigma); if( difference < bestValue ) { bestValue = difference; best...
[ "public", "ImageScale", "lookup", "(", "double", "sigma", ")", "{", "ImageScale", "best", "=", "null", ";", "double", "bestValue", "=", "Double", ".", "MAX_VALUE", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "usedScales", ".", "size", "(", ...
Looks up the image which is closest specified sigma
[ "Looks", "up", "the", "image", "which", "is", "closest", "specified", "sigma" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/UnrollSiftScaleSpaceGradient.java#L89-L102
49,649
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/bundle/jacobians/BundleCameraNumericJacobian.java
BundleCameraNumericJacobian.setModel
public void setModel( BundleAdjustmentCamera model ) { this.model = model; numIntrinsic = model.getIntrinsicCount(); if( numIntrinsic > intrinsic.length ) { intrinsic = new double[numIntrinsic]; } model.getIntrinsic(intrinsic,0); numericalPoint = createNumericalAlgorithm(funcPoint); numericalIntrinsic...
java
public void setModel( BundleAdjustmentCamera model ) { this.model = model; numIntrinsic = model.getIntrinsicCount(); if( numIntrinsic > intrinsic.length ) { intrinsic = new double[numIntrinsic]; } model.getIntrinsic(intrinsic,0); numericalPoint = createNumericalAlgorithm(funcPoint); numericalIntrinsic...
[ "public", "void", "setModel", "(", "BundleAdjustmentCamera", "model", ")", "{", "this", ".", "model", "=", "model", ";", "numIntrinsic", "=", "model", ".", "getIntrinsicCount", "(", ")", ";", "if", "(", "numIntrinsic", ">", "intrinsic", ".", "length", ")", ...
Specifies the camera model. The current state of its intrinsic parameters @param model
[ "Specifies", "the", "camera", "model", ".", "The", "current", "state", "of", "its", "intrinsic", "parameters" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/bundle/jacobians/BundleCameraNumericJacobian.java#L62-L72
49,650
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/associate/AssociateGreedy.java
AssociateGreedy.associate
@Override public void associate( FastQueue<D> src , FastQueue<D> dst ) { fitQuality.reset(); pairs.reset(); workBuffer.reset(); pairs.resize(src.size); fitQuality.resize(src.size); workBuffer.resize(src.size*dst.size); //CONCURRENT_BELOW BoofConcurrency.loopFor(0, src.size, i -> { for( int i = 0; i ...
java
@Override public void associate( FastQueue<D> src , FastQueue<D> dst ) { fitQuality.reset(); pairs.reset(); workBuffer.reset(); pairs.resize(src.size); fitQuality.resize(src.size); workBuffer.resize(src.size*dst.size); //CONCURRENT_BELOW BoofConcurrency.loopFor(0, src.size, i -> { for( int i = 0; i ...
[ "@", "Override", "public", "void", "associate", "(", "FastQueue", "<", "D", ">", "src", ",", "FastQueue", "<", "D", ">", "dst", ")", "{", "fitQuality", ".", "reset", "(", ")", ";", "pairs", ".", "reset", "(", ")", ";", "workBuffer", ".", "reset", "...
Associates the two sets objects against each other by minimizing fit score. @param src Source list. @param dst Destination list.
[ "Associates", "the", "two", "sets", "objects", "against", "each", "other", "by", "minimizing", "fit", "score", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/associate/AssociateGreedy.java#L64-L118
49,651
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java
QrCodeAlignmentPatternLocator.process
public boolean process(T image , QrCode qr ) { this.qr = qr; // this must be cleared before calling setMarker or else the distortion will be messed up qr.alignment.reset(); reader.setImage(image); reader.setMarker(qr); threshold = (float)qr.threshCorner; initializePatterns(qr); // version 1 has no a...
java
public boolean process(T image , QrCode qr ) { this.qr = qr; // this must be cleared before calling setMarker or else the distortion will be messed up qr.alignment.reset(); reader.setImage(image); reader.setMarker(qr); threshold = (float)qr.threshCorner; initializePatterns(qr); // version 1 has no a...
[ "public", "boolean", "process", "(", "T", "image", ",", "QrCode", "qr", ")", "{", "this", ".", "qr", "=", "qr", ";", "// this must be cleared before calling setMarker or else the distortion will be messed up", "qr", ".", "alignment", ".", "reset", "(", ")", ";", "...
Uses the previously detected position patterns to seed the search for the alignment patterns
[ "Uses", "the", "previously", "detected", "position", "patterns", "to", "seed", "the", "search", "for", "the", "alignment", "patterns" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java#L56-L72
49,652
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java
QrCodeAlignmentPatternLocator.initializePatterns
void initializePatterns(QrCode qr) { int where[] = QrCode.VERSION_INFO[qr.version].alignment; qr.alignment.reset(); lookup.reset(); for (int row = 0; row < where.length; row++ ) { for (int col = 0; col < where.length; col++) { boolean skip = false; if( row == 0 && col == 0 ) skip = true; els...
java
void initializePatterns(QrCode qr) { int where[] = QrCode.VERSION_INFO[qr.version].alignment; qr.alignment.reset(); lookup.reset(); for (int row = 0; row < where.length; row++ ) { for (int col = 0; col < where.length; col++) { boolean skip = false; if( row == 0 && col == 0 ) skip = true; els...
[ "void", "initializePatterns", "(", "QrCode", "qr", ")", "{", "int", "where", "[", "]", "=", "QrCode", ".", "VERSION_INFO", "[", "qr", ".", "version", "]", ".", "alignment", ";", "qr", ".", "alignment", ".", "reset", "(", ")", ";", "lookup", ".", "res...
Creates a list of alignment patterns to look for and their grid coordinates
[ "Creates", "a", "list", "of", "alignment", "patterns", "to", "look", "for", "and", "their", "grid", "coordinates" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java#L83-L107
49,653
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java
QrCodeAlignmentPatternLocator.centerOnSquare
boolean centerOnSquare(QrCode.Alignment pattern, float guessY, float guessX) { float step = 1; float bestMag = Float.MAX_VALUE; float bestX = guessX; float bestY = guessY; for (int i = 0; i < 10; i++) { for (int row = 0; row < 3; row++) { float gridy = guessY - 1f + row; for (int col = 0; col < 3;...
java
boolean centerOnSquare(QrCode.Alignment pattern, float guessY, float guessX) { float step = 1; float bestMag = Float.MAX_VALUE; float bestX = guessX; float bestY = guessY; for (int i = 0; i < 10; i++) { for (int row = 0; row < 3; row++) { float gridy = guessY - 1f + row; for (int col = 0; col < 3;...
[ "boolean", "centerOnSquare", "(", "QrCode", ".", "Alignment", "pattern", ",", "float", "guessY", ",", "float", "guessX", ")", "{", "float", "step", "=", "1", ";", "float", "bestMag", "=", "Float", ".", "MAX_VALUE", ";", "float", "bestX", "=", "guessX", "...
If the initial guess is within the inner white circle or black dot this will ensure that it is centered on the black dot
[ "If", "the", "initial", "guess", "is", "within", "the", "inner", "white", "circle", "or", "black", "dot", "this", "will", "ensure", "that", "it", "is", "centered", "on", "the", "black", "dot" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java#L153-L198
49,654
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java
QrCodeAlignmentPatternLocator.localize
boolean localize(QrCode.Alignment pattern, float guessY, float guessX) { // sample along the middle. Try to not sample the outside edges which could confuse it for (int i = 0; i < arrayY.length; i++) { float x = guessX - 1.5f + i*3f/12.0f; float y = guessY - 1.5f + i*3f/12.0f; arrayX[i] = reader.read(gue...
java
boolean localize(QrCode.Alignment pattern, float guessY, float guessX) { // sample along the middle. Try to not sample the outside edges which could confuse it for (int i = 0; i < arrayY.length; i++) { float x = guessX - 1.5f + i*3f/12.0f; float y = guessY - 1.5f + i*3f/12.0f; arrayX[i] = reader.read(gue...
[ "boolean", "localize", "(", "QrCode", ".", "Alignment", "pattern", ",", "float", "guessY", ",", "float", "guessX", ")", "{", "// sample along the middle. Try to not sample the outside edges which could confuse it", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a...
Localizizes the alignment pattern crudely by searching for the black box in the center by looking for its edges in the gray scale image @return true if success or false if it doesn't resemble an alignment pattern
[ "Localizizes", "the", "alignment", "pattern", "crudely", "by", "searching", "for", "the", "black", "box", "in", "the", "center", "by", "looking", "for", "its", "edges", "in", "the", "gray", "scale", "image" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java#L206-L234
49,655
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/descriptor/ConvertDescriptors.java
ConvertDescriptors.positive
public static void positive( TupleDesc_F64 input , TupleDesc_U8 output ) { double max = 0; for( int i = 0; i < input.size(); i++ ) { double v = input.value[i]; if( v > max ) max = v; } if( max == 0 ) max = 1.0; for( int i = 0; i < input.size(); i++ ) { output.value[i] = (byte)(255.0*input.va...
java
public static void positive( TupleDesc_F64 input , TupleDesc_U8 output ) { double max = 0; for( int i = 0; i < input.size(); i++ ) { double v = input.value[i]; if( v > max ) max = v; } if( max == 0 ) max = 1.0; for( int i = 0; i < input.size(); i++ ) { output.value[i] = (byte)(255.0*input.va...
[ "public", "static", "void", "positive", "(", "TupleDesc_F64", "input", ",", "TupleDesc_U8", "output", ")", "{", "double", "max", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "input", ".", "size", "(", ")", ";", "i", "++", ")", ...
Converts a floating point description with all positive values into the 8-bit integer descriptor by dividing each element in the input by the element maximum value and multiplying by 255. @param input Description with elements that are all positive @param output Unsigned 8-bit output
[ "Converts", "a", "floating", "point", "description", "with", "all", "positive", "values", "into", "the", "8", "-", "bit", "integer", "descriptor", "by", "dividing", "each", "element", "in", "the", "input", "by", "the", "element", "maximum", "value", "and", "...
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/descriptor/ConvertDescriptors.java#L39-L53
49,656
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/descriptor/ConvertDescriptors.java
ConvertDescriptors.real
public static void real( TupleDesc_F64 input , TupleDesc_S8 output ) { double max = 0; for( int i = 0; i < input.size(); i++ ) { double v = Math.abs(input.value[i]); if( v > max ) max = v; } for( int i = 0; i < input.size(); i++ ) { output.value[i] = (byte)(127.0*input.value[i]/max); } }
java
public static void real( TupleDesc_F64 input , TupleDesc_S8 output ) { double max = 0; for( int i = 0; i < input.size(); i++ ) { double v = Math.abs(input.value[i]); if( v > max ) max = v; } for( int i = 0; i < input.size(); i++ ) { output.value[i] = (byte)(127.0*input.value[i]/max); } }
[ "public", "static", "void", "real", "(", "TupleDesc_F64", "input", ",", "TupleDesc_S8", "output", ")", "{", "double", "max", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "input", ".", "size", "(", ")", ";", "i", "++", ")", "{",...
Converts a floating point description with real values into the 8-bit integer descriptor by dividing each element in the input by the element maximum absolute value and multiplying by 127. @param input Description with elements that are all positive @param output Unsigned 8-bit output
[ "Converts", "a", "floating", "point", "description", "with", "real", "values", "into", "the", "8", "-", "bit", "integer", "descriptor", "by", "dividing", "each", "element", "in", "the", "input", "by", "the", "element", "maximum", "absolute", "value", "and", ...
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/descriptor/ConvertDescriptors.java#L62-L73
49,657
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/descriptor/ConvertDescriptors.java
ConvertDescriptors.convertNcc
public static void convertNcc( TupleDesc_F64 input , NccFeature output ) { if( input.size() != output.size() ) throw new IllegalArgumentException("Feature lengths do not match."); double mean = 0; for (int i = 0; i < input.value.length; i++) { mean += input.value[i]; } mean /= input.value.length; d...
java
public static void convertNcc( TupleDesc_F64 input , NccFeature output ) { if( input.size() != output.size() ) throw new IllegalArgumentException("Feature lengths do not match."); double mean = 0; for (int i = 0; i < input.value.length; i++) { mean += input.value[i]; } mean /= input.value.length; d...
[ "public", "static", "void", "convertNcc", "(", "TupleDesc_F64", "input", ",", "NccFeature", "output", ")", "{", "if", "(", "input", ".", "size", "(", ")", "!=", "output", ".", "size", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Featu...
Converts a regular feature description into a NCC feature description @param input Tuple descriptor. (not modified) @param output The equivalent NCC feature. (modified)
[ "Converts", "a", "regular", "feature", "description", "into", "a", "NCC", "feature", "description" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/descriptor/ConvertDescriptors.java#L80-L100
49,658
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/imageprocessing/ExampleConvolution.java
ExampleConvolution.convolve1D
private static void convolve1D(GrayU8 gray) { ImageBorder<GrayU8> border = FactoryImageBorder.wrap(BorderType.EXTENDED, gray); Kernel1D_S32 kernel = new Kernel1D_S32(2); kernel.offset = 1; // specify the kernel's origin kernel.data[0] = 1; kernel.data[1] = -1; GrayS16 output = new GrayS16(gray.width,gray.h...
java
private static void convolve1D(GrayU8 gray) { ImageBorder<GrayU8> border = FactoryImageBorder.wrap(BorderType.EXTENDED, gray); Kernel1D_S32 kernel = new Kernel1D_S32(2); kernel.offset = 1; // specify the kernel's origin kernel.data[0] = 1; kernel.data[1] = -1; GrayS16 output = new GrayS16(gray.width,gray.h...
[ "private", "static", "void", "convolve1D", "(", "GrayU8", "gray", ")", "{", "ImageBorder", "<", "GrayU8", ">", "border", "=", "FactoryImageBorder", ".", "wrap", "(", "BorderType", ".", "EXTENDED", ",", "gray", ")", ";", "Kernel1D_S32", "kernel", "=", "new", ...
Convolves a 1D kernel horizontally and vertically
[ "Convolves", "a", "1D", "kernel", "horizontally", "and", "vertically" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/imageprocessing/ExampleConvolution.java#L63-L77
49,659
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/imageprocessing/ExampleConvolution.java
ExampleConvolution.convolve2D
private static void convolve2D(GrayU8 gray) { // By default 2D kernels will be centered around width/2 Kernel2D_S32 kernel = new Kernel2D_S32(3); kernel.set(1,0,2); kernel.set(2,1,2); kernel.set(0,1,-2); kernel.set(1,2,-2); // Output needs to handle the increased domain after convolution. Can't be 8bit ...
java
private static void convolve2D(GrayU8 gray) { // By default 2D kernels will be centered around width/2 Kernel2D_S32 kernel = new Kernel2D_S32(3); kernel.set(1,0,2); kernel.set(2,1,2); kernel.set(0,1,-2); kernel.set(1,2,-2); // Output needs to handle the increased domain after convolution. Can't be 8bit ...
[ "private", "static", "void", "convolve2D", "(", "GrayU8", "gray", ")", "{", "// By default 2D kernels will be centered around width/2", "Kernel2D_S32", "kernel", "=", "new", "Kernel2D_S32", "(", "3", ")", ";", "kernel", ".", "set", "(", "1", ",", "0", ",", "2", ...
Convolves a 2D kernel
[ "Convolves", "a", "2D", "kernel" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/imageprocessing/ExampleConvolution.java#L82-L96
49,660
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/imageprocessing/ExampleConvolution.java
ExampleConvolution.normalize2D
private static void normalize2D(GrayU8 gray) { // Create a Gaussian kernel with radius of 3 Kernel2D_S32 kernel = FactoryKernelGaussian.gaussian2D(GrayU8.class, -1, 3); // Note that there is a more efficient way to compute this convolution since it is a separable kernel // just use BlurImageOps instead. // S...
java
private static void normalize2D(GrayU8 gray) { // Create a Gaussian kernel with radius of 3 Kernel2D_S32 kernel = FactoryKernelGaussian.gaussian2D(GrayU8.class, -1, 3); // Note that there is a more efficient way to compute this convolution since it is a separable kernel // just use BlurImageOps instead. // S...
[ "private", "static", "void", "normalize2D", "(", "GrayU8", "gray", ")", "{", "// Create a Gaussian kernel with radius of 3", "Kernel2D_S32", "kernel", "=", "FactoryKernelGaussian", ".", "gaussian2D", "(", "GrayU8", ".", "class", ",", "-", "1", ",", "3", ")", ";", ...
Convolves a 2D normalized kernel. This kernel is divided by its sum after computation.
[ "Convolves", "a", "2D", "normalized", "kernel", ".", "This", "kernel", "is", "divided", "by", "its", "sum", "after", "computation", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/imageprocessing/ExampleConvolution.java#L101-L112
49,661
lessthanoptimal/BoofCV
main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/Zhang99CalibrationMatrixFromHomographies.java
Zhang99CalibrationMatrixFromHomographies.process
public void process( List<DMatrixRMaj> homographies ) { if( assumeZeroSkew ) { if( homographies.size() < 2 ) throw new IllegalArgumentException("At least two homographies are required. Found "+homographies.size()); } else if( homographies.size() < 3 ) { throw new IllegalArgumentException("At least three h...
java
public void process( List<DMatrixRMaj> homographies ) { if( assumeZeroSkew ) { if( homographies.size() < 2 ) throw new IllegalArgumentException("At least two homographies are required. Found "+homographies.size()); } else if( homographies.size() < 3 ) { throw new IllegalArgumentException("At least three h...
[ "public", "void", "process", "(", "List", "<", "DMatrixRMaj", ">", "homographies", ")", "{", "if", "(", "assumeZeroSkew", ")", "{", "if", "(", "homographies", ".", "size", "(", ")", "<", "2", ")", "throw", "new", "IllegalArgumentException", "(", "\"At leas...
Given a set of homographies computed from a sequence of images that observe the same plane it estimates the camera's calibration. @param homographies Homographies computed from observations of the calibration grid.
[ "Given", "a", "set", "of", "homographies", "computed", "from", "a", "sequence", "of", "images", "that", "observe", "the", "same", "plane", "it", "estimates", "the", "camera", "s", "calibration", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/Zhang99CalibrationMatrixFromHomographies.java#L93-L115
49,662
lessthanoptimal/BoofCV
main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/Zhang99CalibrationMatrixFromHomographies.java
Zhang99CalibrationMatrixFromHomographies.computeV
private void computeV( DMatrixRMaj h1 ,DMatrixRMaj h2 , DMatrixRMaj v ) { double h1x = h1.get(0,0); double h1y = h1.get(1,0); double h1z = h1.get(2,0); double h2x = h2.get(0,0); double h2y = h2.get(1,0); double h2z = h2.get(2,0); v.set(0,0,h1x*h2x); v.set(0,1,h1x*h2y+h1y*h2x); v.set(0,2,h1y*h2y); ...
java
private void computeV( DMatrixRMaj h1 ,DMatrixRMaj h2 , DMatrixRMaj v ) { double h1x = h1.get(0,0); double h1y = h1.get(1,0); double h1z = h1.get(2,0); double h2x = h2.get(0,0); double h2y = h2.get(1,0); double h2z = h2.get(2,0); v.set(0,0,h1x*h2x); v.set(0,1,h1x*h2y+h1y*h2x); v.set(0,2,h1y*h2y); ...
[ "private", "void", "computeV", "(", "DMatrixRMaj", "h1", ",", "DMatrixRMaj", "h2", ",", "DMatrixRMaj", "v", ")", "{", "double", "h1x", "=", "h1", ".", "get", "(", "0", ",", "0", ")", ";", "double", "h1y", "=", "h1", ".", "get", "(", "1", ",", "0"...
This computes the v_ij vector found in the paper.
[ "This", "computes", "the", "v_ij", "vector", "found", "in", "the", "paper", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/Zhang99CalibrationMatrixFromHomographies.java#L210-L226
49,663
lessthanoptimal/BoofCV
main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/Zhang99CalibrationMatrixFromHomographies.java
Zhang99CalibrationMatrixFromHomographies.computeParam
private void computeParam() { // reduce overflow/underflow CommonOps_DDRM.divide(b,CommonOps_DDRM.elementMaxAbs(b)); double B11 = b.get(0,0); double B12 = b.get(1,0); double B22 = b.get(2,0); double B13 = b.get(3,0); double B23 = b.get(4,0); double B33 = b.get(5,0); double temp0 = B12*B13 - B11*B23;...
java
private void computeParam() { // reduce overflow/underflow CommonOps_DDRM.divide(b,CommonOps_DDRM.elementMaxAbs(b)); double B11 = b.get(0,0); double B12 = b.get(1,0); double B22 = b.get(2,0); double B13 = b.get(3,0); double B23 = b.get(4,0); double B33 = b.get(5,0); double temp0 = B12*B13 - B11*B23;...
[ "private", "void", "computeParam", "(", ")", "{", "// reduce overflow/underflow", "CommonOps_DDRM", ".", "divide", "(", "b", ",", "CommonOps_DDRM", ".", "elementMaxAbs", "(", "b", ")", ")", ";", "double", "B11", "=", "b", ".", "get", "(", "0", ",", "0", ...
Compute the calibration parameters from the b matrix.
[ "Compute", "the", "calibration", "parameters", "from", "the", "b", "matrix", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/Zhang99CalibrationMatrixFromHomographies.java#L252-L282
49,664
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/impl/ImplIntegralImageFeatureIntensity.java
ImplIntegralImageFeatureIntensity.hessianNaive
public static void hessianNaive(GrayF32 integral, int skip , int size , GrayF32 intensity) { final int w = intensity.width; final int h = intensity.height; // get convolution kernels for the second order derivatives IntegralKernel kerXX = DerivativeIntegralImage.kernelDerivXX(size,null); IntegralKe...
java
public static void hessianNaive(GrayF32 integral, int skip , int size , GrayF32 intensity) { final int w = intensity.width; final int h = intensity.height; // get convolution kernels for the second order derivatives IntegralKernel kerXX = DerivativeIntegralImage.kernelDerivXX(size,null); IntegralKe...
[ "public", "static", "void", "hessianNaive", "(", "GrayF32", "integral", ",", "int", "skip", ",", "int", "size", ",", "GrayF32", "intensity", ")", "{", "final", "int", "w", "=", "intensity", ".", "width", ";", "final", "int", "h", "=", "intensity", ".", ...
Brute force approach which is easy to validate through visual inspection.
[ "Brute", "force", "approach", "which", "is", "easy", "to", "validate", "through", "visual", "inspection", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/impl/ImplIntegralImageFeatureIntensity.java#L45-L67
49,665
lessthanoptimal/BoofCV
demonstrations/src/main/java/boofcv/demonstrations/sfm/multiview/DemoThreeViewStereoApp.java
DemoThreeViewStereoApp.openImageSet
@Override public void openImageSet(String ...files ) { synchronized (lockProcessing) { if( processing ) { JOptionPane.showMessageDialog(this, "Still processing"); return; } } // disable the menu until it finish processing the images setMenuBarEnabled(false); super.openImageSet(files); }
java
@Override public void openImageSet(String ...files ) { synchronized (lockProcessing) { if( processing ) { JOptionPane.showMessageDialog(this, "Still processing"); return; } } // disable the menu until it finish processing the images setMenuBarEnabled(false); super.openImageSet(files); }
[ "@", "Override", "public", "void", "openImageSet", "(", "String", "...", "files", ")", "{", "synchronized", "(", "lockProcessing", ")", "{", "if", "(", "processing", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "this", ",", "\"Still processing\"", "...
Prevent the user from tring to process more than one image at once
[ "Prevent", "the", "user", "from", "tring", "to", "process", "more", "than", "one", "image", "at", "once" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/sfm/multiview/DemoThreeViewStereoApp.java#L203-L214
49,666
lessthanoptimal/BoofCV
demonstrations/src/main/java/boofcv/demonstrations/sfm/multiview/DemoThreeViewStereoApp.java
DemoThreeViewStereoApp.scaleBuffered
private BufferedImage scaleBuffered( BufferedImage input ) { int m = Math.max(input.getWidth(),input.getHeight()); if( m <= controls.maxImageSize ) return input; else { double scale = controls.maxImageSize/(double)m; int w = (int)(scale*input.getWidth()+0.5); int h = (int)(scale*input.getHeight()+0.5)...
java
private BufferedImage scaleBuffered( BufferedImage input ) { int m = Math.max(input.getWidth(),input.getHeight()); if( m <= controls.maxImageSize ) return input; else { double scale = controls.maxImageSize/(double)m; int w = (int)(scale*input.getWidth()+0.5); int h = (int)(scale*input.getHeight()+0.5)...
[ "private", "BufferedImage", "scaleBuffered", "(", "BufferedImage", "input", ")", "{", "int", "m", "=", "Math", ".", "max", "(", "input", ".", "getWidth", "(", ")", ",", "input", ".", "getHeight", "(", ")", ")", ";", "if", "(", "m", "<=", "controls", ...
Scale buffered image so that it meets the image size restrictions
[ "Scale", "buffered", "image", "so", "that", "it", "meets", "the", "image", "size", "restrictions" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/sfm/multiview/DemoThreeViewStereoApp.java#L309-L327
49,667
lessthanoptimal/BoofCV
demonstrations/src/main/java/boofcv/demonstrations/sfm/multiview/DemoThreeViewStereoApp.java
DemoThreeViewStereoApp.selectBestPair
private int[] selectBestPair( SceneStructureMetric structure ) { Se3_F64 w_to_0 = structure.views[0].worldToView; Se3_F64 w_to_1 = structure.views[1].worldToView; Se3_F64 w_to_2 = structure.views[2].worldToView; Se3_F64 view0_to_1 = w_to_0.invert(null).concat(w_to_1,null); Se3_F64 view0_to_2 = w_to_0.invert(...
java
private int[] selectBestPair( SceneStructureMetric structure ) { Se3_F64 w_to_0 = structure.views[0].worldToView; Se3_F64 w_to_1 = structure.views[1].worldToView; Se3_F64 w_to_2 = structure.views[2].worldToView; Se3_F64 view0_to_1 = w_to_0.invert(null).concat(w_to_1,null); Se3_F64 view0_to_2 = w_to_0.invert(...
[ "private", "int", "[", "]", "selectBestPair", "(", "SceneStructureMetric", "structure", ")", "{", "Se3_F64", "w_to_0", "=", "structure", ".", "views", "[", "0", "]", ".", "worldToView", ";", "Se3_F64", "w_to_1", "=", "structure", ".", "views", "[", "1", "]...
Select two views which are the closest to an idea stereo pair. Little rotation and little translation along z-axis
[ "Select", "two", "views", "which", "are", "the", "closest", "to", "an", "idea", "stereo", "pair", ".", "Little", "rotation", "and", "little", "translation", "along", "z", "-", "axis" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/sfm/multiview/DemoThreeViewStereoApp.java#L516-L544
49,668
lessthanoptimal/BoofCV
demonstrations/src/main/java/boofcv/demonstrations/sfm/multiview/DemoThreeViewStereoApp.java
DemoThreeViewStereoApp.score
private double score( Se3_F64 se ) { // Rodrigues_F64 rod = new Rodrigues_F64(); // ConvertRotation3D_F64.matrixToRodrigues(se.R,rod); double x = Math.abs(se.T.x); double y = Math.abs(se.T.y); double z = Math.abs(se.T.z)+1e-8; double r = Math.max(x/(y+z),y/(x+z)); // System.out.println(se.T+" angle="+rod...
java
private double score( Se3_F64 se ) { // Rodrigues_F64 rod = new Rodrigues_F64(); // ConvertRotation3D_F64.matrixToRodrigues(se.R,rod); double x = Math.abs(se.T.x); double y = Math.abs(se.T.y); double z = Math.abs(se.T.z)+1e-8; double r = Math.max(x/(y+z),y/(x+z)); // System.out.println(se.T+" angle="+rod...
[ "private", "double", "score", "(", "Se3_F64", "se", ")", "{", "//\t\tRodrigues_F64 rod = new Rodrigues_F64();", "//\t\tConvertRotation3D_F64.matrixToRodrigues(se.R,rod);", "double", "x", "=", "Math", ".", "abs", "(", "se", ".", "T", ".", "x", ")", ";", "double", "y"...
Give lower scores to transforms with no rotation and translations along x or y axis.
[ "Give", "lower", "scores", "to", "transforms", "with", "no", "rotation", "and", "translations", "along", "x", "or", "y", "axis", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/sfm/multiview/DemoThreeViewStereoApp.java#L549-L563
49,669
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/RefinePolygonToContour.java
RefinePolygonToContour.process
public void process(List<Point2D_I32> contour , GrowQueue_I32 vertexes , Polygon2D_F64 output ) { int numDecreasing = 0; for (int i = vertexes.size-1,j=0; j < vertexes.size; i=j,j++) { if( vertexes.get(i) > vertexes.get(j ) ) numDecreasing++; } boolean decreasing = numDecreasing > 1; output.vertexes...
java
public void process(List<Point2D_I32> contour , GrowQueue_I32 vertexes , Polygon2D_F64 output ) { int numDecreasing = 0; for (int i = vertexes.size-1,j=0; j < vertexes.size; i=j,j++) { if( vertexes.get(i) > vertexes.get(j ) ) numDecreasing++; } boolean decreasing = numDecreasing > 1; output.vertexes...
[ "public", "void", "process", "(", "List", "<", "Point2D_I32", ">", "contour", ",", "GrowQueue_I32", "vertexes", ",", "Polygon2D_F64", "output", ")", "{", "int", "numDecreasing", "=", "0", ";", "for", "(", "int", "i", "=", "vertexes", ".", "size", "-", "1...
Refines the estimate using all the points in the contour @param contour (Input) The shape's contour @param vertexes (Input) List of indexes that are vertexes in the contour @param output (Output) Storage for where the found polygon is saved to
[ "Refines", "the", "estimate", "using", "all", "the", "points", "in", "the", "contour" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/RefinePolygonToContour.java#L54-L100
49,670
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/struct/calib/CameraPinholeBrown.java
CameraPinholeBrown.isDistorted
public boolean isDistorted() { if( radial != null && radial.length > 0 ) { for (int i = 0; i < radial.length; i++) { if( radial[i] != 0 ) return true; } } return t1 != 0 || t2 != 0; }
java
public boolean isDistorted() { if( radial != null && radial.length > 0 ) { for (int i = 0; i < radial.length; i++) { if( radial[i] != 0 ) return true; } } return t1 != 0 || t2 != 0; }
[ "public", "boolean", "isDistorted", "(", ")", "{", "if", "(", "radial", "!=", "null", "&&", "radial", ".", "length", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "radial", ".", "length", ";", "i", "++", ")", "{", "if", ...
If true then distortion parameters are specified.
[ "If", "true", "then", "distortion", "parameters", "are", "specified", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/struct/calib/CameraPinholeBrown.java#L110-L118
49,671
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java
SquareRegularClustersIntoGrids.process
public void process( List<List<SquareNode>> clusters ) { valid.reset(); for( int i = 0; i < clusters.size(); i++ ) { List<SquareNode> graph = clusters.get(i); if( graph.size() < minimumElements ) continue; switch( checkNumberOfConnections(graph) ) { case 1:orderIntoLine(graph); break; case 2...
java
public void process( List<List<SquareNode>> clusters ) { valid.reset(); for( int i = 0; i < clusters.size(); i++ ) { List<SquareNode> graph = clusters.get(i); if( graph.size() < minimumElements ) continue; switch( checkNumberOfConnections(graph) ) { case 1:orderIntoLine(graph); break; case 2...
[ "public", "void", "process", "(", "List", "<", "List", "<", "SquareNode", ">", ">", "clusters", ")", "{", "valid", ".", "reset", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "clusters", ".", "size", "(", ")", ";", "i", "++", ...
Converts the set of provided clusters into ordered grids. @param clusters List of clustered nodes
[ "Converts", "the", "set", "of", "provided", "clusters", "into", "ordered", "grids", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java#L58-L73
49,672
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java
SquareRegularClustersIntoGrids.checkNumberOfConnections
int checkNumberOfConnections( List<SquareNode> graph ) { int histogram[] = new int[5]; for (int i = 0; i < graph.size(); i++) { histogram[ graph.get(i).getNumberOfConnections() ]++; } if( graph.size() == 1 ) { if( histogram[0] != 1 ) return 0; return 1; } else if( histogram[1] == 2 ) { // l...
java
int checkNumberOfConnections( List<SquareNode> graph ) { int histogram[] = new int[5]; for (int i = 0; i < graph.size(); i++) { histogram[ graph.get(i).getNumberOfConnections() ]++; } if( graph.size() == 1 ) { if( histogram[0] != 1 ) return 0; return 1; } else if( histogram[1] == 2 ) { // l...
[ "int", "checkNumberOfConnections", "(", "List", "<", "SquareNode", ">", "graph", ")", "{", "int", "histogram", "[", "]", "=", "new", "int", "[", "5", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "graph", ".", "size", "(", ")", ";", ...
Does a weak check on the number of edges in the graph. Since the structure isn't known it can't make harder checks @return 0 = not a grid. 1 = line, 2 = grud
[ "Does", "a", "weak", "check", "on", "the", "number", "of", "edges", "in", "the", "graph", ".", "Since", "the", "structure", "isn", "t", "known", "it", "can", "t", "make", "harder", "checks" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java#L81-L115
49,673
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java
SquareRegularClustersIntoGrids.addRowsToGrid
boolean addRowsToGrid(List<SquareNode> column, List<SquareNode> ordered) { for (int i = 0; i < column.size(); i++) { column.get(i).graph = 0; } // now add the rows by traversing down the column int numFirsRow = 0; for (int j = 0; j < column.size(); j++) { SquareNode n = column.get(j); n.graph = SEA...
java
boolean addRowsToGrid(List<SquareNode> column, List<SquareNode> ordered) { for (int i = 0; i < column.size(); i++) { column.get(i).graph = 0; } // now add the rows by traversing down the column int numFirsRow = 0; for (int j = 0; j < column.size(); j++) { SquareNode n = column.get(j); n.graph = SEA...
[ "boolean", "addRowsToGrid", "(", "List", "<", "SquareNode", ">", "column", ",", "List", "<", "SquareNode", ">", "ordered", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "column", ".", "size", "(", ")", ";", "i", "++", ")", "{", "colu...
Competes the graph by traversing down the first column and adding the rows one at a time
[ "Competes", "the", "graph", "by", "traversing", "down", "the", "first", "column", "and", "adding", "the", "rows", "one", "at", "a", "time" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java#L220-L271
49,674
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java
SquareRegularClustersIntoGrids.addLineToGrid
int addLineToGrid(SquareNode a, SquareNode b, List<SquareNode> list) { int total = 2; // double maxAngle = UtilAngle.radian(45); while( true ) { // double slopeX0 = b.center.x - a.center.x; // double slopeY0 = b.center.y - a.center.y; // double angleAB = Math.atan2(slopeY0,slopeX0); // see which side ...
java
int addLineToGrid(SquareNode a, SquareNode b, List<SquareNode> list) { int total = 2; // double maxAngle = UtilAngle.radian(45); while( true ) { // double slopeX0 = b.center.x - a.center.x; // double slopeY0 = b.center.y - a.center.y; // double angleAB = Math.atan2(slopeY0,slopeX0); // see which side ...
[ "int", "addLineToGrid", "(", "SquareNode", "a", ",", "SquareNode", "b", ",", "List", "<", "SquareNode", ">", "list", ")", "{", "int", "total", "=", "2", ";", "//\t\tdouble maxAngle = UtilAngle.radian(45);", "while", "(", "true", ")", "{", "//\t\t\tdouble slopeX0...
Add all the nodes into the list which lie along the line defined by a and b. a is assumed to be an end point. Care is taken to not cycle.
[ "Add", "all", "the", "nodes", "into", "the", "list", "which", "lie", "along", "the", "line", "defined", "by", "a", "and", "b", ".", "a", "is", "assumed", "to", "be", "an", "end", "point", ".", "Care", "is", "taken", "to", "not", "cycle", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java#L277-L329
49,675
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java
SquareRegularClustersIntoGrids.pickNot
static SquareNode pickNot( SquareNode target , SquareNode child ) { for (int i = 0; i < 4; i++) { SquareEdge e = target.edges[i]; if( e == null ) continue; SquareNode c = e.destination(target); if( c != child ) return c; } throw new RuntimeException("There was no odd one out some how"); }
java
static SquareNode pickNot( SquareNode target , SquareNode child ) { for (int i = 0; i < 4; i++) { SquareEdge e = target.edges[i]; if( e == null ) continue; SquareNode c = e.destination(target); if( c != child ) return c; } throw new RuntimeException("There was no odd one out some how"); }
[ "static", "SquareNode", "pickNot", "(", "SquareNode", "target", ",", "SquareNode", "child", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "SquareEdge", "e", "=", "target", ".", "edges", "[", "i", "]", "...
There are only two edges on target. Pick the edge which does not go to the provided child
[ "There", "are", "only", "two", "edges", "on", "target", ".", "Pick", "the", "edge", "which", "does", "not", "go", "to", "the", "provided", "child" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java#L334-L344
49,676
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java
SquareRegularClustersIntoGrids.pickNot
static SquareNode pickNot( SquareNode target , SquareNode child0 , SquareNode child1 ) { for (int i = 0; i < 4; i++) { SquareEdge e = target.edges[i]; if( e == null ) continue; SquareNode c = e.destination(target); if( c != child0 && c != child1 ) return c; } throw new RuntimeException("There was ...
java
static SquareNode pickNot( SquareNode target , SquareNode child0 , SquareNode child1 ) { for (int i = 0; i < 4; i++) { SquareEdge e = target.edges[i]; if( e == null ) continue; SquareNode c = e.destination(target); if( c != child0 && c != child1 ) return c; } throw new RuntimeException("There was ...
[ "static", "SquareNode", "pickNot", "(", "SquareNode", "target", ",", "SquareNode", "child0", ",", "SquareNode", "child1", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "SquareEdge", "e", "=", "target", ".",...
There are only three edges on target and two of them are known. Pick the one which isn't an inptu child
[ "There", "are", "only", "three", "edges", "on", "target", "and", "two", "of", "them", "are", "known", ".", "Pick", "the", "one", "which", "isn", "t", "an", "inptu", "child" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java#L349-L358
49,677
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java
ImageSegmentationOps.countRegionPixels
public static int countRegionPixels(GrayS32 labeled , int which ) { int total = 0; for( int y = 0; y < labeled.height; y++ ) { int index = labeled.startIndex + y*labeled.stride; for( int x = 0; x < labeled.width; x++ ) { if( labeled.data[index++] == which ) { total++; } } } return total; ...
java
public static int countRegionPixels(GrayS32 labeled , int which ) { int total = 0; for( int y = 0; y < labeled.height; y++ ) { int index = labeled.startIndex + y*labeled.stride; for( int x = 0; x < labeled.width; x++ ) { if( labeled.data[index++] == which ) { total++; } } } return total; ...
[ "public", "static", "int", "countRegionPixels", "(", "GrayS32", "labeled", ",", "int", "which", ")", "{", "int", "total", "=", "0", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "labeled", ".", "height", ";", "y", "++", ")", "{", "int", "...
Counts the number of instances of 'which' inside the labeled image. @param labeled Image which has been labeled @param which The label being searched for @return Number of instances of 'which' in 'labeled'
[ "Counts", "the", "number", "of", "instances", "of", "which", "inside", "the", "labeled", "image", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java#L44-L55
49,678
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java
ImageSegmentationOps.countRegionPixels
public static void countRegionPixels(GrayS32 labeled , int totalRegions , int counts[] ) { Arrays.fill(counts,0,totalRegions,0); for( int y = 0; y < labeled.height; y++ ) { int index = labeled.startIndex + y*labeled.stride; for( int x = 0; x < labeled.width; x++ ) { counts[labeled.data[index++]]++; }...
java
public static void countRegionPixels(GrayS32 labeled , int totalRegions , int counts[] ) { Arrays.fill(counts,0,totalRegions,0); for( int y = 0; y < labeled.height; y++ ) { int index = labeled.startIndex + y*labeled.stride; for( int x = 0; x < labeled.width; x++ ) { counts[labeled.data[index++]]++; }...
[ "public", "static", "void", "countRegionPixels", "(", "GrayS32", "labeled", ",", "int", "totalRegions", ",", "int", "counts", "[", "]", ")", "{", "Arrays", ".", "fill", "(", "counts", ",", "0", ",", "totalRegions", ",", "0", ")", ";", "for", "(", "int"...
Counts the number of pixels in all regions. Regions must be have labels from 0 to totalRegions-1. @param labeled (Input) labeled image @param totalRegions Total number of regions @param counts Storage for pixel counts
[ "Counts", "the", "number", "of", "pixels", "in", "all", "regions", ".", "Regions", "must", "be", "have", "labels", "from", "0", "to", "totalRegions", "-", "1", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java#L64-L74
49,679
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java
ImageSegmentationOps.regionPixelId_to_Compact
public static void regionPixelId_to_Compact(GrayS32 graph, GrowQueue_I32 segmentId, GrayS32 output) { InputSanityCheck.checkSameShape(graph,output); // Change the label of root nodes to be the new compacted labels for( int i = 0; i < segmentId.size; i++ ) { graph.data[segmentId.data[i]] = i; } // In the...
java
public static void regionPixelId_to_Compact(GrayS32 graph, GrowQueue_I32 segmentId, GrayS32 output) { InputSanityCheck.checkSameShape(graph,output); // Change the label of root nodes to be the new compacted labels for( int i = 0; i < segmentId.size; i++ ) { graph.data[segmentId.data[i]] = i; } // In the...
[ "public", "static", "void", "regionPixelId_to_Compact", "(", "GrayS32", "graph", ",", "GrowQueue_I32", "segmentId", ",", "GrayS32", "output", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "graph", ",", "output", ")", ";", "// Change the label of root nodes...
Compacts the region labels such that they are consecutive numbers starting from 0. The ID of a root node must the index of a pixel in the 'graph' image, taking in account the change in coordinates for sub-images. @param graph Input segmented image where the ID's are not compacted @param segmentId List of segment ID's....
[ "Compacts", "the", "region", "labels", "such", "that", "they", "are", "consecutive", "numbers", "starting", "from", "0", ".", "The", "ID", "of", "a", "root", "node", "must", "the", "index", "of", "a", "pixel", "in", "the", "graph", "image", "taking", "in...
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ImageSegmentationOps.java#L85-L111
49,680
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/orientation/FactoryOrientationAlgs.java
FactoryOrientationAlgs.image_ii
public static <II extends ImageGray<II>> OrientationIntegral<II> image_ii( double objectRadiusToScale, int sampleRadius , double samplePeriod , int sampleWidth, double weightSigma , Class<II> integralImage) { return (OrientationIntegral<II>) new ImplOrientationImageAverageIntegral(objectRad...
java
public static <II extends ImageGray<II>> OrientationIntegral<II> image_ii( double objectRadiusToScale, int sampleRadius , double samplePeriod , int sampleWidth, double weightSigma , Class<II> integralImage) { return (OrientationIntegral<II>) new ImplOrientationImageAverageIntegral(objectRad...
[ "public", "static", "<", "II", "extends", "ImageGray", "<", "II", ">", ">", "OrientationIntegral", "<", "II", ">", "image_ii", "(", "double", "objectRadiusToScale", ",", "int", "sampleRadius", ",", "double", "samplePeriod", ",", "int", "sampleWidth", ",", "dou...
Estimates the orientation without calculating the image derivative. @see ImplOrientationImageAverageIntegral @param sampleRadius Radius of the region being considered in terms of samples. Typically 6. @param samplePeriod How often the image is sampled. This number is scaled. Typically 1. @param sampleWidth How wide...
[ "Estimates", "the", "orientation", "without", "calculating", "the", "image", "derivative", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/orientation/FactoryOrientationAlgs.java#L148-L156
49,681
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/orientation/FactoryOrientationAlgs.java
FactoryOrientationAlgs.sliding_ii
public static <II extends ImageGray<II>> OrientationIntegral<II> sliding_ii( ConfigSlidingIntegral config , Class<II> integralType) { if( config == null ) config = new ConfigSlidingIntegral(); config.checkValidity(); return (OrientationIntegral<II>) new ImplOrientationSlidingWindowIntegral(config.object...
java
public static <II extends ImageGray<II>> OrientationIntegral<II> sliding_ii( ConfigSlidingIntegral config , Class<II> integralType) { if( config == null ) config = new ConfigSlidingIntegral(); config.checkValidity(); return (OrientationIntegral<II>) new ImplOrientationSlidingWindowIntegral(config.object...
[ "public", "static", "<", "II", "extends", "ImageGray", "<", "II", ">", ">", "OrientationIntegral", "<", "II", ">", "sliding_ii", "(", "ConfigSlidingIntegral", "config", ",", "Class", "<", "II", ">", "integralType", ")", "{", "if", "(", "config", "==", "nul...
Estimates the orientation of a region by using a sliding window across the different potential angles. @see OrientationSlidingWindow @param config Configuration for algorithm. If null defaults will be used. @param integralType Type of integral image being processed. @return OrientationIntegral
[ "Estimates", "the", "orientation", "of", "a", "region", "by", "using", "a", "sliding", "window", "across", "the", "different", "potential", "angles", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/orientation/FactoryOrientationAlgs.java#L168-L178
49,682
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/orientation/FactoryOrientationAlgs.java
FactoryOrientationAlgs.sift
public static <D extends ImageGray<D>> OrientationHistogramSift<D> sift(ConfigSiftOrientation config , Class<D> derivType ) { if( config == null ) config = new ConfigSiftOrientation(); config.checkValidity(); return new OrientationHistogramSift(config.histogramSize,config.sigmaEnlarge,derivType); }
java
public static <D extends ImageGray<D>> OrientationHistogramSift<D> sift(ConfigSiftOrientation config , Class<D> derivType ) { if( config == null ) config = new ConfigSiftOrientation(); config.checkValidity(); return new OrientationHistogramSift(config.histogramSize,config.sigmaEnlarge,derivType); }
[ "public", "static", "<", "D", "extends", "ImageGray", "<", "D", ">", ">", "OrientationHistogramSift", "<", "D", ">", "sift", "(", "ConfigSiftOrientation", "config", ",", "Class", "<", "D", ">", "derivType", ")", "{", "if", "(", "config", "==", "null", ")...
Estimates multiple orientations as specified in SIFT paper. @param config Configuration for algorithm. If null defaults will be used. @param derivType Type of derivative image it takes as input @return OrientationHistogramSift
[ "Estimates", "multiple", "orientations", "as", "specified", "in", "SIFT", "paper", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/orientation/FactoryOrientationAlgs.java#L187-L194
49,683
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/template/TemplateMatching.java
TemplateMatching.setTemplate
public void setTemplate(T template, T mask , int maxMatches) { this.template = template; this.mask = mask; this.maxMatches = maxMatches; }
java
public void setTemplate(T template, T mask , int maxMatches) { this.template = template; this.mask = mask; this.maxMatches = maxMatches; }
[ "public", "void", "setTemplate", "(", "T", "template", ",", "T", "mask", ",", "int", "maxMatches", ")", "{", "this", ".", "template", "=", "template", ";", "this", ".", "mask", "=", "mask", ";", "this", ".", "maxMatches", "=", "maxMatches", ";", "}" ]
Specifies the template to search for and the maximum number of matches to return. @param template Template being searched for @param mask Optional mask. Same size as template. 0 = pixel is transparent, values larger than zero determine how influential the pixel is. Can be null. @param maxMatches The maximum...
[ "Specifies", "the", "template", "to", "search", "for", "and", "the", "maximum", "number", "of", "matches", "to", "return", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/template/TemplateMatching.java#L92-L96
49,684
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/template/TemplateMatching.java
TemplateMatching.setImage
public void setImage(T image ) { match.setInputImage(image); this.imageWidth = image.width; this.imageHeight = image.height; }
java
public void setImage(T image ) { match.setInputImage(image); this.imageWidth = image.width; this.imageHeight = image.height; }
[ "public", "void", "setImage", "(", "T", "image", ")", "{", "match", ".", "setInputImage", "(", "image", ")", ";", "this", ".", "imageWidth", "=", "image", ".", "width", ";", "this", ".", "imageHeight", "=", "image", ".", "height", ";", "}" ]
Specifies the input image which the template is to be found inside. @param image Image being processed
[ "Specifies", "the", "input", "image", "which", "the", "template", "is", "to", "be", "found", "inside", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/template/TemplateMatching.java#L103-L107
49,685
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/template/TemplateMatching.java
TemplateMatching.process
public void process() { // compute match intensities if( mask == null ) match.process(template); else match.process(template,mask); GrayF32 intensity = match.getIntensity(); int offsetX = 0; int offsetY = 0; // adjust intensity image size depending on if there is a border or not if (!match.isBo...
java
public void process() { // compute match intensities if( mask == null ) match.process(template); else match.process(template,mask); GrayF32 intensity = match.getIntensity(); int offsetX = 0; int offsetY = 0; // adjust intensity image size depending on if there is a border or not if (!match.isBo...
[ "public", "void", "process", "(", ")", "{", "// compute match intensities", "if", "(", "mask", "==", "null", ")", "match", ".", "process", "(", "template", ")", ";", "else", "match", ".", "process", "(", "template", ",", "mask", ")", ";", "GrayF32", "int...
Performs template matching.
[ "Performs", "template", "matching", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/template/TemplateMatching.java#L112-L165
49,686
lessthanoptimal/BoofCV
integration/boofcv-swing/src/main/java/boofcv/gui/SelectAlgorithmPanel.java
SelectAlgorithmPanel.refreshAlgorithm
public void refreshAlgorithm() { Object cookie = algCookies.get(algBox.getSelectedIndex()); String name = (String)algBox.getSelectedItem(); performSetAlgorithm(name, cookie); }
java
public void refreshAlgorithm() { Object cookie = algCookies.get(algBox.getSelectedIndex()); String name = (String)algBox.getSelectedItem(); performSetAlgorithm(name, cookie); }
[ "public", "void", "refreshAlgorithm", "(", ")", "{", "Object", "cookie", "=", "algCookies", ".", "get", "(", "algBox", ".", "getSelectedIndex", "(", ")", ")", ";", "String", "name", "=", "(", "String", ")", "algBox", ".", "getSelectedItem", "(", ")", ";"...
Tells it to switch again to the current algorithm. Useful if the input has changed and information needs to be rendered again.
[ "Tells", "it", "to", "switch", "again", "to", "the", "current", "algorithm", ".", "Useful", "if", "the", "input", "has", "changed", "and", "information", "needs", "to", "be", "rendered", "again", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/SelectAlgorithmPanel.java#L83-L87
49,687
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.process
public boolean process(List<Point2D_I32> contour ) { // Reset internal book keeping variables reset(); if( loops ) { // Reject pathological case if (contour.size() < 3) return false; if (!findInitialTriangle(contour)) return false; } else { // Reject pathological case if( contour.size()...
java
public boolean process(List<Point2D_I32> contour ) { // Reset internal book keeping variables reset(); if( loops ) { // Reject pathological case if (contour.size() < 3) return false; if (!findInitialTriangle(contour)) return false; } else { // Reject pathological case if( contour.size()...
[ "public", "boolean", "process", "(", "List", "<", "Point2D_I32", ">", "contour", ")", "{", "// Reset internal book keeping variables", "reset", "(", ")", ";", "if", "(", "loops", ")", "{", "// Reject pathological case", "if", "(", "contour", ".", "size", "(", ...
Process the contour and returns true if a polyline could be found. @param contour Contour. Must be a ordered in CW or CCW @return true for success or false if one could not be fit
[ "Process", "the", "contour", "and", "returns", "true", "if", "a", "polyline", "could", "be", "found", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L130-L189
49,688
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.savePolyline
boolean savePolyline() { int N = loops ? 3 : 2; // if a polyline of this size has already been saved then over write it CandidatePolyline c; if( list.size() <= polylines.size+N-1 ) { c = polylines.get( list.size()-N ); // sanity check if( c.splits.size != list.size() ) throw new RuntimeException("...
java
boolean savePolyline() { int N = loops ? 3 : 2; // if a polyline of this size has already been saved then over write it CandidatePolyline c; if( list.size() <= polylines.size+N-1 ) { c = polylines.get( list.size()-N ); // sanity check if( c.splits.size != list.size() ) throw new RuntimeException("...
[ "boolean", "savePolyline", "(", ")", "{", "int", "N", "=", "loops", "?", "3", ":", "2", ";", "// if a polyline of this size has already been saved then over write it", "CandidatePolyline", "c", ";", "if", "(", "list", ".", "size", "(", ")", "<=", "polylines", "....
Saves the current polyline @return true if the polyline is better than any previously saved result false if not and it wasn't saved
[ "Saves", "the", "current", "polyline" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L250-L286
49,689
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.computeScore
static double computeScore( LinkedList<Corner> list , double cornerPenalty , boolean loops ) { double sumSides = 0; Element<Corner> e = list.getHead(); Element<Corner> end = loops ? null : list.getTail(); while( e != end ) { sumSides += e.object.sideError; e = e.next; } int numSides = loops ? list.si...
java
static double computeScore( LinkedList<Corner> list , double cornerPenalty , boolean loops ) { double sumSides = 0; Element<Corner> e = list.getHead(); Element<Corner> end = loops ? null : list.getTail(); while( e != end ) { sumSides += e.object.sideError; e = e.next; } int numSides = loops ? list.si...
[ "static", "double", "computeScore", "(", "LinkedList", "<", "Corner", ">", "list", ",", "double", "cornerPenalty", ",", "boolean", "loops", ")", "{", "double", "sumSides", "=", "0", ";", "Element", "<", "Corner", ">", "e", "=", "list", ".", "getHead", "(...
Computes the score for a list
[ "Computes", "the", "score", "for", "a", "list" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L291-L303
49,690
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.findInitialTriangle
boolean findInitialTriangle(List<Point2D_I32> contour) { // find the first estimate for a corner int cornerSeed = findCornerSeed(contour); // see if it can reject the contour immediately if( convex ) { if( !isConvexUsingMaxDistantPoints(contour,0,cornerSeed)) return false; } // Select the second co...
java
boolean findInitialTriangle(List<Point2D_I32> contour) { // find the first estimate for a corner int cornerSeed = findCornerSeed(contour); // see if it can reject the contour immediately if( convex ) { if( !isConvexUsingMaxDistantPoints(contour,0,cornerSeed)) return false; } // Select the second co...
[ "boolean", "findInitialTriangle", "(", "List", "<", "Point2D_I32", ">", "contour", ")", "{", "// find the first estimate for a corner", "int", "cornerSeed", "=", "findCornerSeed", "(", "contour", ")", ";", "// see if it can reject the contour immediately", "if", "(", "con...
Select an initial triangle. A good initial triangle is needed. By good it should minimize the error of the contour from each side
[ "Select", "an", "initial", "triangle", ".", "A", "good", "initial", "triangle", "is", "needed", ".", "By", "good", "it", "should", "minimize", "the", "error", "of", "the", "contour", "from", "each", "side" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L309-L342
49,691
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.initializeScore
private boolean initializeScore(List<Point2D_I32> contour , boolean loops ) { // Score each side Element<Corner> e = list.getHead(); Element<Corner> end = loops ? null : list.getTail(); while( e != end ) { if (convex && !isSideConvex(contour, e)) return false; Element<Corner> n = e.next; double e...
java
private boolean initializeScore(List<Point2D_I32> contour , boolean loops ) { // Score each side Element<Corner> e = list.getHead(); Element<Corner> end = loops ? null : list.getTail(); while( e != end ) { if (convex && !isSideConvex(contour, e)) return false; Element<Corner> n = e.next; double e...
[ "private", "boolean", "initializeScore", "(", "List", "<", "Point2D_I32", ">", "contour", ",", "boolean", "loops", ")", "{", "// Score each side", "Element", "<", "Corner", ">", "e", "=", "list", ".", "getHead", "(", ")", ";", "Element", "<", "Corner", ">"...
Computes the score and potential split for each side @param contour @return
[ "Computes", "the", "score", "and", "potential", "split", "for", "each", "side" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L349-L377
49,692
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.ensureTriangleOrder
void ensureTriangleOrder(List<Point2D_I32> contour ) { Element<Corner> e = list.getHead(); Corner a = e.object;e=e.next; Corner b = e.object;e=e.next; Corner c = e.object; int distB = CircularIndex.distanceP(a.index,b.index,contour.size()); int distC = CircularIndex.distanceP(a.index,c.index,contour.size()...
java
void ensureTriangleOrder(List<Point2D_I32> contour ) { Element<Corner> e = list.getHead(); Corner a = e.object;e=e.next; Corner b = e.object;e=e.next; Corner c = e.object; int distB = CircularIndex.distanceP(a.index,b.index,contour.size()); int distC = CircularIndex.distanceP(a.index,c.index,contour.size()...
[ "void", "ensureTriangleOrder", "(", "List", "<", "Point2D_I32", ">", "contour", ")", "{", "Element", "<", "Corner", ">", "e", "=", "list", ".", "getHead", "(", ")", ";", "Corner", "a", "=", "e", ".", "object", ";", "e", "=", "e", ".", "next", ";", ...
Make sure the next corner after the head is the closest one to the head
[ "Make", "sure", "the", "next", "corner", "after", "the", "head", "is", "the", "closest", "one", "to", "the", "head" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L382-L397
49,693
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.increaseNumberOfSidesByOne
boolean increaseNumberOfSidesByOne(List<Point2D_I32> contour, boolean loops ) { // System.out.println("increase number of sides by one. list = "+list.size()); Element<Corner> selected = selectCornerToSplit(loops); // No side can be split if( selected == null ) return false; // Update the corner who's side...
java
boolean increaseNumberOfSidesByOne(List<Point2D_I32> contour, boolean loops ) { // System.out.println("increase number of sides by one. list = "+list.size()); Element<Corner> selected = selectCornerToSplit(loops); // No side can be split if( selected == null ) return false; // Update the corner who's side...
[ "boolean", "increaseNumberOfSidesByOne", "(", "List", "<", "Point2D_I32", ">", "contour", ",", "boolean", "loops", ")", "{", "//\t\tSystem.out.println(\"increase number of sides by one. list = \"+list.size());", "Element", "<", "Corner", ">", "selected", "=", "selectCornerToS...
Increase the number of sides in the polyline. This is done greedily selecting the side which would improve the score by the most of it was split. @param contour Contour @return true if a split was selected and false if not
[ "Increase", "the", "number", "of", "sides", "in", "the", "polyline", ".", "This", "is", "done", "greedily", "selecting", "the", "side", "which", "would", "improve", "the", "score", "by", "the", "most", "of", "it", "was", "split", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L413-L444
49,694
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.isSideConvex
boolean isSideConvex(List<Point2D_I32> contour, Element<Corner> e1) { // a conservative estimate for concavity. Assumes a triangle and that the farthest // point is equal to the distance between the two corners Element<Corner> e2 = next(e1); int length = CircularIndex.distanceP(e1.object.index,e2.object.index...
java
boolean isSideConvex(List<Point2D_I32> contour, Element<Corner> e1) { // a conservative estimate for concavity. Assumes a triangle and that the farthest // point is equal to the distance between the two corners Element<Corner> e2 = next(e1); int length = CircularIndex.distanceP(e1.object.index,e2.object.index...
[ "boolean", "isSideConvex", "(", "List", "<", "Point2D_I32", ">", "contour", ",", "Element", "<", "Corner", ">", "e1", ")", "{", "// a conservative estimate for concavity. Assumes a triangle and that the farthest", "// point is equal to the distance between the two corners", "Elem...
Checks to see if the side could belong to a convex shape
[ "Checks", "to", "see", "if", "the", "side", "could", "belong", "to", "a", "convex", "shape" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L449-L466
49,695
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.selectCornerToSplit
Element<Corner> selectCornerToSplit( boolean loops ) { Element<Corner> selected = null; double bestChange = convex ? 0 : -Double.MAX_VALUE; // Pick the side that if split would improve the overall score the most Element<Corner> e=list.getHead(); Element<Corner> end = loops ? null : list.getTail(); while( ...
java
Element<Corner> selectCornerToSplit( boolean loops ) { Element<Corner> selected = null; double bestChange = convex ? 0 : -Double.MAX_VALUE; // Pick the side that if split would improve the overall score the most Element<Corner> e=list.getHead(); Element<Corner> end = loops ? null : list.getTail(); while( ...
[ "Element", "<", "Corner", ">", "selectCornerToSplit", "(", "boolean", "loops", ")", "{", "Element", "<", "Corner", ">", "selected", "=", "null", ";", "double", "bestChange", "=", "convex", "?", "0", ":", "-", "Double", ".", "MAX_VALUE", ";", "// Pick the s...
Selects the best side to split the polyline at. @return the selected side or null if the score will not be improved if any of the sides are split
[ "Selects", "the", "best", "side", "to", "split", "the", "polyline", "at", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L472-L501
49,696
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.selectCornerToRemove
Element<Corner> selectCornerToRemove(List<Point2D_I32> contour , ErrorValue sideError , boolean loops ) { if( list.size() <= 3 ) return null; // Pick the side that if split would improve the overall score the most Element<Corner> target,end; // if it loops any corner can be split. If it doesn't look the en...
java
Element<Corner> selectCornerToRemove(List<Point2D_I32> contour , ErrorValue sideError , boolean loops ) { if( list.size() <= 3 ) return null; // Pick the side that if split would improve the overall score the most Element<Corner> target,end; // if it loops any corner can be split. If it doesn't look the en...
[ "Element", "<", "Corner", ">", "selectCornerToRemove", "(", "List", "<", "Point2D_I32", ">", "contour", ",", "ErrorValue", "sideError", ",", "boolean", "loops", ")", "{", "if", "(", "list", ".", "size", "(", ")", "<=", "3", ")", "return", "null", ";", ...
Selects the best corner to remove. If no corner was found that can be removed then null is returned @return The corner to remove. Should only return null if there are 3 sides or less
[ "Selects", "the", "best", "corner", "to", "remove", ".", "If", "no", "corner", "was", "found", "that", "can", "be", "removed", "then", "null", "is", "returned" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L507-L543
49,697
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.removeCornerAndSavePolyline
boolean removeCornerAndSavePolyline( Element<Corner> corner, double sideErrorAfterRemoved ) { // System.out.println("removing a corner idx="+target.object.index); // Note: the corner is "lost" until the next contour is fit. Not worth the effort to recycle Element<Corner> p = previous(corner); // go through t...
java
boolean removeCornerAndSavePolyline( Element<Corner> corner, double sideErrorAfterRemoved ) { // System.out.println("removing a corner idx="+target.object.index); // Note: the corner is "lost" until the next contour is fit. Not worth the effort to recycle Element<Corner> p = previous(corner); // go through t...
[ "boolean", "removeCornerAndSavePolyline", "(", "Element", "<", "Corner", ">", "corner", ",", "double", "sideErrorAfterRemoved", ")", "{", "//\t\t\tSystem.out.println(\"removing a corner idx=\"+target.object.index);", "// Note: the corner is \"lost\" until the next contour is fit. Not wor...
Remove the corner from the current polyline. If the new polyline has a better score than the currently saved one with the same number of corners save it @param corner The corner to removed
[ "Remove", "the", "corner", "from", "the", "current", "polyline", ".", "If", "the", "new", "polyline", "has", "a", "better", "score", "than", "the", "currently", "saved", "one", "with", "the", "same", "number", "of", "corners", "save", "it" ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L550-L563
49,698
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.findCornerSeed
static int findCornerSeed(List<Point2D_I32> contour ) { Point2D_I32 a = contour.get(0); int best = -1; double bestDistance = -Double.MAX_VALUE; for (int i = 1; i < contour.size(); i++) { Point2D_I32 b = contour.get(i); double d = distanceSq(a,b); if( d > bestDistance ) { bestDistance = d; be...
java
static int findCornerSeed(List<Point2D_I32> contour ) { Point2D_I32 a = contour.get(0); int best = -1; double bestDistance = -Double.MAX_VALUE; for (int i = 1; i < contour.size(); i++) { Point2D_I32 b = contour.get(i); double d = distanceSq(a,b); if( d > bestDistance ) { bestDistance = d; be...
[ "static", "int", "findCornerSeed", "(", "List", "<", "Point2D_I32", ">", "contour", ")", "{", "Point2D_I32", "a", "=", "contour", ".", "get", "(", "0", ")", ";", "int", "best", "=", "-", "1", ";", "double", "bestDistance", "=", "-", "Double", ".", "M...
The seed corner is the point farther away from the first point. In a perfect polygon with no noise this should be a corner.
[ "The", "seed", "corner", "is", "the", "point", "farther", "away", "from", "the", "first", "point", ".", "In", "a", "perfect", "polygon", "with", "no", "noise", "this", "should", "be", "a", "corner", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L569-L586
49,699
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java
PolylineSplitMerge.maximumDistance
static int maximumDistance(List<Point2D_I32> contour , int indexA , int indexB ) { Point2D_I32 a = contour.get(indexA); Point2D_I32 b = contour.get(indexB); int best = -1; double bestDistance = -Double.MAX_VALUE; for (int i = 0; i < contour.size(); i++) { Point2D_I32 c = contour.get(i); // can't sum s...
java
static int maximumDistance(List<Point2D_I32> contour , int indexA , int indexB ) { Point2D_I32 a = contour.get(indexA); Point2D_I32 b = contour.get(indexB); int best = -1; double bestDistance = -Double.MAX_VALUE; for (int i = 0; i < contour.size(); i++) { Point2D_I32 c = contour.get(i); // can't sum s...
[ "static", "int", "maximumDistance", "(", "List", "<", "Point2D_I32", ">", "contour", ",", "int", "indexA", ",", "int", "indexB", ")", "{", "Point2D_I32", "a", "=", "contour", ".", "get", "(", "indexA", ")", ";", "Point2D_I32", "b", "=", "contour", ".", ...
Finds the point in the contour which maximizes the distance between points A and B. @param contour List of all pointsi n the contour @param indexA Index of point A @param indexB Index of point B @return Index of maximal distant point
[ "Finds", "the", "point", "in", "the", "contour", "which", "maximizes", "the", "distance", "between", "points", "A", "and", "B", "." ]
f01c0243da0ec086285ee722183804d5923bc3ac
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L597-L616