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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java | KltTracker.setAllowedBounds | protected void setAllowedBounds(KltFeature feature) {
// compute the feature's width and temporary storage related to it
widthFeature = feature.radius * 2 + 1;
lengthFeature = widthFeature * widthFeature;
allowedLeft = feature.radius;
allowedTop = feature.radius;
allowedRight = image.width - feature.radius... | java | protected void setAllowedBounds(KltFeature feature) {
// compute the feature's width and temporary storage related to it
widthFeature = feature.radius * 2 + 1;
lengthFeature = widthFeature * widthFeature;
allowedLeft = feature.radius;
allowedTop = feature.radius;
allowedRight = image.width - feature.radius... | [
"protected",
"void",
"setAllowedBounds",
"(",
"KltFeature",
"feature",
")",
"{",
"// compute the feature's width and temporary storage related to it",
"widthFeature",
"=",
"feature",
".",
"radius",
"*",
"2",
"+",
"1",
";",
"lengthFeature",
"=",
"widthFeature",
"*",
"wid... | Precompute image bounds that the feature is allowed inside of | [
"Precompute",
"image",
"bounds",
"that",
"the",
"feature",
"is",
"allowed",
"inside",
"of"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java#L330-L344 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java | KltTracker.computeGandE_border | protected int computeGandE_border(KltFeature feature, float cx, float cy) {
computeSubImageBounds(feature, cx, cy);
ImageMiscOps.fill(currDesc, Float.NaN);
currDesc.subimage(dstX0, dstY0, dstX1, dstY1, subimage);
interpInput.setImage(image);
interpInput.region(srcX0, srcY0, subimage);
int total = 0;
G... | java | protected int computeGandE_border(KltFeature feature, float cx, float cy) {
computeSubImageBounds(feature, cx, cy);
ImageMiscOps.fill(currDesc, Float.NaN);
currDesc.subimage(dstX0, dstY0, dstX1, dstY1, subimage);
interpInput.setImage(image);
interpInput.region(srcX0, srcY0, subimage);
int total = 0;
G... | [
"protected",
"int",
"computeGandE_border",
"(",
"KltFeature",
"feature",
",",
"float",
"cx",
",",
"float",
"cy",
")",
"{",
"computeSubImageBounds",
"(",
"feature",
",",
"cx",
",",
"cy",
")",
";",
"ImageMiscOps",
".",
"fill",
"(",
"currDesc",
",",
"Float",
... | When part of the region is outside the image G and E need to be recomputed | [
"When",
"part",
"of",
"the",
"region",
"is",
"outside",
"the",
"image",
"G",
"and",
"E",
"need",
"to",
"be",
"recomputed"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java#L379-L419 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java | KltTracker.isDescriptionComplete | public boolean isDescriptionComplete( KltFeature feature ) {
for( int i = 0; i < lengthFeature; i++ ) {
if( Float.isNaN(feature.desc.data[i]) )
return false;
}
return true;
} | java | public boolean isDescriptionComplete( KltFeature feature ) {
for( int i = 0; i < lengthFeature; i++ ) {
if( Float.isNaN(feature.desc.data[i]) )
return false;
}
return true;
} | [
"public",
"boolean",
"isDescriptionComplete",
"(",
"KltFeature",
"feature",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"lengthFeature",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Float",
".",
"isNaN",
"(",
"feature",
".",
"desc",
".",
"dat... | Checks to see if the feature description is complete or if it was created by a feature partially
outside the image | [
"Checks",
"to",
"see",
"if",
"the",
"feature",
"description",
"is",
"complete",
"or",
"if",
"it",
"was",
"created",
"by",
"a",
"feature",
"partially",
"outside",
"the",
"image"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java#L463-L469 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java | KltTracker.isFullyInside | public boolean isFullyInside(float x, float y) {
if (x < allowedLeft || x > allowedRight)
return false;
if (y < allowedTop || y > allowedBottom)
return false;
return true;
} | java | public boolean isFullyInside(float x, float y) {
if (x < allowedLeft || x > allowedRight)
return false;
if (y < allowedTop || y > allowedBottom)
return false;
return true;
} | [
"public",
"boolean",
"isFullyInside",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"if",
"(",
"x",
"<",
"allowedLeft",
"||",
"x",
">",
"allowedRight",
")",
"return",
"false",
";",
"if",
"(",
"y",
"<",
"allowedTop",
"||",
"y",
">",
"allowedBottom",
... | Returns true if the features is entirely enclosed inside of the image. | [
"Returns",
"true",
"if",
"the",
"features",
"is",
"entirely",
"enclosed",
"inside",
"of",
"the",
"image",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java#L474-L481 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java | KltTracker.isFullyOutside | public boolean isFullyOutside(float x, float y) {
if (x < outsideLeft || x > outsideRight)
return true;
if (y < outsideTop || y > outsideBottom)
return true;
return false;
} | java | public boolean isFullyOutside(float x, float y) {
if (x < outsideLeft || x > outsideRight)
return true;
if (y < outsideTop || y > outsideBottom)
return true;
return false;
} | [
"public",
"boolean",
"isFullyOutside",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"if",
"(",
"x",
"<",
"outsideLeft",
"||",
"x",
">",
"outsideRight",
")",
"return",
"true",
";",
"if",
"(",
"y",
"<",
"outsideTop",
"||",
"y",
">",
"outsideBottom",
... | Returns true if the features is entirely outside of the image. A region is entirely outside if not
an entire pixel is contained inside the image. So if only 0.999 of a pixel is inside then the whole
region is considered to be outside. Can't interpolate nothing... | [
"Returns",
"true",
"if",
"the",
"features",
"is",
"entirely",
"outside",
"of",
"the",
"image",
".",
"A",
"region",
"is",
"entirely",
"outside",
"if",
"not",
"an",
"entire",
"pixel",
"is",
"contained",
"inside",
"the",
"image",
".",
"So",
"if",
"only",
"0... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java#L488-L495 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FeatureLaplacePyramid.java | FeatureLaplacePyramid.checkMax | private boolean checkMax(T image, double adj, double bestScore, int c_x, int c_y) {
sparseLaplace.setImage(image);
boolean isMax = true;
beginLoop:
for (int i = c_y - 1; i <= c_y + 1; i++) {
for (int j = c_x - 1; j <= c_x + 1; j++) {
double value = adj*sparseLaplace.compute(j, i);
if (value >= bestSc... | java | private boolean checkMax(T image, double adj, double bestScore, int c_x, int c_y) {
sparseLaplace.setImage(image);
boolean isMax = true;
beginLoop:
for (int i = c_y - 1; i <= c_y + 1; i++) {
for (int j = c_x - 1; j <= c_x + 1; j++) {
double value = adj*sparseLaplace.compute(j, i);
if (value >= bestSc... | [
"private",
"boolean",
"checkMax",
"(",
"T",
"image",
",",
"double",
"adj",
",",
"double",
"bestScore",
",",
"int",
"c_x",
",",
"int",
"c_y",
")",
"{",
"sparseLaplace",
".",
"setImage",
"(",
"image",
")",
";",
"boolean",
"isMax",
"=",
"true",
";",
"begi... | See if the best score is better than the local adjusted scores at this scale | [
"See",
"if",
"the",
"best",
"score",
"is",
"better",
"than",
"the",
"local",
"adjusted",
"scores",
"at",
"this",
"scale"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FeatureLaplacePyramid.java#L244-L258 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/chess/DetectChessboardPatterns.java | DetectChessboardPatterns.findPatterns | public void findPatterns(GrayF32 input) {
found.reset();
detector.process(input);
clusterFinder.process(detector.getCorners().toList());
FastQueue<ChessboardCornerGraph> clusters = clusterFinder.getOutputClusters();
for (int clusterIdx = 0; clusterIdx < clusters.size; clusterIdx++) {
ChessboardCornerGraph... | java | public void findPatterns(GrayF32 input) {
found.reset();
detector.process(input);
clusterFinder.process(detector.getCorners().toList());
FastQueue<ChessboardCornerGraph> clusters = clusterFinder.getOutputClusters();
for (int clusterIdx = 0; clusterIdx < clusters.size; clusterIdx++) {
ChessboardCornerGraph... | [
"public",
"void",
"findPatterns",
"(",
"GrayF32",
"input",
")",
"{",
"found",
".",
"reset",
"(",
")",
";",
"detector",
".",
"process",
"(",
"input",
")",
";",
"clusterFinder",
".",
"process",
"(",
"detector",
".",
"getCorners",
"(",
")",
".",
"toList",
... | Processes the image and searches for all chessboard patterns. | [
"Processes",
"the",
"image",
"and",
"searches",
"for",
"all",
"chessboard",
"patterns",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/chess/DetectChessboardPatterns.java#L74-L87 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java | ImageDeformPointMLS_F32.configure | public void configure( int width , int height , int gridRows , int gridCols ) {
// need to maintain the same ratio of pixels in the grid as in the regular image for similarity and rigid
// to work correctly
int s = Math.max(width,height);
scaleX = s/(float)(gridCols-1);
scaleY = s/(float)(gridRows-1);
if( ... | java | public void configure( int width , int height , int gridRows , int gridCols ) {
// need to maintain the same ratio of pixels in the grid as in the regular image for similarity and rigid
// to work correctly
int s = Math.max(width,height);
scaleX = s/(float)(gridCols-1);
scaleY = s/(float)(gridRows-1);
if( ... | [
"public",
"void",
"configure",
"(",
"int",
"width",
",",
"int",
"height",
",",
"int",
"gridRows",
",",
"int",
"gridCols",
")",
"{",
"// need to maintain the same ratio of pixels in the grid as in the regular image for similarity and rigid",
"// to work correctly",
"int",
"s",... | Specifies the input image size and the size of the grid it will use to approximate the idea solution. All
control points are discarded
@param width Image width
@param height Image height
@param gridRows grid rows
@param gridCols grid columns | [
"Specifies",
"the",
"input",
"image",
"size",
"and",
"the",
"size",
"of",
"the",
"grid",
"it",
"will",
"use",
"to",
"approximate",
"the",
"idea",
"solution",
".",
"All",
"control",
"points",
"are",
"discarded"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L109-L127 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java | ImageDeformPointMLS_F32.addControl | public int addControl( float x , float y ) {
Control c = controls.grow();
c.q.set(x,y);
setUndistorted(controls.size()-1,x,y);
return controls.size()-1;
} | java | public int addControl( float x , float y ) {
Control c = controls.grow();
c.q.set(x,y);
setUndistorted(controls.size()-1,x,y);
return controls.size()-1;
} | [
"public",
"int",
"addControl",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"Control",
"c",
"=",
"controls",
".",
"grow",
"(",
")",
";",
"c",
".",
"q",
".",
"set",
"(",
"x",
",",
"y",
")",
";",
"setUndistorted",
"(",
"controls",
".",
"size",
... | Adds a new control point at the specified location. Initially the distorted and undistorted location will be
set to the same
@param x coordinate x-axis in image pixels
@param y coordinate y-axis in image pixels
@return Index of control point | [
"Adds",
"a",
"new",
"control",
"point",
"at",
"the",
"specified",
"location",
".",
"Initially",
"the",
"distorted",
"and",
"undistorted",
"location",
"will",
"be",
"set",
"to",
"the",
"same"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L137-L142 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java | ImageDeformPointMLS_F32.setUndistorted | public void setUndistorted(int which, float x, float y) {
if( scaleX <= 0 || scaleY <= 0 )
throw new IllegalArgumentException("Must call configure first");
controls.get(which).p.set(x/scaleX,y/scaleY);
} | java | public void setUndistorted(int which, float x, float y) {
if( scaleX <= 0 || scaleY <= 0 )
throw new IllegalArgumentException("Must call configure first");
controls.get(which).p.set(x/scaleX,y/scaleY);
} | [
"public",
"void",
"setUndistorted",
"(",
"int",
"which",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"if",
"(",
"scaleX",
"<=",
"0",
"||",
"scaleY",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must call configure first\"",
")",
... | Sets the location of a control point.
@param x coordinate x-axis in image pixels
@param y coordinate y-axis in image pixels | [
"Sets",
"the",
"location",
"of",
"a",
"control",
"point",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L149-L154 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java | ImageDeformPointMLS_F32.add | public int add( float srcX , float srcY , float dstX , float dstY )
{
int which = addControl(srcX,srcY);
setUndistorted(which,dstX,dstY);
return which;
} | java | public int add( float srcX , float srcY , float dstX , float dstY )
{
int which = addControl(srcX,srcY);
setUndistorted(which,dstX,dstY);
return which;
} | [
"public",
"int",
"add",
"(",
"float",
"srcX",
",",
"float",
"srcY",
",",
"float",
"dstX",
",",
"float",
"dstY",
")",
"{",
"int",
"which",
"=",
"addControl",
"(",
"srcX",
",",
"srcY",
")",
";",
"setUndistorted",
"(",
"which",
",",
"dstX",
",",
"dstY",... | Function that let's you set control and undistorted points at the same time
@param srcX distorted coordinate
@param srcY distorted coordinate
@param dstX undistorted coordinate
@param dstY undistorted coordinate
@return Index of control point | [
"Function",
"that",
"let",
"s",
"you",
"set",
"control",
"and",
"undistorted",
"points",
"at",
"the",
"same",
"time"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L164-L169 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java | ImageDeformPointMLS_F32.setDistorted | public void setDistorted( int which , float x , float y ) {
controls.get(which).q.set(x,y);
} | java | public void setDistorted( int which , float x , float y ) {
controls.get(which).q.set(x,y);
} | [
"public",
"void",
"setDistorted",
"(",
"int",
"which",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"controls",
".",
"get",
"(",
"which",
")",
".",
"q",
".",
"set",
"(",
"x",
",",
"y",
")",
";",
"}"
] | Sets the distorted location of a specific control point
@param which Which control point
@param x distorted coordinate x-axis in image pixels
@param y distorted coordinate y-axis in image pixels | [
"Sets",
"the",
"distorted",
"location",
"of",
"a",
"specific",
"control",
"point"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L177-L179 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java | ImageDeformPointMLS_F32.fixateUndistorted | public void fixateUndistorted() {
if( controls.size() < 2 )
throw new RuntimeException("Not enough control points specified. Found "+controls.size());
for (int row = 0; row < gridRows; row++) {
for (int col = 0; col < gridCols; col++) {
Cache cache = getGrid(row,col);
cache.weights.resize(controls.si... | java | public void fixateUndistorted() {
if( controls.size() < 2 )
throw new RuntimeException("Not enough control points specified. Found "+controls.size());
for (int row = 0; row < gridRows; row++) {
for (int col = 0; col < gridCols; col++) {
Cache cache = getGrid(row,col);
cache.weights.resize(controls.si... | [
"public",
"void",
"fixateUndistorted",
"(",
")",
"{",
"if",
"(",
"controls",
".",
"size",
"(",
")",
"<",
"2",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Not enough control points specified. Found \"",
"+",
"controls",
".",
"size",
"(",
")",
")",
";",
... | Precompute the portion of the equation which only concerns the undistorted location of each point on the
grid even the current undistorted location of each control point. | [
"Precompute",
"the",
"portion",
"of",
"the",
"equation",
"which",
"only",
"concerns",
"the",
"undistorted",
"location",
"of",
"each",
"point",
"on",
"the",
"grid",
"even",
"the",
"current",
"undistorted",
"location",
"of",
"each",
"control",
"point",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L185-L203 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java | ImageDeformPointMLS_F32.computeAverageP | void computeAverageP(Cache cache) {
float[] weights = cache.weights.data;
cache.aveP.set(0,0);
for (int i = 0; i < controls.size(); i++) {
Control c = controls.get(i);
float w = weights[i];
cache.aveP.x += c.p.x * w;
cache.aveP.y += c.p.y * w;
}
cache.aveP.x /= cache.totalWeight;
cache.aveP.y /... | java | void computeAverageP(Cache cache) {
float[] weights = cache.weights.data;
cache.aveP.set(0,0);
for (int i = 0; i < controls.size(); i++) {
Control c = controls.get(i);
float w = weights[i];
cache.aveP.x += c.p.x * w;
cache.aveP.y += c.p.y * w;
}
cache.aveP.x /= cache.totalWeight;
cache.aveP.y /... | [
"void",
"computeAverageP",
"(",
"Cache",
"cache",
")",
"{",
"float",
"[",
"]",
"weights",
"=",
"cache",
".",
"weights",
".",
"data",
";",
"cache",
".",
"aveP",
".",
"set",
"(",
"0",
",",
"0",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i"... | Computes the average P given the weights at this cached point | [
"Computes",
"the",
"average",
"P",
"given",
"the",
"weights",
"at",
"this",
"cached",
"point"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L222-L234 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java | ImageDeformPointMLS_F32.computeAverageQ | void computeAverageQ(Cache cache) {
float[] weights = cache.weights.data;
cache.aveQ.set(0,0);
for (int i = 0; i < controls.size(); i++) {
Control c = controls.get(i);
float w = weights[i];
cache.aveQ.x += c.q.x * w;
cache.aveQ.y += c.q.y * w;
}
cache.aveQ.x /= cache.totalWeight;
cache.aveQ.y /... | java | void computeAverageQ(Cache cache) {
float[] weights = cache.weights.data;
cache.aveQ.set(0,0);
for (int i = 0; i < controls.size(); i++) {
Control c = controls.get(i);
float w = weights[i];
cache.aveQ.x += c.q.x * w;
cache.aveQ.y += c.q.y * w;
}
cache.aveQ.x /= cache.totalWeight;
cache.aveQ.y /... | [
"void",
"computeAverageQ",
"(",
"Cache",
"cache",
")",
"{",
"float",
"[",
"]",
"weights",
"=",
"cache",
".",
"weights",
".",
"data",
";",
"cache",
".",
"aveQ",
".",
"set",
"(",
"0",
",",
"0",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i"... | Computes the average Q given the weights at this cached point | [
"Computes",
"the",
"average",
"Q",
"given",
"the",
"weights",
"at",
"this",
"cached",
"point"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L239-L251 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java | ImageDeformPointMLS_F32.interpolateDeformedPoint | void interpolateDeformedPoint(float v_x , float v_y , Point2D_F32 deformed ) {
// sample the closest point and x+1,y+1
int x0 = (int)v_x;
int y0 = (int)v_y;
int x1 = x0+1;
int y1 = y0+1;
// make sure the 4 sample points are in bounds
if( x1 >= gridCols )
x1 = gridCols-1;
if( y1 >= gridRows )
y1 ... | java | void interpolateDeformedPoint(float v_x , float v_y , Point2D_F32 deformed ) {
// sample the closest point and x+1,y+1
int x0 = (int)v_x;
int y0 = (int)v_y;
int x1 = x0+1;
int y1 = y0+1;
// make sure the 4 sample points are in bounds
if( x1 >= gridCols )
x1 = gridCols-1;
if( y1 >= gridRows )
y1 ... | [
"void",
"interpolateDeformedPoint",
"(",
"float",
"v_x",
",",
"float",
"v_y",
",",
"Point2D_F32",
"deformed",
")",
"{",
"// sample the closest point and x+1,y+1",
"int",
"x0",
"=",
"(",
"int",
")",
"v_x",
";",
"int",
"y0",
"=",
"(",
"int",
")",
"v_y",
";",
... | Samples the 4 grid points around v and performs bilinear interpolation
@param v_x Grid coordinate x-axis, undistorted
@param v_y Grid coordinate y-axis, undistorted
@param deformed Distorted grid coordinate in image pixels | [
"Samples",
"the",
"4",
"grid",
"points",
"around",
"v",
"and",
"performs",
"bilinear",
"interpolation"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L298-L338 | train |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/RadialDistortionEstimateLinear.java | RadialDistortionEstimateLinear.process | public void process( DMatrixRMaj cameraCalibration ,
List<DMatrixRMaj> homographies ,
List<CalibrationObservation> observations )
{
init( observations );
setupA_and_B(cameraCalibration,homographies,observations);
if( !solver.setA(A) )
throw new RuntimeException("Solver had problems");
solve... | java | public void process( DMatrixRMaj cameraCalibration ,
List<DMatrixRMaj> homographies ,
List<CalibrationObservation> observations )
{
init( observations );
setupA_and_B(cameraCalibration,homographies,observations);
if( !solver.setA(A) )
throw new RuntimeException("Solver had problems");
solve... | [
"public",
"void",
"process",
"(",
"DMatrixRMaj",
"cameraCalibration",
",",
"List",
"<",
"DMatrixRMaj",
">",
"homographies",
",",
"List",
"<",
"CalibrationObservation",
">",
"observations",
")",
"{",
"init",
"(",
"observations",
")",
";",
"setupA_and_B",
"(",
"ca... | Computes radial distortion using a linear method.
@param cameraCalibration Camera calibration matrix. Not modified.
@param observations Observations of calibration grid. Not modified. | [
"Computes",
"radial",
"distortion",
"using",
"a",
"linear",
"method",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/RadialDistortionEstimateLinear.java#L93-L105 | train |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/RadialDistortionEstimateLinear.java | RadialDistortionEstimateLinear.init | private void init( List<CalibrationObservation> observations )
{
int totalPoints = 0;
for (int i = 0; i < observations.size(); i++) {
totalPoints += observations.get(i).size();
}
A.reshape(2*totalPoints,X.numRows,false);
B.reshape(A.numRows,1,false);
} | java | private void init( List<CalibrationObservation> observations )
{
int totalPoints = 0;
for (int i = 0; i < observations.size(); i++) {
totalPoints += observations.get(i).size();
}
A.reshape(2*totalPoints,X.numRows,false);
B.reshape(A.numRows,1,false);
} | [
"private",
"void",
"init",
"(",
"List",
"<",
"CalibrationObservation",
">",
"observations",
")",
"{",
"int",
"totalPoints",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"observations",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
... | Declares and sets up data structures | [
"Declares",
"and",
"sets",
"up",
"data",
"structures"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/RadialDistortionEstimateLinear.java#L110-L119 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/StereoSparse3D.java | StereoSparse3D.process | @Override
public boolean process(double x, double y) {
leftPixelToRect.compute(x,y,pixelRect);
// round to the nearest pixel
if( !disparity.process((int)(pixelRect.x+0.5),(int)(pixelRect.y+0.5)) )
return false;
// Compute coordinate in camera frame
this.w = disparity.getDisparity();
computeHomo3D(pix... | java | @Override
public boolean process(double x, double y) {
leftPixelToRect.compute(x,y,pixelRect);
// round to the nearest pixel
if( !disparity.process((int)(pixelRect.x+0.5),(int)(pixelRect.y+0.5)) )
return false;
// Compute coordinate in camera frame
this.w = disparity.getDisparity();
computeHomo3D(pix... | [
"@",
"Override",
"public",
"boolean",
"process",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"leftPixelToRect",
".",
"compute",
"(",
"x",
",",
"y",
",",
"pixelRect",
")",
";",
"// round to the nearest pixel",
"if",
"(",
"!",
"disparity",
".",
"proces... | Takes in pixel coordinates from the left camera in the original image coordinate system
@param x x-coordinate of the pixel
@param y y-coordinate of the pixel
@return true if successful | [
"Takes",
"in",
"pixel",
"coordinates",
"from",
"the",
"left",
"camera",
"in",
"the",
"original",
"image",
"coordinate",
"system"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/StereoSparse3D.java#L81-L95 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java | SquareGraph.detachEdge | public void detachEdge(SquareEdge edge) {
edge.a.edges[edge.sideA] = null;
edge.b.edges[edge.sideB] = null;
edge.distance = 0;
edgeManager.recycleInstance(edge);
} | java | public void detachEdge(SquareEdge edge) {
edge.a.edges[edge.sideA] = null;
edge.b.edges[edge.sideB] = null;
edge.distance = 0;
edgeManager.recycleInstance(edge);
} | [
"public",
"void",
"detachEdge",
"(",
"SquareEdge",
"edge",
")",
"{",
"edge",
".",
"a",
".",
"edges",
"[",
"edge",
".",
"sideA",
"]",
"=",
"null",
";",
"edge",
".",
"b",
".",
"edges",
"[",
"edge",
".",
"sideB",
"]",
"=",
"null",
";",
"edge",
".",
... | Removes the edge from the two nodes and recycles the data structure | [
"Removes",
"the",
"edge",
"from",
"the",
"two",
"nodes",
"and",
"recycles",
"the",
"data",
"structure"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java#L66-L73 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java | SquareGraph.findSideIntersect | public int findSideIntersect(SquareNode n , LineSegment2D_F64 line , Point2D_F64 intersection, LineSegment2D_F64 storage ) {
for (int j = 0,i=3; j < 4; i=j,j++) {
storage.a = n.square.get(i);
storage.b = n.square.get(j);
if( Intersection2D_F64.intersection(line,storage,intersection) != null ) {
return i... | java | public int findSideIntersect(SquareNode n , LineSegment2D_F64 line , Point2D_F64 intersection, LineSegment2D_F64 storage ) {
for (int j = 0,i=3; j < 4; i=j,j++) {
storage.a = n.square.get(i);
storage.b = n.square.get(j);
if( Intersection2D_F64.intersection(line,storage,intersection) != null ) {
return i... | [
"public",
"int",
"findSideIntersect",
"(",
"SquareNode",
"n",
",",
"LineSegment2D_F64",
"line",
",",
"Point2D_F64",
"intersection",
",",
"LineSegment2D_F64",
"storage",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
",",
"i",
"=",
"3",
";",
"j",
"<",
"4",
"... | Finds the side which intersects the line on the shape. The line is assumed to pass through the shape
so if there is no intersection it is considered a bug | [
"Finds",
"the",
"side",
"which",
"intersects",
"the",
"line",
"on",
"the",
"shape",
".",
"The",
"line",
"is",
"assumed",
"to",
"pass",
"through",
"the",
"shape",
"so",
"if",
"there",
"is",
"no",
"intersection",
"it",
"is",
"considered",
"a",
"bug"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java#L79-L91 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java | SquareGraph.checkConnect | public void checkConnect( SquareNode a , int indexA , SquareNode b , int indexB , double distance ) {
if( a.edges[indexA] != null && a.edges[indexA].distance > distance ) {
detachEdge(a.edges[indexA]);
}
if( b.edges[indexB] != null && b.edges[indexB].distance > distance ) {
detachEdge(b.edges[indexB]);
}... | java | public void checkConnect( SquareNode a , int indexA , SquareNode b , int indexB , double distance ) {
if( a.edges[indexA] != null && a.edges[indexA].distance > distance ) {
detachEdge(a.edges[indexA]);
}
if( b.edges[indexB] != null && b.edges[indexB].distance > distance ) {
detachEdge(b.edges[indexB]);
}... | [
"public",
"void",
"checkConnect",
"(",
"SquareNode",
"a",
",",
"int",
"indexA",
",",
"SquareNode",
"b",
",",
"int",
"indexB",
",",
"double",
"distance",
")",
"{",
"if",
"(",
"a",
".",
"edges",
"[",
"indexA",
"]",
"!=",
"null",
"&&",
"a",
".",
"edges"... | Checks to see if the two nodes can be connected. If one of the nodes is already connected to
another it then checks to see if the proposed connection is more desirable. If it is the old
connection is removed and a new one created. Otherwise nothing happens. | [
"Checks",
"to",
"see",
"if",
"the",
"two",
"nodes",
"can",
"be",
"connected",
".",
"If",
"one",
"of",
"the",
"nodes",
"is",
"already",
"connected",
"to",
"another",
"it",
"then",
"checks",
"to",
"see",
"if",
"the",
"proposed",
"connection",
"is",
"more",... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java#L98-L110 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java | SquareGraph.connect | void connect( SquareNode a , int indexA , SquareNode b , int indexB , double distance ) {
SquareEdge edge = edgeManager.requestInstance();
edge.reset();
edge.a = a;
edge.sideA = indexA;
edge.b = b;
edge.sideB = indexB;
edge.distance = distance;
a.edges[indexA] = edge;
b.edges[indexB] = edge;
} | java | void connect( SquareNode a , int indexA , SquareNode b , int indexB , double distance ) {
SquareEdge edge = edgeManager.requestInstance();
edge.reset();
edge.a = a;
edge.sideA = indexA;
edge.b = b;
edge.sideB = indexB;
edge.distance = distance;
a.edges[indexA] = edge;
b.edges[indexB] = edge;
} | [
"void",
"connect",
"(",
"SquareNode",
"a",
",",
"int",
"indexA",
",",
"SquareNode",
"b",
",",
"int",
"indexB",
",",
"double",
"distance",
")",
"{",
"SquareEdge",
"edge",
"=",
"edgeManager",
".",
"requestInstance",
"(",
")",
";",
"edge",
".",
"reset",
"("... | Creates a new edge which will connect the two nodes. The side on each node which is connected
is specified by the indexes.
@param a First node
@param indexA side on node 'a'
@param b Second node
@param indexB side on node 'b'
@param distance distance apart the center of the two nodes | [
"Creates",
"a",
"new",
"edge",
"which",
"will",
"connect",
"the",
"two",
"nodes",
".",
"The",
"side",
"on",
"each",
"node",
"which",
"is",
"connected",
"is",
"specified",
"by",
"the",
"indexes",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java#L121-L133 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java | SquareGraph.almostParallel | public boolean almostParallel(SquareNode a , int sideA , SquareNode b , int sideB ) {
double selected = acuteAngle(a,sideA,b,sideB);
if( selected > parallelThreshold )
return false;
// see if the two sides are about parallel too
// double left = acuteAngle(a,add(sideA,-1),b,add(sideB,1));
// double right =... | java | public boolean almostParallel(SquareNode a , int sideA , SquareNode b , int sideB ) {
double selected = acuteAngle(a,sideA,b,sideB);
if( selected > parallelThreshold )
return false;
// see if the two sides are about parallel too
// double left = acuteAngle(a,add(sideA,-1),b,add(sideB,1));
// double right =... | [
"public",
"boolean",
"almostParallel",
"(",
"SquareNode",
"a",
",",
"int",
"sideA",
",",
"SquareNode",
"b",
",",
"int",
"sideB",
")",
"{",
"double",
"selected",
"=",
"acuteAngle",
"(",
"a",
",",
"sideA",
",",
"b",
",",
"sideB",
")",
";",
"if",
"(",
"... | Checks to see if the two sides are almost parallel to each other by looking at their acute
angle. | [
"Checks",
"to",
"see",
"if",
"the",
"two",
"sides",
"are",
"almost",
"parallel",
"to",
"each",
"other",
"by",
"looking",
"at",
"their",
"acute",
"angle",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java#L139-L160 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java | OrientationHistogramSift.setImageGradient | public void setImageGradient(Deriv derivX, Deriv derivY ) {
this.derivX.wrap(derivX);
this.derivY.wrap(derivY);
} | java | public void setImageGradient(Deriv derivX, Deriv derivY ) {
this.derivX.wrap(derivX);
this.derivY.wrap(derivY);
} | [
"public",
"void",
"setImageGradient",
"(",
"Deriv",
"derivX",
",",
"Deriv",
"derivY",
")",
"{",
"this",
".",
"derivX",
".",
"wrap",
"(",
"derivX",
")",
";",
"this",
".",
"derivY",
".",
"wrap",
"(",
"derivY",
")",
";",
"}"
] | Specify the input image | [
"Specify",
"the",
"input",
"image"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L123-L126 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java | OrientationHistogramSift.computeHistogram | void computeHistogram(int c_x, int c_y, double sigma) {
int r = (int)Math.ceil(sigma * sigmaEnlarge);
// specify the area being sampled
bound.x0 = c_x - r;
bound.y0 = c_y - r;
bound.x1 = c_x + r + 1;
bound.y1 = c_y + r + 1;
ImageGray rawDX = derivX.getImage();
ImageGray rawDY = derivY.getImage();
/... | java | void computeHistogram(int c_x, int c_y, double sigma) {
int r = (int)Math.ceil(sigma * sigmaEnlarge);
// specify the area being sampled
bound.x0 = c_x - r;
bound.y0 = c_y - r;
bound.x1 = c_x + r + 1;
bound.y1 = c_y + r + 1;
ImageGray rawDX = derivX.getImage();
ImageGray rawDY = derivY.getImage();
/... | [
"void",
"computeHistogram",
"(",
"int",
"c_x",
",",
"int",
"c_y",
",",
"double",
"sigma",
")",
"{",
"int",
"r",
"=",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"sigma",
"*",
"sigmaEnlarge",
")",
";",
"// specify the area being sampled",
"bound",
".",
"x0... | Constructs the histogram around the specified point.
@param c_x Center x-axis
@param c_y Center y-axis
@param sigma Scale of feature, adjusted for local octave | [
"Constructs",
"the",
"histogram",
"around",
"the",
"specified",
"point",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L155-L201 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java | OrientationHistogramSift.findHistogramPeaks | void findHistogramPeaks() {
// reset data structures
peaks.reset();
angles.reset();
peakAngle = 0;
// identify peaks and find the highest peak
double largest = 0;
int largestIndex = -1;
double before = histogramMag[ histogramMag.length-2 ];
double current = histogramMag[ histogramMag.length-1 ];
fo... | java | void findHistogramPeaks() {
// reset data structures
peaks.reset();
angles.reset();
peakAngle = 0;
// identify peaks and find the highest peak
double largest = 0;
int largestIndex = -1;
double before = histogramMag[ histogramMag.length-2 ];
double current = histogramMag[ histogramMag.length-1 ];
fo... | [
"void",
"findHistogramPeaks",
"(",
")",
"{",
"// reset data structures",
"peaks",
".",
"reset",
"(",
")",
";",
"angles",
".",
"reset",
"(",
")",
";",
"peakAngle",
"=",
"0",
";",
"// identify peaks and find the highest peak",
"double",
"largest",
"=",
"0",
";",
... | Finds local peaks in histogram and selects orientations. Location of peaks is interpolated. | [
"Finds",
"local",
"peaks",
"in",
"histogram",
"and",
"selects",
"orientations",
".",
"Location",
"of",
"peaks",
"is",
"interpolated",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L206-L249 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java | OrientationHistogramSift.computeAngle | double computeAngle( int index1 ) {
int index0 = CircularIndex.addOffset(index1,-1, histogramMag.length);
int index2 = CircularIndex.addOffset(index1, 1, histogramMag.length);
// compute the peak location using a second order polygon
double v0 = histogramMag[index0];
double v1 = histogramMag[index1];
doub... | java | double computeAngle( int index1 ) {
int index0 = CircularIndex.addOffset(index1,-1, histogramMag.length);
int index2 = CircularIndex.addOffset(index1, 1, histogramMag.length);
// compute the peak location using a second order polygon
double v0 = histogramMag[index0];
double v1 = histogramMag[index1];
doub... | [
"double",
"computeAngle",
"(",
"int",
"index1",
")",
"{",
"int",
"index0",
"=",
"CircularIndex",
".",
"addOffset",
"(",
"index1",
",",
"-",
"1",
",",
"histogramMag",
".",
"length",
")",
";",
"int",
"index2",
"=",
"CircularIndex",
".",
"addOffset",
"(",
"... | Compute the angle. The angle for each neighbor bin is found using the weighted sum
of the derivative. Then the peak index is found by 2nd order polygon interpolation. These two bits of
information are combined and used to return the final angle output.
@param index1 Histogram index of the peak
@return angle of the ... | [
"Compute",
"the",
"angle",
".",
"The",
"angle",
"for",
"each",
"neighbor",
"bin",
"is",
"found",
"using",
"the",
"weighted",
"sum",
"of",
"the",
"derivative",
".",
"Then",
"the",
"peak",
"index",
"is",
"found",
"by",
"2nd",
"order",
"polygon",
"interpolati... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L259-L273 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java | OrientationHistogramSift.interpolateAngle | double interpolateAngle(int index0, int index1, int index2, double offset) {
double angle1 = Math.atan2(histogramY[index1],histogramX[index1]);
double deltaAngle;
if( offset < 0 ) {
double angle0 = Math.atan2(histogramY[index0],histogramX[index0]);
deltaAngle = UtilAngle.dist(angle0,angle1);
} else {
... | java | double interpolateAngle(int index0, int index1, int index2, double offset) {
double angle1 = Math.atan2(histogramY[index1],histogramX[index1]);
double deltaAngle;
if( offset < 0 ) {
double angle0 = Math.atan2(histogramY[index0],histogramX[index0]);
deltaAngle = UtilAngle.dist(angle0,angle1);
} else {
... | [
"double",
"interpolateAngle",
"(",
"int",
"index0",
",",
"int",
"index1",
",",
"int",
"index2",
",",
"double",
"offset",
")",
"{",
"double",
"angle1",
"=",
"Math",
".",
"atan2",
"(",
"histogramY",
"[",
"index1",
"]",
",",
"histogramX",
"[",
"index1",
"]"... | Given the interpolated index, compute the angle from the 3 indexes. The angle for each index
is computed from the weighted gradients.
@param offset Interpolated index offset relative to index0. range -1 to 1
@return Interpolated angle. | [
"Given",
"the",
"interpolated",
"index",
"compute",
"the",
"angle",
"from",
"the",
"3",
"indexes",
".",
"The",
"angle",
"for",
"each",
"index",
"is",
"computed",
"from",
"the",
"weighted",
"gradients",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L281-L293 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java | OrientationHistogramSift.computeWeight | double computeWeight( double deltaX , double deltaY , double sigma ) {
// the exact equation
// return Math.exp(-0.5 * ((deltaX * deltaX + deltaY * deltaY) / (sigma * sigma)));
// approximation below. when validating this approach it produced results that were within
// floating point tolerance of the exact so... | java | double computeWeight( double deltaX , double deltaY , double sigma ) {
// the exact equation
// return Math.exp(-0.5 * ((deltaX * deltaX + deltaY * deltaY) / (sigma * sigma)));
// approximation below. when validating this approach it produced results that were within
// floating point tolerance of the exact so... | [
"double",
"computeWeight",
"(",
"double",
"deltaX",
",",
"double",
"deltaY",
",",
"double",
"sigma",
")",
"{",
"// the exact equation",
"//\t\treturn Math.exp(-0.5 * ((deltaX * deltaX + deltaY * deltaY) / (sigma * sigma)));",
"// approximation below. when validating this approach it p... | Computes the weight based on a centered Gaussian shaped function. Interpolation is used to speed up the process | [
"Computes",
"the",
"weight",
"based",
"on",
"a",
"centered",
"Gaussian",
"shaped",
"function",
".",
"Interpolation",
"is",
"used",
"to",
"speed",
"up",
"the",
"process"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L298-L309 | train |
lessthanoptimal/BoofCV | integration/boofcv-android/examples/video/app/src/main/java/org/boofcv/video/GradientActivity.java | GradientActivity.onCameraResolutionChange | @Override
protected void onCameraResolutionChange( int width , int height, int sensorOrientation ) {
super.onCameraResolutionChange(width, height,sensorOrientation);
derivX.reshape(width, height);
derivY.reshape(width, height);
} | java | @Override
protected void onCameraResolutionChange( int width , int height, int sensorOrientation ) {
super.onCameraResolutionChange(width, height,sensorOrientation);
derivX.reshape(width, height);
derivY.reshape(width, height);
} | [
"@",
"Override",
"protected",
"void",
"onCameraResolutionChange",
"(",
"int",
"width",
",",
"int",
"height",
",",
"int",
"sensorOrientation",
")",
"{",
"super",
".",
"onCameraResolutionChange",
"(",
"width",
",",
"height",
",",
"sensorOrientation",
")",
";",
"de... | During camera initialization this function is called once after the resolution is known.
This is a good function to override and predeclare data structres which are dependent
on the video feeds resolution. | [
"During",
"camera",
"initialization",
"this",
"function",
"is",
"called",
"once",
"after",
"the",
"resolution",
"is",
"known",
".",
"This",
"is",
"a",
"good",
"function",
"to",
"override",
"and",
"predeclare",
"data",
"structres",
"which",
"are",
"dependent",
... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/examples/video/app/src/main/java/org/boofcv/video/GradientActivity.java#L121-L127 | train |
lessthanoptimal/BoofCV | integration/boofcv-android/examples/video/app/src/main/java/org/boofcv/video/GradientActivity.java | GradientActivity.renderBitmapImage | @Override
protected void renderBitmapImage(BitmapMode mode, ImageBase image) {
switch( mode ) {
case UNSAFE: { // this application is configured to use double buffer and could ignore all other modes
VisualizeImageData.colorizeGradient(derivX, derivY, -1, bitmap, bitmapTmp);
} break;
case DOUBLE_BUFFER:... | java | @Override
protected void renderBitmapImage(BitmapMode mode, ImageBase image) {
switch( mode ) {
case UNSAFE: { // this application is configured to use double buffer and could ignore all other modes
VisualizeImageData.colorizeGradient(derivX, derivY, -1, bitmap, bitmapTmp);
} break;
case DOUBLE_BUFFER:... | [
"@",
"Override",
"protected",
"void",
"renderBitmapImage",
"(",
"BitmapMode",
"mode",
",",
"ImageBase",
"image",
")",
"{",
"switch",
"(",
"mode",
")",
"{",
"case",
"UNSAFE",
":",
"{",
"// this application is configured to use double buffer and could ignore all other modes... | Override the default behavior and colorize gradient instead of converting input image. | [
"Override",
"the",
"default",
"behavior",
"and",
"colorize",
"gradient",
"instead",
"of",
"converting",
"input",
"image",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/examples/video/app/src/main/java/org/boofcv/video/GradientActivity.java#L143-L164 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/FastCornerDetector.java | FastCornerDetector.process | public void process( T image , GrayF32 intensity ) {
int maxFeatures = (int)(maxFeaturesFraction*image.width*image.height);
candidatesLow.reset();
candidatesHigh.reset();
this.image = image;
if( stride != image.stride ) {
stride = image.stride;
offsets = DiscretizedCircle.imageOffsets(radius, image.str... | java | public void process( T image , GrayF32 intensity ) {
int maxFeatures = (int)(maxFeaturesFraction*image.width*image.height);
candidatesLow.reset();
candidatesHigh.reset();
this.image = image;
if( stride != image.stride ) {
stride = image.stride;
offsets = DiscretizedCircle.imageOffsets(radius, image.str... | [
"public",
"void",
"process",
"(",
"T",
"image",
",",
"GrayF32",
"intensity",
")",
"{",
"int",
"maxFeatures",
"=",
"(",
"int",
")",
"(",
"maxFeaturesFraction",
"*",
"image",
".",
"width",
"*",
"image",
".",
"height",
")",
";",
"candidatesLow",
".",
"reset... | Computes fast corner features and their intensity. The intensity is needed if non-max suppression is
used | [
"Computes",
"fast",
"corner",
"features",
"and",
"their",
"intensity",
".",
"The",
"intensity",
"is",
"needed",
"if",
"non",
"-",
"max",
"suppression",
"is",
"used"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/FastCornerDetector.java#L123-L156 | train |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/BoofSwingUtil.java | BoofSwingUtil.selectZoomToShowAll | public static double selectZoomToShowAll(JComponent panel , int width , int height ) {
int w = panel.getWidth();
int h = panel.getHeight();
if( w == 0 ) {
w = panel.getPreferredSize().width;
h = panel.getPreferredSize().height;
}
double scale = Math.max(width/(double)w,height/(double)h);
if( scale > ... | java | public static double selectZoomToShowAll(JComponent panel , int width , int height ) {
int w = panel.getWidth();
int h = panel.getHeight();
if( w == 0 ) {
w = panel.getPreferredSize().width;
h = panel.getPreferredSize().height;
}
double scale = Math.max(width/(double)w,height/(double)h);
if( scale > ... | [
"public",
"static",
"double",
"selectZoomToShowAll",
"(",
"JComponent",
"panel",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"int",
"w",
"=",
"panel",
".",
"getWidth",
"(",
")",
";",
"int",
"h",
"=",
"panel",
".",
"getHeight",
"(",
")",
";",
... | Select a zoom which will allow the entire image to be shown in the panel | [
"Select",
"a",
"zoom",
"which",
"will",
"allow",
"the",
"entire",
"image",
"to",
"be",
"shown",
"in",
"the",
"panel"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/BoofSwingUtil.java#L209-L223 | train |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/BoofSwingUtil.java | BoofSwingUtil.selectZoomToFitInDisplay | public static double selectZoomToFitInDisplay( int width , int height ) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
double w = screenSize.getWidth();
double h = screenSize.getHeight();
double scale = Math.max(width/w,height/h);
if( scale > 1.0 ) {
return 1.0/scale;
} else {
... | java | public static double selectZoomToFitInDisplay( int width , int height ) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
double w = screenSize.getWidth();
double h = screenSize.getHeight();
double scale = Math.max(width/w,height/h);
if( scale > 1.0 ) {
return 1.0/scale;
} else {
... | [
"public",
"static",
"double",
"selectZoomToFitInDisplay",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Dimension",
"screenSize",
"=",
"Toolkit",
".",
"getDefaultToolkit",
"(",
")",
".",
"getScreenSize",
"(",
")",
";",
"double",
"w",
"=",
"screenSize",... | Figures out what the scale should be to fit the window inside the default display | [
"Figures",
"out",
"what",
"the",
"scale",
"should",
"be",
"to",
"fit",
"the",
"window",
"inside",
"the",
"default",
"display"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/BoofSwingUtil.java#L228-L240 | train |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/BoofSwingUtil.java | BoofSwingUtil.antialiasing | public static void antialiasing( Graphics2D g2 ) {
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
} | java | public static void antialiasing( Graphics2D g2 ) {
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
} | [
"public",
"static",
"void",
"antialiasing",
"(",
"Graphics2D",
"g2",
")",
"{",
"g2",
".",
"setRenderingHint",
"(",
"RenderingHints",
".",
"KEY_STROKE_CONTROL",
",",
"RenderingHints",
".",
"VALUE_STROKE_PURE",
")",
";",
"g2",
".",
"setRenderingHint",
"(",
"Renderin... | Sets rendering hints that will enable antialiasing and make sub pixel rendering look good
@param g2 | [
"Sets",
"rendering",
"hints",
"that",
"will",
"enable",
"antialiasing",
"and",
"make",
"sub",
"pixel",
"rendering",
"look",
"good"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/BoofSwingUtil.java#L287-L290 | train |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/BoofSwingUtil.java | BoofSwingUtil.isImage | public static boolean isImage( File file ){
try {
String mimeType = Files.probeContentType(file.toPath());
if( mimeType == null ) {
// In some OS there is a bug where it always returns null/
String extension = FilenameUtils.getExtension(file.getName()).toLowerCase();
String[] suffixes = ImageIO.getR... | java | public static boolean isImage( File file ){
try {
String mimeType = Files.probeContentType(file.toPath());
if( mimeType == null ) {
// In some OS there is a bug where it always returns null/
String extension = FilenameUtils.getExtension(file.getName()).toLowerCase();
String[] suffixes = ImageIO.getR... | [
"public",
"static",
"boolean",
"isImage",
"(",
"File",
"file",
")",
"{",
"try",
"{",
"String",
"mimeType",
"=",
"Files",
".",
"probeContentType",
"(",
"file",
".",
"toPath",
"(",
")",
")",
";",
"if",
"(",
"mimeType",
"==",
"null",
")",
"{",
"// In some... | Uses mime type to determine if it's an image or not. If mime fails it will look at the suffix. This
isn't 100% correct. | [
"Uses",
"mime",
"type",
"to",
"determine",
"if",
"it",
"s",
"an",
"image",
"or",
"not",
".",
"If",
"mime",
"fails",
"it",
"will",
"look",
"at",
"the",
"suffix",
".",
"This",
"isn",
"t",
"100%",
"correct",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/BoofSwingUtil.java#L369-L386 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java | IntegralImageOps.print | public static void print( IntegralKernel kernel )
{
int x0 = 0,x1=0,y0=0,y1=0;
for( ImageRectangle k : kernel.blocks) {
if( k.x0 < x0 )
x0 = k.x0;
if( k.y0 < y0 )
y0 = k.y0;
if( k.x1 > x1 )
x1 = k.x1;
if( k.y1 > y1 )
y1 = k.y1;
}
int w = x1-x0;
int h = y1-y0;
int sum[] = new i... | java | public static void print( IntegralKernel kernel )
{
int x0 = 0,x1=0,y0=0,y1=0;
for( ImageRectangle k : kernel.blocks) {
if( k.x0 < x0 )
x0 = k.x0;
if( k.y0 < y0 )
y0 = k.y0;
if( k.x1 > x1 )
x1 = k.x1;
if( k.y1 > y1 )
y1 = k.y1;
}
int w = x1-x0;
int h = y1-y0;
int sum[] = new i... | [
"public",
"static",
"void",
"print",
"(",
"IntegralKernel",
"kernel",
")",
"{",
"int",
"x0",
"=",
"0",
",",
"x1",
"=",
"0",
",",
"y0",
"=",
"0",
",",
"y1",
"=",
"0",
";",
"for",
"(",
"ImageRectangle",
"k",
":",
"kernel",
".",
"blocks",
")",
"{",
... | Prints out the kernel.
@param kernel THe kernel which is to be printed. | [
"Prints",
"out",
"the",
"kernel",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L508-L547 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java | IntegralImageOps.isInBounds | public static boolean isInBounds( int x , int y , IntegralKernel kernel , int width , int height )
{
for(ImageRectangle r : kernel.blocks ) {
if( x+r.x0 < 0 || y+r.y0 < 0 )
return false;
if( x+r.x1 >= width || y+r.y1 >= height )
return false;
}
return true;
} | java | public static boolean isInBounds( int x , int y , IntegralKernel kernel , int width , int height )
{
for(ImageRectangle r : kernel.blocks ) {
if( x+r.x0 < 0 || y+r.y0 < 0 )
return false;
if( x+r.x1 >= width || y+r.y1 >= height )
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isInBounds",
"(",
"int",
"x",
",",
"int",
"y",
",",
"IntegralKernel",
"kernel",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"for",
"(",
"ImageRectangle",
"r",
":",
"kernel",
".",
"blocks",
")",
"{",
"if",
"(",
... | Checks to see if the kernel is applied at this specific spot if all the pixels
would be inside the image bounds or not
@param x location where the kernel is applied. x-axis
@param y location where the kernel is applied. y-axis
@param kernel The kernel
@param width Image's width
@param height Image's height
@return tru... | [
"Checks",
"to",
"see",
"if",
"the",
"kernel",
"is",
"applied",
"at",
"this",
"specific",
"spot",
"if",
"all",
"the",
"pixels",
"would",
"be",
"inside",
"the",
"image",
"bounds",
"or",
"not"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L560-L570 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/pyramid/PyramidDiscrete.java | PyramidDiscrete.setScaleFactors | public void setScaleFactors( int ...scaleFactors ) {
for( int i = 1; i < scaleFactors.length; i++ ){
if( scaleFactors[i] % scaleFactors[i-1] != 0 ) {
throw new IllegalArgumentException("Layer "+i+" is not evenly divisible by its lower layer.");
}
}
// set width/height to zero to force the image to be r... | java | public void setScaleFactors( int ...scaleFactors ) {
for( int i = 1; i < scaleFactors.length; i++ ){
if( scaleFactors[i] % scaleFactors[i-1] != 0 ) {
throw new IllegalArgumentException("Layer "+i+" is not evenly divisible by its lower layer.");
}
}
// set width/height to zero to force the image to be r... | [
"public",
"void",
"setScaleFactors",
"(",
"int",
"...",
"scaleFactors",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"scaleFactors",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"scaleFactors",
"[",
"i",
"]",
"%",
"scaleFactors",... | Specifies the pyramid's structure. Scale factors are in relative to the input image.
@param scaleFactors Change in scale factor for each layer in the pyramid. | [
"Specifies",
"the",
"pyramid",
"s",
"structure",
".",
"Scale",
"factors",
"are",
"in",
"relative",
"to",
"the",
"input",
"image",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/pyramid/PyramidDiscrete.java#L60-L71 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFit.java | SplitMergeLineFit.process | public boolean process( List<Point2D_I32> list , GrowQueue_I32 vertexes ) {
this.contour = list;
this.minimumSideLengthPixel = minimumSideLength.computeI(contour.size());
splits.reset();
boolean result = _process(list);
// remove reference so that it can be freed
this.contour = null;
vertexes.setTo(spli... | java | public boolean process( List<Point2D_I32> list , GrowQueue_I32 vertexes ) {
this.contour = list;
this.minimumSideLengthPixel = minimumSideLength.computeI(contour.size());
splits.reset();
boolean result = _process(list);
// remove reference so that it can be freed
this.contour = null;
vertexes.setTo(spli... | [
"public",
"boolean",
"process",
"(",
"List",
"<",
"Point2D_I32",
">",
"list",
",",
"GrowQueue_I32",
"vertexes",
")",
"{",
"this",
".",
"contour",
"=",
"list",
";",
"this",
".",
"minimumSideLengthPixel",
"=",
"minimumSideLength",
".",
"computeI",
"(",
"contour"... | Approximates the input list with a set of line segments
@param list (Input) Ordered list of connected points.
@param vertexes (Output) Indexes in the input list which are corners in the polyline
@return true if it could fit a polygon to the points or false if not | [
"Approximates",
"the",
"input",
"list",
"with",
"a",
"set",
"of",
"line",
"segments"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFit.java#L102-L113 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFit.java | SplitMergeLineFit.splitThresholdSq | protected double splitThresholdSq( Point2D_I32 a , Point2D_I32 b ) {
return Math.max(2,a.distance2(b)* toleranceFractionSq);
} | java | protected double splitThresholdSq( Point2D_I32 a , Point2D_I32 b ) {
return Math.max(2,a.distance2(b)* toleranceFractionSq);
} | [
"protected",
"double",
"splitThresholdSq",
"(",
"Point2D_I32",
"a",
",",
"Point2D_I32",
"b",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"2",
",",
"a",
".",
"distance2",
"(",
"b",
")",
"*",
"toleranceFractionSq",
")",
";",
"}"
] | Computes the split threshold from the end point of two lines | [
"Computes",
"the",
"split",
"threshold",
"from",
"the",
"end",
"point",
"of",
"two",
"lines"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFit.java#L120-L122 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/image/ImageInterleaved.java | ImageInterleaved.setTo | @SuppressWarnings({"SuspiciousSystemArraycopy"})
@Override
public void setTo(T orig) {
if (orig.width != width || orig.height != height || orig.numBands != numBands )
reshape(orig.width,orig.height,orig.numBands);
if (!orig.isSubimage() && !isSubimage()) {
System.arraycopy(orig._getData(), orig.startIndex,... | java | @SuppressWarnings({"SuspiciousSystemArraycopy"})
@Override
public void setTo(T orig) {
if (orig.width != width || orig.height != height || orig.numBands != numBands )
reshape(orig.width,orig.height,orig.numBands);
if (!orig.isSubimage() && !isSubimage()) {
System.arraycopy(orig._getData(), orig.startIndex,... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"SuspiciousSystemArraycopy\"",
"}",
")",
"@",
"Override",
"public",
"void",
"setTo",
"(",
"T",
"orig",
")",
"{",
"if",
"(",
"orig",
".",
"width",
"!=",
"width",
"||",
"orig",
".",
"height",
"!=",
"height",
"||",
"orig... | Sets this image equal to the specified image. Automatically resized to match the input image.
@param orig The original image whose value is to be copied into this one | [
"Sets",
"this",
"image",
"equal",
"to",
"the",
"specified",
"image",
".",
"Automatically",
"resized",
"to",
"match",
"the",
"input",
"image",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/image/ImageInterleaved.java#L143-L160 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/HessianBlobIntensity.java | HessianBlobIntensity.determinant | public static void determinant(GrayF32 featureIntensity , GrayF32 hessianXX, GrayF32 hessianYY , GrayF32 hessianXY )
{
InputSanityCheck.checkSameShape(featureIntensity,hessianXX,hessianYY,hessianXY);
ImplHessianBlobIntensity.determinant(featureIntensity,hessianXX,hessianYY,hessianXY);
} | java | public static void determinant(GrayF32 featureIntensity , GrayF32 hessianXX, GrayF32 hessianYY , GrayF32 hessianXY )
{
InputSanityCheck.checkSameShape(featureIntensity,hessianXX,hessianYY,hessianXY);
ImplHessianBlobIntensity.determinant(featureIntensity,hessianXX,hessianYY,hessianXY);
} | [
"public",
"static",
"void",
"determinant",
"(",
"GrayF32",
"featureIntensity",
",",
"GrayF32",
"hessianXX",
",",
"GrayF32",
"hessianYY",
",",
"GrayF32",
"hessianXY",
")",
"{",
"InputSanityCheck",
".",
"checkSameShape",
"(",
"featureIntensity",
",",
"hessianXX",
",",... | Feature intensity using the Hessian matrix's determinant.
@param featureIntensity Output feature intensity. Modified.
@param hessianXX Second derivative along x-axis. Not modified.
@param hessianYY Second derivative along y-axis. Not modified.
@param hessianXY Second derivative along x-axis and y-axis. Not modified. | [
"Feature",
"intensity",
"using",
"the",
"Hessian",
"matrix",
"s",
"determinant",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/HessianBlobIntensity.java#L69-L74 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/HessianBlobIntensity.java | HessianBlobIntensity.trace | public static void trace(GrayF32 featureIntensity , GrayF32 hessianXX, GrayF32 hessianYY )
{
InputSanityCheck.checkSameShape(featureIntensity,hessianXX,hessianYY);
ImplHessianBlobIntensity.trace(featureIntensity,hessianXX,hessianYY);
} | java | public static void trace(GrayF32 featureIntensity , GrayF32 hessianXX, GrayF32 hessianYY )
{
InputSanityCheck.checkSameShape(featureIntensity,hessianXX,hessianYY);
ImplHessianBlobIntensity.trace(featureIntensity,hessianXX,hessianYY);
} | [
"public",
"static",
"void",
"trace",
"(",
"GrayF32",
"featureIntensity",
",",
"GrayF32",
"hessianXX",
",",
"GrayF32",
"hessianYY",
")",
"{",
"InputSanityCheck",
".",
"checkSameShape",
"(",
"featureIntensity",
",",
"hessianXX",
",",
"hessianYY",
")",
";",
"ImplHess... | Feature intensity using the trace of the Hessian matrix. This is also known as the Laplacian.
@param featureIntensity Output feature intensity. Modified.
@param hessianXX Second derivative along x-axis. Not modified.
@param hessianYY Second derivative along y-axis. Not modified. | [
"Feature",
"intensity",
"using",
"the",
"trace",
"of",
"the",
"Hessian",
"matrix",
".",
"This",
"is",
"also",
"known",
"as",
"the",
"Laplacian",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/intensity/HessianBlobIntensity.java#L83-L88 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/abst/filter/binary/BinaryContourHelper.java | BinaryContourHelper.reshape | public void reshape(int width , int height ) {
if( padded == null ) {
binary.reshape(width, height);
} else {
binary.reshape(width + 2, height + 2);
binary.subimage(1, 1, width + 1, height + 1, subimage);
}
} | java | public void reshape(int width , int height ) {
if( padded == null ) {
binary.reshape(width, height);
} else {
binary.reshape(width + 2, height + 2);
binary.subimage(1, 1, width + 1, height + 1, subimage);
}
} | [
"public",
"void",
"reshape",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"if",
"(",
"padded",
"==",
"null",
")",
"{",
"binary",
".",
"reshape",
"(",
"width",
",",
"height",
")",
";",
"}",
"else",
"{",
"binary",
".",
"reshape",
"(",
"width"... | Reshapes data so that the un-padded image has the specified shape. | [
"Reshapes",
"data",
"so",
"that",
"the",
"un",
"-",
"padded",
"image",
"has",
"the",
"specified",
"shape",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/abst/filter/binary/BinaryContourHelper.java#L49-L56 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/edge/EdgeIntensityPolygon.java | EdgeIntensityPolygon.computeEdge | public boolean computeEdge(Polygon2D_F64 polygon , boolean ccw ) {
averageInside = 0;
averageOutside = 0;
double tangentSign = ccw ? 1 : -1;
int totalSides = 0;
for (int i = polygon.size()-1,j=0; j < polygon.size(); i=j,j++) {
Point2D_F64 a = polygon.get(i);
Point2D_F64 b = polygon.get(j);
double... | java | public boolean computeEdge(Polygon2D_F64 polygon , boolean ccw ) {
averageInside = 0;
averageOutside = 0;
double tangentSign = ccw ? 1 : -1;
int totalSides = 0;
for (int i = polygon.size()-1,j=0; j < polygon.size(); i=j,j++) {
Point2D_F64 a = polygon.get(i);
Point2D_F64 b = polygon.get(j);
double... | [
"public",
"boolean",
"computeEdge",
"(",
"Polygon2D_F64",
"polygon",
",",
"boolean",
"ccw",
")",
"{",
"averageInside",
"=",
"0",
";",
"averageOutside",
"=",
"0",
";",
"double",
"tangentSign",
"=",
"ccw",
"?",
"1",
":",
"-",
"1",
";",
"int",
"totalSides",
... | Checks to see if its a valid polygon or a false positive by looking at edge intensity
@param polygon The polygon being tested
@param ccw True if the polygon is counter clockwise
@return true if it could compute the edge intensity, otherwise false | [
"Checks",
"to",
"see",
"if",
"its",
"a",
"valid",
"polygon",
"or",
"a",
"false",
"positive",
"by",
"looking",
"at",
"edge",
"intensity"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/edge/EdgeIntensityPolygon.java#L95-L146 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/edge/EdgeIntensityPolygon.java | EdgeIntensityPolygon.checkIntensity | public boolean checkIntensity( boolean insideDark , double threshold ) {
if( insideDark )
return averageOutside-averageInside >= threshold;
else
return averageInside-averageOutside >= threshold;
} | java | public boolean checkIntensity( boolean insideDark , double threshold ) {
if( insideDark )
return averageOutside-averageInside >= threshold;
else
return averageInside-averageOutside >= threshold;
} | [
"public",
"boolean",
"checkIntensity",
"(",
"boolean",
"insideDark",
",",
"double",
"threshold",
")",
"{",
"if",
"(",
"insideDark",
")",
"return",
"averageOutside",
"-",
"averageInside",
">=",
"threshold",
";",
"else",
"return",
"averageInside",
"-",
"averageOutsi... | Checks the edge intensity against a threshold.
dark: outside-inside ≥ threshold
light: inside-outside ≥ threshold
@param insideDark is the inside of the polygon supposed to be dark or light?
@param threshold threshold for average difference
@return true if the edge intensity is significant enough | [
"Checks",
"the",
"edge",
"intensity",
"against",
"a",
"threshold",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/edge/EdgeIntensityPolygon.java#L158-L163 | train |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java | SelfCalibrationGuessAndCheckFocus.setCamera | public void setCamera( double skew , double cx , double cy , int width , int height ) {
// Define normalization matrix
// center points, remove skew, scale coordinates
double d = Math.sqrt(width*width + height*height);
V.zero();
V.set(0,0,d/2); V.set(0,1,skew); V.set(0,2,cx);
V.set(1,1,d/2); V.set(1,2,cy);... | java | public void setCamera( double skew , double cx , double cy , int width , int height ) {
// Define normalization matrix
// center points, remove skew, scale coordinates
double d = Math.sqrt(width*width + height*height);
V.zero();
V.set(0,0,d/2); V.set(0,1,skew); V.set(0,2,cx);
V.set(1,1,d/2); V.set(1,2,cy);... | [
"public",
"void",
"setCamera",
"(",
"double",
"skew",
",",
"double",
"cx",
",",
"double",
"cy",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"// Define normalization matrix",
"// center points, remove skew, scale coordinates",
"double",
"d",
"=",
"Math",
"... | Specifies known portions of camera intrinsic parameters
@param skew skew
@param cx image center x
@param cy image center y
@param width Image width
@param height Image height | [
"Specifies",
"known",
"portions",
"of",
"camera",
"intrinsic",
"parameters"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java#L134-L145 | train |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java | SelfCalibrationGuessAndCheckFocus.setSampling | public void setSampling( double min , double max , int total ) {
this.sampleMin = min;
this.sampleMax = max;
this.numSamples = total;
this.scores = new double[numSamples];
} | java | public void setSampling( double min , double max , int total ) {
this.sampleMin = min;
this.sampleMax = max;
this.numSamples = total;
this.scores = new double[numSamples];
} | [
"public",
"void",
"setSampling",
"(",
"double",
"min",
",",
"double",
"max",
",",
"int",
"total",
")",
"{",
"this",
".",
"sampleMin",
"=",
"min",
";",
"this",
".",
"sampleMax",
"=",
"max",
";",
"this",
".",
"numSamples",
"=",
"total",
";",
"this",
".... | Specifies how focal lengths are sampled on a log scale. Remember 1.0 = nominal length
@param min min value. 0.3 is default
@param max max value. 3.0 is default
@param total Number of sample points. 50 is default | [
"Specifies",
"how",
"focal",
"lengths",
"are",
"sampled",
"on",
"a",
"log",
"scale",
".",
"Remember",
"1",
".",
"0",
"=",
"nominal",
"length"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java#L154-L159 | train |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java | SelfCalibrationGuessAndCheckFocus.computeRectifyH | boolean computeRectifyH( double f1 , double f2 , DMatrixRMaj P2, DMatrixRMaj H ) {
estimatePlaneInf.setCamera1(f1,f1,0,0,0);
estimatePlaneInf.setCamera2(f2,f2,0,0,0);
if( !estimatePlaneInf.estimatePlaneAtInfinity(P2,planeInf) )
return false;
// TODO add a cost for distance from nominal and scale other cos... | java | boolean computeRectifyH( double f1 , double f2 , DMatrixRMaj P2, DMatrixRMaj H ) {
estimatePlaneInf.setCamera1(f1,f1,0,0,0);
estimatePlaneInf.setCamera2(f2,f2,0,0,0);
if( !estimatePlaneInf.estimatePlaneAtInfinity(P2,planeInf) )
return false;
// TODO add a cost for distance from nominal and scale other cos... | [
"boolean",
"computeRectifyH",
"(",
"double",
"f1",
",",
"double",
"f2",
",",
"DMatrixRMaj",
"P2",
",",
"DMatrixRMaj",
"H",
")",
"{",
"estimatePlaneInf",
".",
"setCamera1",
"(",
"f1",
",",
"f1",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"estimatePlaneInf",
... | Given the focal lengths for the first two views compute homography H
@param f1 view 1 focal length
@param f2 view 2 focal length
@param P2 projective camera matrix for view 2
@param H (Output) homography
@return true if successful | [
"Given",
"the",
"focal",
"lengths",
"for",
"the",
"first",
"two",
"views",
"compute",
"homography",
"H"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java#L302-L329 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java | EllipseClustersIntoGrid.findLine | protected static List<NodeInfo> findLine(NodeInfo seed, NodeInfo next, int clusterSize, List<NodeInfo> line, boolean ccw ) {
if( next == null )
return null;
if( line == null )
line = new ArrayList<>();
else
line.clear();
next.marked = true;
double anglePrev = direction(next, seed);
double prevDis... | java | protected static List<NodeInfo> findLine(NodeInfo seed, NodeInfo next, int clusterSize, List<NodeInfo> line, boolean ccw ) {
if( next == null )
return null;
if( line == null )
line = new ArrayList<>();
else
line.clear();
next.marked = true;
double anglePrev = direction(next, seed);
double prevDis... | [
"protected",
"static",
"List",
"<",
"NodeInfo",
">",
"findLine",
"(",
"NodeInfo",
"seed",
",",
"NodeInfo",
"next",
",",
"int",
"clusterSize",
",",
"List",
"<",
"NodeInfo",
">",
"line",
",",
"boolean",
"ccw",
")",
"{",
"if",
"(",
"next",
"==",
"null",
"... | Finds all the nodes which form an approximate line
@param seed First ellipse
@param next Second ellipse, specified direction of line relative to seed
@param line
@return All the nodes along the line | [
"Finds",
"all",
"the",
"nodes",
"which",
"form",
"an",
"approximate",
"line"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java#L88-L168 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java | EllipseClustersIntoGrid.findClosestEdge | protected static NodeInfo findClosestEdge( NodeInfo n , Point2D_F64 p ) {
double bestDistance = Double.MAX_VALUE;
NodeInfo best = null;
for (int i = 0; i < n.edges.size(); i++) {
Edge e = n.edges.get(i);
if( e.target.marked )
continue;
double d = e.target.ellipse.center.distance2(p);
if( d < bes... | java | protected static NodeInfo findClosestEdge( NodeInfo n , Point2D_F64 p ) {
double bestDistance = Double.MAX_VALUE;
NodeInfo best = null;
for (int i = 0; i < n.edges.size(); i++) {
Edge e = n.edges.get(i);
if( e.target.marked )
continue;
double d = e.target.ellipse.center.distance2(p);
if( d < bes... | [
"protected",
"static",
"NodeInfo",
"findClosestEdge",
"(",
"NodeInfo",
"n",
",",
"Point2D_F64",
"p",
")",
"{",
"double",
"bestDistance",
"=",
"Double",
".",
"MAX_VALUE",
";",
"NodeInfo",
"best",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i... | Finds the node which is an edge of 'n' that is closest to point 'p' | [
"Finds",
"the",
"node",
"which",
"is",
"an",
"edge",
"of",
"n",
"that",
"is",
"closest",
"to",
"point",
"p"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java#L217-L234 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java | EllipseClustersIntoGrid.checkDuplicates | boolean checkDuplicates(List<List<NodeInfo>> grid ) {
for (int i = 0; i < listInfo.size; i++) {
listInfo.get(i).marked = false;
}
for (int i = 0; i < grid.size(); i++) {
List<NodeInfo> list = grid.get(i);
for (int j = 0; j < list.size(); j++) {
NodeInfo n = list.get(j);
if( n.marked )
retu... | java | boolean checkDuplicates(List<List<NodeInfo>> grid ) {
for (int i = 0; i < listInfo.size; i++) {
listInfo.get(i).marked = false;
}
for (int i = 0; i < grid.size(); i++) {
List<NodeInfo> list = grid.get(i);
for (int j = 0; j < list.size(); j++) {
NodeInfo n = list.get(j);
if( n.marked )
retu... | [
"boolean",
"checkDuplicates",
"(",
"List",
"<",
"List",
"<",
"NodeInfo",
">",
">",
"grid",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listInfo",
".",
"size",
";",
"i",
"++",
")",
"{",
"listInfo",
".",
"get",
"(",
"i",
")",
".",... | Checks to see if any node is used more than once | [
"Checks",
"to",
"see",
"if",
"any",
"node",
"is",
"used",
"more",
"than",
"once"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java#L239-L255 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java | EllipseClustersIntoGrid.addEdgesToInfo | void addEdgesToInfo(List<Node> cluster) {
for (int i = 0; i < cluster.size(); i++) {
Node n = cluster.get(i);
NodeInfo infoA = listInfo.get(i);
EllipseRotated_F64 a = infoA.ellipse;
// create the edges and order them based on their direction
for (int j = 0; j < n.connections.size(); j++) {
NodeInf... | java | void addEdgesToInfo(List<Node> cluster) {
for (int i = 0; i < cluster.size(); i++) {
Node n = cluster.get(i);
NodeInfo infoA = listInfo.get(i);
EllipseRotated_F64 a = infoA.ellipse;
// create the edges and order them based on their direction
for (int j = 0; j < n.connections.size(); j++) {
NodeInf... | [
"void",
"addEdgesToInfo",
"(",
"List",
"<",
"Node",
">",
"cluster",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cluster",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Node",
"n",
"=",
"cluster",
".",
"get",
"(",
"i",
")",... | Adds edges to node info and computes their orientation | [
"Adds",
"edges",
"to",
"node",
"info",
"and",
"computes",
"their",
"orientation"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java#L288-L308 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java | EllipseClustersIntoGrid.pruneNearlyIdenticalAngles | void pruneNearlyIdenticalAngles() {
for (int i = 0; i < listInfo.size(); i++) {
NodeInfo infoN = listInfo.get(i);
for (int j = 0; j < infoN.edges.size(); ) {
int k = (j+1)%infoN.edges.size;
double angularDiff = UtilAngle.dist(infoN.edges.get(j).angle,infoN.edges.get(k).angle);
if( angularDiff < Ut... | java | void pruneNearlyIdenticalAngles() {
for (int i = 0; i < listInfo.size(); i++) {
NodeInfo infoN = listInfo.get(i);
for (int j = 0; j < infoN.edges.size(); ) {
int k = (j+1)%infoN.edges.size;
double angularDiff = UtilAngle.dist(infoN.edges.get(j).angle,infoN.edges.get(k).angle);
if( angularDiff < Ut... | [
"void",
"pruneNearlyIdenticalAngles",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listInfo",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"NodeInfo",
"infoN",
"=",
"listInfo",
".",
"get",
"(",
"i",
")",
";",
"for",
"(",
... | If there is a nearly perfect line a node farther down the line can come before. This just selects the closest | [
"If",
"there",
"is",
"a",
"nearly",
"perfect",
"line",
"a",
"node",
"farther",
"down",
"the",
"line",
"can",
"come",
"before",
".",
"This",
"just",
"selects",
"the",
"closest"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java#L313-L339 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java | EllipseClustersIntoGrid.findLargestAnglesForAllNodes | void findLargestAnglesForAllNodes() {
for (int i = 0; i < listInfo.size(); i++) {
NodeInfo info = listInfo.get(i);
if( info.edges.size < 2 )
continue;
for (int k = 0, j = info.edges.size-1; k < info.edges.size; j=k,k++) {
double angleA = info.edges.get(j).angle;
double angleB = info.edges.get(k... | java | void findLargestAnglesForAllNodes() {
for (int i = 0; i < listInfo.size(); i++) {
NodeInfo info = listInfo.get(i);
if( info.edges.size < 2 )
continue;
for (int k = 0, j = info.edges.size-1; k < info.edges.size; j=k,k++) {
double angleA = info.edges.get(j).angle;
double angleB = info.edges.get(k... | [
"void",
"findLargestAnglesForAllNodes",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listInfo",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"NodeInfo",
"info",
"=",
"listInfo",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
... | Finds the two edges with the greatest angular distance between them. | [
"Finds",
"the",
"two",
"edges",
"with",
"the",
"greatest",
"angular",
"distance",
"between",
"them",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java#L344-L364 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java | EllipseClustersIntoGrid.findContour | boolean findContour( boolean mustHaveInner ) {
// find the node with the largest angleBetween
NodeInfo seed = listInfo.get(0);
for (int i = 1; i < listInfo.size(); i++) {
NodeInfo info = listInfo.get(i);
if( info.angleBetween > seed.angleBetween ) {
seed = info;
}
}
// trace around the contour
... | java | boolean findContour( boolean mustHaveInner ) {
// find the node with the largest angleBetween
NodeInfo seed = listInfo.get(0);
for (int i = 1; i < listInfo.size(); i++) {
NodeInfo info = listInfo.get(i);
if( info.angleBetween > seed.angleBetween ) {
seed = info;
}
}
// trace around the contour
... | [
"boolean",
"findContour",
"(",
"boolean",
"mustHaveInner",
")",
"{",
"// find the node with the largest angleBetween",
"NodeInfo",
"seed",
"=",
"listInfo",
".",
"get",
"(",
"0",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"listInfo",
".",
"siz... | Finds nodes in the outside of the grid. First the node in the grid with the largest 'angleBetween'
is selected as a seed. It is assumed at this node must be on the contour. Then the graph is traversed
in CCW direction until a loop is formed.
@return true if valid and false if invalid | [
"Finds",
"nodes",
"in",
"the",
"outside",
"of",
"the",
"grid",
".",
"First",
"the",
"node",
"in",
"the",
"grid",
"with",
"the",
"largest",
"angleBetween",
"is",
"selected",
"as",
"a",
"seed",
".",
"It",
"is",
"assumed",
"at",
"this",
"node",
"must",
"b... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java#L373-L401 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java | EllipseClustersIntoGrid.indexOf | public static int indexOf(List<Node> list , int value ) {
for (int i = 0; i < list.size(); i++) {
if( list.get(i).which == value )
return i;
}
return -1;
} | java | public static int indexOf(List<Node> list , int value ) {
for (int i = 0; i < list.size(); i++) {
if( list.get(i).which == value )
return i;
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"List",
"<",
"Node",
">",
"list",
",",
"int",
"value",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"list",
".",
"g... | Finds the node with the index of 'value' | [
"Finds",
"the",
"node",
"with",
"the",
"index",
"of",
"value"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java#L406-L414 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java | EllipseClustersIntoGrid.selectSeedCorner | NodeInfo selectSeedCorner() {
NodeInfo best = null;
double bestAngle = 0;
for (int i = 0; i < contour.size; i++) {
NodeInfo info = contour.get(i);
if( info.angleBetween > bestAngle ) {
bestAngle = info.angleBetween;
best = info;
}
}
best.marked = true;
return best;
} | java | NodeInfo selectSeedCorner() {
NodeInfo best = null;
double bestAngle = 0;
for (int i = 0; i < contour.size; i++) {
NodeInfo info = contour.get(i);
if( info.angleBetween > bestAngle ) {
bestAngle = info.angleBetween;
best = info;
}
}
best.marked = true;
return best;
} | [
"NodeInfo",
"selectSeedCorner",
"(",
")",
"{",
"NodeInfo",
"best",
"=",
"null",
";",
"double",
"bestAngle",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"contour",
".",
"size",
";",
"i",
"++",
")",
"{",
"NodeInfo",
"info",
"=",
... | Pick the node in the contour with the largest angle. Distortion tends to make the acute angle smaller.
Without distortion it will be 270 degrees. | [
"Pick",
"the",
"node",
"in",
"the",
"contour",
"with",
"the",
"largest",
"angle",
".",
"Distortion",
"tends",
"to",
"make",
"the",
"acute",
"angle",
"smaller",
".",
"Without",
"distortion",
"it",
"will",
"be",
"270",
"degrees",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java#L420-L435 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/depth/VisualDepthOps.java | VisualDepthOps.depthTo3D | public static void depthTo3D(CameraPinholeBrown param , GrayU16 depth , FastQueue<Point3D_F64> cloud ) {
cloud.reset();
Point2Transform2_F64 p2n = LensDistortionFactory.narrow(param).undistort_F64(true,false);
Point2D_F64 n = new Point2D_F64();
for( int y = 0; y < depth.height; y++ ) {
int index = depth.s... | java | public static void depthTo3D(CameraPinholeBrown param , GrayU16 depth , FastQueue<Point3D_F64> cloud ) {
cloud.reset();
Point2Transform2_F64 p2n = LensDistortionFactory.narrow(param).undistort_F64(true,false);
Point2D_F64 n = new Point2D_F64();
for( int y = 0; y < depth.height; y++ ) {
int index = depth.s... | [
"public",
"static",
"void",
"depthTo3D",
"(",
"CameraPinholeBrown",
"param",
",",
"GrayU16",
"depth",
",",
"FastQueue",
"<",
"Point3D_F64",
">",
"cloud",
")",
"{",
"cloud",
".",
"reset",
"(",
")",
";",
"Point2Transform2_F64",
"p2n",
"=",
"LensDistortionFactory",... | Creates a point cloud from a depth image.
@param param Intrinsic camera parameters for depth image
@param depth depth image. each value is in millimeters.
@param cloud Output point cloud | [
"Creates",
"a",
"point",
"cloud",
"from",
"a",
"depth",
"image",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/depth/VisualDepthOps.java#L45-L70 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/depth/VisualDepthOps.java | VisualDepthOps.depthTo3D | public static void depthTo3D(CameraPinholeBrown param , Planar<GrayU8> rgb , GrayU16 depth ,
FastQueue<Point3D_F64> cloud , FastQueueArray_I32 cloudColor ) {
cloud.reset();
cloudColor.reset();
RemoveBrownPtoN_F64 p2n = new RemoveBrownPtoN_F64();
p2n.setK(param.fx,param.fy,param.skew,param.cx,param.cy)... | java | public static void depthTo3D(CameraPinholeBrown param , Planar<GrayU8> rgb , GrayU16 depth ,
FastQueue<Point3D_F64> cloud , FastQueueArray_I32 cloudColor ) {
cloud.reset();
cloudColor.reset();
RemoveBrownPtoN_F64 p2n = new RemoveBrownPtoN_F64();
p2n.setK(param.fx,param.fy,param.skew,param.cx,param.cy)... | [
"public",
"static",
"void",
"depthTo3D",
"(",
"CameraPinholeBrown",
"param",
",",
"Planar",
"<",
"GrayU8",
">",
"rgb",
",",
"GrayU16",
"depth",
",",
"FastQueue",
"<",
"Point3D_F64",
">",
"cloud",
",",
"FastQueueArray_I32",
"cloudColor",
")",
"{",
"cloud",
".",... | Creates a point cloud from a depth image and saves the color information. The depth and color images are
assumed to be aligned.
@param param Intrinsic camera parameters for depth image
@param depth depth image. each value is in millimeters.
@param rgb Color image that's aligned to the depth.
@param cloud Output point... | [
"Creates",
"a",
"point",
"cloud",
"from",
"a",
"depth",
"image",
"and",
"saves",
"the",
"color",
"information",
".",
"The",
"depth",
"and",
"color",
"images",
"are",
"assumed",
"to",
"be",
"aligned",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/depth/VisualDepthOps.java#L81-L119 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java | MinimizeEnergyPrune.prune | public boolean prune(List<Point2D_I32> contour, GrowQueue_I32 input, GrowQueue_I32 output) {
this.contour = contour;
output.setTo(input);
removeDuplicates(output);
// can't prune a corner and it will still be a polygon
if( output.size() <= 3 )
return false;
computeSegmentEnergy(output);
double tota... | java | public boolean prune(List<Point2D_I32> contour, GrowQueue_I32 input, GrowQueue_I32 output) {
this.contour = contour;
output.setTo(input);
removeDuplicates(output);
// can't prune a corner and it will still be a polygon
if( output.size() <= 3 )
return false;
computeSegmentEnergy(output);
double tota... | [
"public",
"boolean",
"prune",
"(",
"List",
"<",
"Point2D_I32",
">",
"contour",
",",
"GrowQueue_I32",
"input",
",",
"GrowQueue_I32",
"output",
")",
"{",
"this",
".",
"contour",
"=",
"contour",
";",
"output",
".",
"setTo",
"(",
"input",
")",
";",
"removeDupl... | Given a contour and initial set of corners compute a new set of corner indexes
@param contour List of points in the shape's contour
@param input Initial set of corners
@param output Pruned set of corners
@return true if one or more corners were pruned, false if nothing changed | [
"Given",
"a",
"contour",
"and",
"initial",
"set",
"of",
"corners",
"compute",
"a",
"new",
"set",
"of",
"corner",
"indexes"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java#L70-L144 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java | MinimizeEnergyPrune.removeDuplicates | void removeDuplicates( GrowQueue_I32 corners ) {
// remove duplicates
for (int i = 0; i < corners.size(); i++) {
Point2D_I32 a = contour.get(corners.get(i));
// start from the top so that removing a corner doesn't mess with the for loop
for (int j = corners.size()-1; j > i; j--) {
Point2D_I32 b = cont... | java | void removeDuplicates( GrowQueue_I32 corners ) {
// remove duplicates
for (int i = 0; i < corners.size(); i++) {
Point2D_I32 a = contour.get(corners.get(i));
// start from the top so that removing a corner doesn't mess with the for loop
for (int j = corners.size()-1; j > i; j--) {
Point2D_I32 b = cont... | [
"void",
"removeDuplicates",
"(",
"GrowQueue_I32",
"corners",
")",
"{",
"// remove duplicates",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"corners",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Point2D_I32",
"a",
"=",
"contour",
".",
"get",
... | Look for two corners which point to the same point and removes one of them from the corner list | [
"Look",
"for",
"two",
"corners",
"which",
"point",
"to",
"the",
"same",
"point",
"and",
"removes",
"one",
"of",
"them",
"from",
"the",
"corner",
"list"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java#L149-L164 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java | MinimizeEnergyPrune.computeSegmentEnergy | void computeSegmentEnergy( GrowQueue_I32 corners ) {
if( energySegment.length < corners.size() ) {
energySegment = new double[ corners.size() ];
}
for (int i = 0,j=corners.size()-1; i < corners.size(); j=i,i++) {
energySegment[j] = computeSegmentEnergy(corners, j, i);
}
} | java | void computeSegmentEnergy( GrowQueue_I32 corners ) {
if( energySegment.length < corners.size() ) {
energySegment = new double[ corners.size() ];
}
for (int i = 0,j=corners.size()-1; i < corners.size(); j=i,i++) {
energySegment[j] = computeSegmentEnergy(corners, j, i);
}
} | [
"void",
"computeSegmentEnergy",
"(",
"GrowQueue_I32",
"corners",
")",
"{",
"if",
"(",
"energySegment",
".",
"length",
"<",
"corners",
".",
"size",
"(",
")",
")",
"{",
"energySegment",
"=",
"new",
"double",
"[",
"corners",
".",
"size",
"(",
")",
"]",
";",... | Computes the energy of each segment individually | [
"Computes",
"the",
"energy",
"of",
"each",
"segment",
"individually"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java#L169-L177 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java | MinimizeEnergyPrune.energyRemoveCorner | protected double energyRemoveCorner( int removed , GrowQueue_I32 corners ) {
double total = 0;
int cornerA = CircularIndex.addOffset(removed, -1 , corners.size());
int cornerB = CircularIndex.addOffset(removed, 1 , corners.size());
total += computeSegmentEnergy(corners, cornerA, cornerB);
if( cornerA > co... | java | protected double energyRemoveCorner( int removed , GrowQueue_I32 corners ) {
double total = 0;
int cornerA = CircularIndex.addOffset(removed, -1 , corners.size());
int cornerB = CircularIndex.addOffset(removed, 1 , corners.size());
total += computeSegmentEnergy(corners, cornerA, cornerB);
if( cornerA > co... | [
"protected",
"double",
"energyRemoveCorner",
"(",
"int",
"removed",
",",
"GrowQueue_I32",
"corners",
")",
"{",
"double",
"total",
"=",
"0",
";",
"int",
"cornerA",
"=",
"CircularIndex",
".",
"addOffset",
"(",
"removed",
",",
"-",
"1",
",",
"corners",
".",
"... | Returns the total energy after removing a corner
@param removed index of the corner that is being removed
@param corners list of corner indexes | [
"Returns",
"the",
"total",
"energy",
"after",
"removing",
"a",
"corner"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java#L184-L205 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java | MinimizeEnergyPrune.computeSegmentEnergy | protected double computeSegmentEnergy(GrowQueue_I32 corners, int cornerA, int cornerB) {
int indexA = corners.get(cornerA);
int indexB = corners.get(cornerB);
if( indexA == indexB ) {
return 100000.0;
}
Point2D_I32 a = contour.get(indexA);
Point2D_I32 b = contour.get(indexB);
line.p.x = a.x;
line.... | java | protected double computeSegmentEnergy(GrowQueue_I32 corners, int cornerA, int cornerB) {
int indexA = corners.get(cornerA);
int indexB = corners.get(cornerB);
if( indexA == indexB ) {
return 100000.0;
}
Point2D_I32 a = contour.get(indexA);
Point2D_I32 b = contour.get(indexB);
line.p.x = a.x;
line.... | [
"protected",
"double",
"computeSegmentEnergy",
"(",
"GrowQueue_I32",
"corners",
",",
"int",
"cornerA",
",",
"int",
"cornerB",
")",
"{",
"int",
"indexA",
"=",
"corners",
".",
"get",
"(",
"cornerA",
")",
";",
"int",
"indexB",
"=",
"corners",
".",
"get",
"(",... | Computes the energy for a segment defined by the two corner indexes | [
"Computes",
"the",
"energy",
"for",
"a",
"segment",
"defined",
"by",
"the",
"two",
"corner",
"indexes"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java#L210-L236 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/MergeSmallRegions.java | MergeSmallRegions.process | public void process( T image,
GrayS32 pixelToRegion ,
GrowQueue_I32 regionMemberCount,
FastQueue<float[]> regionColor ) {
stopRequested = false;
// iterate until no more regions need to be merged together
while( !stopRequested ) {
// Update the color of each region
regionColor.resize(... | java | public void process( T image,
GrayS32 pixelToRegion ,
GrowQueue_I32 regionMemberCount,
FastQueue<float[]> regionColor ) {
stopRequested = false;
// iterate until no more regions need to be merged together
while( !stopRequested ) {
// Update the color of each region
regionColor.resize(... | [
"public",
"void",
"process",
"(",
"T",
"image",
",",
"GrayS32",
"pixelToRegion",
",",
"GrowQueue_I32",
"regionMemberCount",
",",
"FastQueue",
"<",
"float",
"[",
"]",
">",
"regionColor",
")",
"{",
"stopRequested",
"=",
"false",
";",
"// iterate until no more region... | Merges together smaller regions. Segmented image, region member count, and region color are all updated.
@param image Input image. Used to compute color of each region
@param pixelToRegion (input/output) Segmented image with the ID of each region. Modified.
@param regionMemberCount (input/output) Number of members ... | [
"Merges",
"together",
"smaller",
"regions",
".",
"Segmented",
"image",
"region",
"member",
"count",
"and",
"region",
"color",
"are",
"all",
"updated",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/MergeSmallRegions.java#L100-L130 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/MergeSmallRegions.java | MergeSmallRegions.setupPruneList | protected boolean setupPruneList(GrowQueue_I32 regionMemberCount) {
segmentPruneFlag.resize(regionMemberCount.size);
pruneGraph.reset();
segmentToPruneID.resize(regionMemberCount.size);
for( int i = 0; i < regionMemberCount.size; i++ ) {
if( regionMemberCount.get(i) < minimumSize ) {
segmentToPruneID.set... | java | protected boolean setupPruneList(GrowQueue_I32 regionMemberCount) {
segmentPruneFlag.resize(regionMemberCount.size);
pruneGraph.reset();
segmentToPruneID.resize(regionMemberCount.size);
for( int i = 0; i < regionMemberCount.size; i++ ) {
if( regionMemberCount.get(i) < minimumSize ) {
segmentToPruneID.set... | [
"protected",
"boolean",
"setupPruneList",
"(",
"GrowQueue_I32",
"regionMemberCount",
")",
"{",
"segmentPruneFlag",
".",
"resize",
"(",
"regionMemberCount",
".",
"size",
")",
";",
"pruneGraph",
".",
"reset",
"(",
")",
";",
"segmentToPruneID",
".",
"resize",
"(",
... | Identifies which regions are to be pruned based on their member counts. Then sets up
data structures for graph and converting segment ID to prune ID.
@return true If elements need to be pruned and false if not. | [
"Identifies",
"which",
"regions",
"are",
"to",
"be",
"pruned",
"based",
"on",
"their",
"member",
"counts",
".",
"Then",
"sets",
"up",
"data",
"structures",
"for",
"graph",
"and",
"converting",
"segment",
"ID",
"to",
"prune",
"ID",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/MergeSmallRegions.java#L138-L154 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/MergeSmallRegions.java | MergeSmallRegions.findAdjacentRegions | protected void findAdjacentRegions(GrayS32 pixelToRegion) {
// -------- Do the inner pixels first
if( connect.length == 4 )
adjacentInner4(pixelToRegion);
else if( connect.length == 8 ) {
adjacentInner8(pixelToRegion);
}
adjacentBorder(pixelToRegion);
} | java | protected void findAdjacentRegions(GrayS32 pixelToRegion) {
// -------- Do the inner pixels first
if( connect.length == 4 )
adjacentInner4(pixelToRegion);
else if( connect.length == 8 ) {
adjacentInner8(pixelToRegion);
}
adjacentBorder(pixelToRegion);
} | [
"protected",
"void",
"findAdjacentRegions",
"(",
"GrayS32",
"pixelToRegion",
")",
"{",
"// -------- Do the inner pixels first",
"if",
"(",
"connect",
".",
"length",
"==",
"4",
")",
"adjacentInner4",
"(",
"pixelToRegion",
")",
";",
"else",
"if",
"(",
"connect",
"."... | Go through each pixel in the image and examine its neighbors according to a 4-connect rule. If one of
the pixels is in a region that is to be pruned mark them as neighbors. The image is traversed such that
the number of comparisons is minimized. | [
"Go",
"through",
"each",
"pixel",
"in",
"the",
"image",
"and",
"examine",
"its",
"neighbors",
"according",
"to",
"a",
"4",
"-",
"connect",
"rule",
".",
"If",
"one",
"of",
"the",
"pixels",
"is",
"in",
"a",
"region",
"that",
"is",
"to",
"be",
"pruned",
... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/MergeSmallRegions.java#L161-L170 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/MergeSmallRegions.java | MergeSmallRegions.selectMerge | protected void selectMerge( int pruneId , FastQueue<float[]> regionColor ) {
// Grab information on the region which is being pruned
Node n = pruneGraph.get(pruneId);
float[] targetColor = regionColor.get(n.segment);
// segment ID and distance away from the most similar neighbor
int bestId = -1;
float best... | java | protected void selectMerge( int pruneId , FastQueue<float[]> regionColor ) {
// Grab information on the region which is being pruned
Node n = pruneGraph.get(pruneId);
float[] targetColor = regionColor.get(n.segment);
// segment ID and distance away from the most similar neighbor
int bestId = -1;
float best... | [
"protected",
"void",
"selectMerge",
"(",
"int",
"pruneId",
",",
"FastQueue",
"<",
"float",
"[",
"]",
">",
"regionColor",
")",
"{",
"// Grab information on the region which is being pruned",
"Node",
"n",
"=",
"pruneGraph",
".",
"get",
"(",
"pruneId",
")",
";",
"f... | Examine edges for the specified node and select node which it is the best match for it to merge with
@param pruneId The prune Id of the segment which is to be merged into another segment
@param regionColor List of region colors | [
"Examine",
"edges",
"for",
"the",
"specified",
"node",
"and",
"select",
"node",
"which",
"it",
"is",
"the",
"best",
"match",
"for",
"it",
"to",
"merge",
"with"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/MergeSmallRegions.java#L343-L368 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/EasyGeneralFeatureDetector.java | EasyGeneralFeatureDetector.declareDerivativeImages | private void declareDerivativeImages(ImageGradient<T, D> gradient, ImageHessian<D> hessian, Class<D> derivType) {
if( gradient != null || hessian != null ) {
derivX = GeneralizedImageOps.createSingleBand(derivType, 1, 1);
derivY = GeneralizedImageOps.createSingleBand(derivType,1,1);
}
if( hessian != null ) ... | java | private void declareDerivativeImages(ImageGradient<T, D> gradient, ImageHessian<D> hessian, Class<D> derivType) {
if( gradient != null || hessian != null ) {
derivX = GeneralizedImageOps.createSingleBand(derivType, 1, 1);
derivY = GeneralizedImageOps.createSingleBand(derivType,1,1);
}
if( hessian != null ) ... | [
"private",
"void",
"declareDerivativeImages",
"(",
"ImageGradient",
"<",
"T",
",",
"D",
">",
"gradient",
",",
"ImageHessian",
"<",
"D",
">",
"hessian",
",",
"Class",
"<",
"D",
">",
"derivType",
")",
"{",
"if",
"(",
"gradient",
"!=",
"null",
"||",
"hessia... | Declare storage for image derivatives as needed | [
"Declare",
"storage",
"for",
"image",
"derivatives",
"as",
"needed"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/EasyGeneralFeatureDetector.java#L91-L101 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/EasyGeneralFeatureDetector.java | EasyGeneralFeatureDetector.detect | public void detect(T input, QueueCorner exclude ) {
initializeDerivatives(input);
if (detector.getRequiresGradient() || detector.getRequiresHessian())
gradient.process(input, derivX, derivY);
if (detector.getRequiresHessian())
hessian.process(derivX, derivY, derivXX, derivYY, derivXY);
detector.setExcl... | java | public void detect(T input, QueueCorner exclude ) {
initializeDerivatives(input);
if (detector.getRequiresGradient() || detector.getRequiresHessian())
gradient.process(input, derivX, derivY);
if (detector.getRequiresHessian())
hessian.process(derivX, derivY, derivXX, derivYY, derivXY);
detector.setExcl... | [
"public",
"void",
"detect",
"(",
"T",
"input",
",",
"QueueCorner",
"exclude",
")",
"{",
"initializeDerivatives",
"(",
"input",
")",
";",
"if",
"(",
"detector",
".",
"getRequiresGradient",
"(",
")",
"||",
"detector",
".",
"getRequiresHessian",
"(",
")",
")",
... | Detect features inside the image. Excluding points in the exclude list.
@param input Image being processed.
@param exclude List of points that should not be returned. | [
"Detect",
"features",
"inside",
"the",
"image",
".",
"Excluding",
"points",
"in",
"the",
"exclude",
"list",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/EasyGeneralFeatureDetector.java#L109-L120 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/EasyGeneralFeatureDetector.java | EasyGeneralFeatureDetector.initializeDerivatives | private void initializeDerivatives(T input) {
// reshape derivatives if the input image has changed size
if (detector.getRequiresGradient() || detector.getRequiresHessian()) {
derivX.reshape(input.width, input.height);
derivY.reshape(input.width, input.height);
}
if (detector.getRequiresHessian()) {
de... | java | private void initializeDerivatives(T input) {
// reshape derivatives if the input image has changed size
if (detector.getRequiresGradient() || detector.getRequiresHessian()) {
derivX.reshape(input.width, input.height);
derivY.reshape(input.width, input.height);
}
if (detector.getRequiresHessian()) {
de... | [
"private",
"void",
"initializeDerivatives",
"(",
"T",
"input",
")",
"{",
"// reshape derivatives if the input image has changed size",
"if",
"(",
"detector",
".",
"getRequiresGradient",
"(",
")",
"||",
"detector",
".",
"getRequiresHessian",
"(",
")",
")",
"{",
"derivX... | Reshape derivative images to match the input image | [
"Reshape",
"derivative",
"images",
"to",
"match",
"the",
"input",
"image"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/EasyGeneralFeatureDetector.java#L125-L136 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java | SquareGridTools.checkFlip | public boolean checkFlip( SquareGrid grid ) {
if( grid.columns == 1 || grid.rows == 1 )
return false;
Point2D_F64 a = grid.get(0,0).center;
Point2D_F64 b = grid.get(0,grid.columns-1).center;
Point2D_F64 c = grid.get(grid.rows-1,0).center;
double x0 = b.x-a.x;
double y0 = b.y-a.y;
double x1 = c.x-a.x... | java | public boolean checkFlip( SquareGrid grid ) {
if( grid.columns == 1 || grid.rows == 1 )
return false;
Point2D_F64 a = grid.get(0,0).center;
Point2D_F64 b = grid.get(0,grid.columns-1).center;
Point2D_F64 c = grid.get(grid.rows-1,0).center;
double x0 = b.x-a.x;
double y0 = b.y-a.y;
double x1 = c.x-a.x... | [
"public",
"boolean",
"checkFlip",
"(",
"SquareGrid",
"grid",
")",
"{",
"if",
"(",
"grid",
".",
"columns",
"==",
"1",
"||",
"grid",
".",
"rows",
"==",
"1",
")",
"return",
"false",
";",
"Point2D_F64",
"a",
"=",
"grid",
".",
"get",
"(",
"0",
",",
"0",... | Checks to see if it needs to be flipped. Flipping is required if X and Y axis in 2D grid
are not CCW. | [
"Checks",
"to",
"see",
"if",
"it",
"needs",
"to",
"be",
"flipped",
".",
"Flipping",
"is",
"required",
"if",
"X",
"and",
"Y",
"axis",
"in",
"2D",
"grid",
"are",
"not",
"CCW",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java#L95-L112 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java | SquareGridTools.orderNodeGrid | protected void orderNodeGrid(SquareGrid grid, int row, int col) {
SquareNode node = grid.get(row,col);
if(grid.rows==1 && grid.columns==1 ) {
for (int i = 0; i < 4; i++) {
ordered[i] = node.square.get(i);
}
} else if( grid.columns==1 ) {
if (row == grid.rows - 1) {
orderNode(node, grid.get(row -... | java | protected void orderNodeGrid(SquareGrid grid, int row, int col) {
SquareNode node = grid.get(row,col);
if(grid.rows==1 && grid.columns==1 ) {
for (int i = 0; i < 4; i++) {
ordered[i] = node.square.get(i);
}
} else if( grid.columns==1 ) {
if (row == grid.rows - 1) {
orderNode(node, grid.get(row -... | [
"protected",
"void",
"orderNodeGrid",
"(",
"SquareGrid",
"grid",
",",
"int",
"row",
",",
"int",
"col",
")",
"{",
"SquareNode",
"node",
"=",
"grid",
".",
"get",
"(",
"row",
",",
"col",
")",
";",
"if",
"(",
"grid",
".",
"rows",
"==",
"1",
"&&",
"grid... | Given the grid coordinate, order the corners for the node at that location. Takes in handles situations
where there are no neighbors. | [
"Given",
"the",
"grid",
"coordinate",
"order",
"the",
"corners",
"for",
"the",
"node",
"at",
"that",
"location",
".",
"Takes",
"in",
"handles",
"situations",
"where",
"there",
"are",
"no",
"neighbors",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java#L223-L245 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java | SquareGridTools.rotateTwiceOrdered | private void rotateTwiceOrdered() {
Point2D_F64 a = ordered[0];
Point2D_F64 b = ordered[1];
Point2D_F64 c = ordered[2];
Point2D_F64 d = ordered[3];
ordered[0] = c;
ordered[1] = d;
ordered[2] = a;
ordered[3] = b;
} | java | private void rotateTwiceOrdered() {
Point2D_F64 a = ordered[0];
Point2D_F64 b = ordered[1];
Point2D_F64 c = ordered[2];
Point2D_F64 d = ordered[3];
ordered[0] = c;
ordered[1] = d;
ordered[2] = a;
ordered[3] = b;
} | [
"private",
"void",
"rotateTwiceOrdered",
"(",
")",
"{",
"Point2D_F64",
"a",
"=",
"ordered",
"[",
"0",
"]",
";",
"Point2D_F64",
"b",
"=",
"ordered",
"[",
"1",
"]",
";",
"Point2D_F64",
"c",
"=",
"ordered",
"[",
"2",
"]",
";",
"Point2D_F64",
"d",
"=",
"... | Reorders the list by the equivalent of two rotations | [
"Reorders",
"the",
"list",
"by",
"the",
"equivalent",
"of",
"two",
"rotations"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java#L250-L260 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java | SquareGridTools.orderNode | protected void orderNode(SquareNode target, SquareNode node, boolean pointingX) {
int index0 = findIntersection(target,node);
int index1 = (index0+1)%4;
int index2 = (index0+2)%4;
int index3 = (index0+3)%4;
if( index0 < 0 )
throw new RuntimeException("Couldn't find intersection. Probable bug");
line... | java | protected void orderNode(SquareNode target, SquareNode node, boolean pointingX) {
int index0 = findIntersection(target,node);
int index1 = (index0+1)%4;
int index2 = (index0+2)%4;
int index3 = (index0+3)%4;
if( index0 < 0 )
throw new RuntimeException("Couldn't find intersection. Probable bug");
line... | [
"protected",
"void",
"orderNode",
"(",
"SquareNode",
"target",
",",
"SquareNode",
"node",
",",
"boolean",
"pointingX",
")",
"{",
"int",
"index0",
"=",
"findIntersection",
"(",
"target",
",",
"node",
")",
";",
"int",
"index1",
"=",
"(",
"index0",
"+",
"1",
... | Fills the ordered list with the corners in target node in canonical order.
@param pointingX true if 'node' is pointing along the x-axis from target. false for point along y-axis | [
"Fills",
"the",
"ordered",
"list",
"with",
"the",
"corners",
"in",
"target",
"node",
"in",
"canonical",
"order",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java#L274-L321 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java | SquareGridTools.findIntersection | protected int findIntersection( SquareNode target , SquareNode node ) {
lineCenters.a = target.center;
lineCenters.b = node.center;
for (int i = 0; i < 4; i++) {
int j = (i+1)%4;
lineSide.a = target.square.get(i);
lineSide.b = target.square.get(j);
if(Intersection2D_F64.intersection(lineCenters,lin... | java | protected int findIntersection( SquareNode target , SquareNode node ) {
lineCenters.a = target.center;
lineCenters.b = node.center;
for (int i = 0; i < 4; i++) {
int j = (i+1)%4;
lineSide.a = target.square.get(i);
lineSide.b = target.square.get(j);
if(Intersection2D_F64.intersection(lineCenters,lin... | [
"protected",
"int",
"findIntersection",
"(",
"SquareNode",
"target",
",",
"SquareNode",
"node",
")",
"{",
"lineCenters",
".",
"a",
"=",
"target",
".",
"center",
";",
"lineCenters",
".",
"b",
"=",
"node",
".",
"center",
";",
"for",
"(",
"int",
"i",
"=",
... | Finds the side which intersects the line segment from the center of target to center of node | [
"Finds",
"the",
"side",
"which",
"intersects",
"the",
"line",
"segment",
"from",
"the",
"center",
"of",
"target",
"to",
"center",
"of",
"node"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java#L326-L341 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java | SquareGridTools.orderSquareCorners | public boolean orderSquareCorners( SquareGrid grid ) {
// the first pass interleaves every other row
for (int row = 0; row < grid.rows; row++) {
for (int col = 0; col < grid.columns; col++) {
orderNodeGrid(grid, row, col);
Polygon2D_F64 square = grid.get(row,col).square;
for (int i = 0; i < 4; i++... | java | public boolean orderSquareCorners( SquareGrid grid ) {
// the first pass interleaves every other row
for (int row = 0; row < grid.rows; row++) {
for (int col = 0; col < grid.columns; col++) {
orderNodeGrid(grid, row, col);
Polygon2D_F64 square = grid.get(row,col).square;
for (int i = 0; i < 4; i++... | [
"public",
"boolean",
"orderSquareCorners",
"(",
"SquareGrid",
"grid",
")",
"{",
"// the first pass interleaves every other row",
"for",
"(",
"int",
"row",
"=",
"0",
";",
"row",
"<",
"grid",
".",
"rows",
";",
"row",
"++",
")",
"{",
"for",
"(",
"int",
"col",
... | Adjust the corners in the square's polygon so that they are aligned along the grids overall
length
@return true if valid grid or false if not | [
"Adjust",
"the",
"corners",
"in",
"the",
"square",
"s",
"polygon",
"so",
"that",
"they",
"are",
"aligned",
"along",
"the",
"grids",
"overall",
"length"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java#L350-L366 | train |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleTemplateMatching.java | ExampleTemplateMatching.findMatches | private static List<Match> findMatches(GrayF32 image, GrayF32 template, GrayF32 mask,
int expectedMatches) {
// create template matcher.
TemplateMatching<GrayF32> matcher =
FactoryTemplateMatching.createMatcher(TemplateScoreType.SUM_DIFF_SQ, GrayF32.class);
// Find the points which match the tem... | java | private static List<Match> findMatches(GrayF32 image, GrayF32 template, GrayF32 mask,
int expectedMatches) {
// create template matcher.
TemplateMatching<GrayF32> matcher =
FactoryTemplateMatching.createMatcher(TemplateScoreType.SUM_DIFF_SQ, GrayF32.class);
// Find the points which match the tem... | [
"private",
"static",
"List",
"<",
"Match",
">",
"findMatches",
"(",
"GrayF32",
"image",
",",
"GrayF32",
"template",
",",
"GrayF32",
"mask",
",",
"int",
"expectedMatches",
")",
"{",
"// create template matcher.",
"TemplateMatching",
"<",
"GrayF32",
">",
"matcher",
... | Demonstrates how to search for matches of a template inside an image
@param image Image being searched
@param template Template being looked for
@param mask Mask which determines the weight of each template pixel in the match score
@param expectedMatches Number of expected matches it hopes ... | [
"Demonstrates",
"how",
"to",
"search",
"for",
"matches",
"of",
"a",
"template",
"inside",
"an",
"image"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleTemplateMatching.java#L57-L70 | train |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleTemplateMatching.java | ExampleTemplateMatching.showMatchIntensity | public static void showMatchIntensity(GrayF32 image, GrayF32 template, GrayF32 mask) {
// create algorithm for computing intensity image
TemplateMatchingIntensity<GrayF32> matchIntensity =
FactoryTemplateMatching.createIntensity(TemplateScoreType.SUM_DIFF_SQ, GrayF32.class);
// apply the template to the ima... | java | public static void showMatchIntensity(GrayF32 image, GrayF32 template, GrayF32 mask) {
// create algorithm for computing intensity image
TemplateMatchingIntensity<GrayF32> matchIntensity =
FactoryTemplateMatching.createIntensity(TemplateScoreType.SUM_DIFF_SQ, GrayF32.class);
// apply the template to the ima... | [
"public",
"static",
"void",
"showMatchIntensity",
"(",
"GrayF32",
"image",
",",
"GrayF32",
"template",
",",
"GrayF32",
"mask",
")",
"{",
"// create algorithm for computing intensity image",
"TemplateMatchingIntensity",
"<",
"GrayF32",
">",
"matchIntensity",
"=",
"FactoryT... | Computes the template match intensity image and displays the results. Brighter intensity indicates
a better match to the template. | [
"Computes",
"the",
"template",
"match",
"intensity",
"image",
"and",
"displays",
"the",
"results",
".",
"Brighter",
"intensity",
"indicates",
"a",
"better",
"match",
"to",
"the",
"template",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleTemplateMatching.java#L76-L101 | train |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleTemplateMatching.java | ExampleTemplateMatching.drawRectangles | private static void drawRectangles(Graphics2D g2,
GrayF32 image, GrayF32 template, GrayF32 mask,
int expectedMatches) {
List<Match> found = findMatches(image, template, mask, expectedMatches);
int r = 2;
int w = template.width + 2 * r;
int h = template.height + 2 * r;
for (Match m : ... | java | private static void drawRectangles(Graphics2D g2,
GrayF32 image, GrayF32 template, GrayF32 mask,
int expectedMatches) {
List<Match> found = findMatches(image, template, mask, expectedMatches);
int r = 2;
int w = template.width + 2 * r;
int h = template.height + 2 * r;
for (Match m : ... | [
"private",
"static",
"void",
"drawRectangles",
"(",
"Graphics2D",
"g2",
",",
"GrayF32",
"image",
",",
"GrayF32",
"template",
",",
"GrayF32",
"mask",
",",
"int",
"expectedMatches",
")",
"{",
"List",
"<",
"Match",
">",
"found",
"=",
"findMatches",
"(",
"image"... | Helper function will is finds matches and displays the results as colored rectangles | [
"Helper",
"function",
"will",
"is",
"finds",
"matches",
"and",
"displays",
"the",
"results",
"as",
"colored",
"rectangles"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleTemplateMatching.java#L138-L165 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/SquareBase_to_FiducialDetector.java | SquareBase_to_FiducialDetector.getCenter | @Override
public void getCenter(int which, Point2D_F64 location) {
Quadrilateral_F64 q = alg.getFound().get(which).distortedPixels;
// compute intersection in undistorted pixels so that the intersection is the true
// geometric center of the square. Since distorted pixels are being used this will only be approx... | java | @Override
public void getCenter(int which, Point2D_F64 location) {
Quadrilateral_F64 q = alg.getFound().get(which).distortedPixels;
// compute intersection in undistorted pixels so that the intersection is the true
// geometric center of the square. Since distorted pixels are being used this will only be approx... | [
"@",
"Override",
"public",
"void",
"getCenter",
"(",
"int",
"which",
",",
"Point2D_F64",
"location",
")",
"{",
"Quadrilateral_F64",
"q",
"=",
"alg",
".",
"getFound",
"(",
")",
".",
"get",
"(",
"which",
")",
".",
"distortedPixels",
";",
"// compute intersecti... | Return the intersection of two lines defined by opposing corners. This should also be the geometric center
@param which Fiducial's index
@param location (output) Storage for the transform. modified. | [
"Return",
"the",
"intersection",
"of",
"two",
"lines",
"defined",
"by",
"opposing",
"corners",
".",
"This",
"should",
"also",
"be",
"the",
"geometric",
"center"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/SquareBase_to_FiducialDetector.java#L91-L101 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareEdge.java | SquareEdge.destination | public <T extends SquareNode>T destination(SquareNode src) {
if( a == src )
return (T)b;
else if( b == src )
return (T)a;
else
throw new IllegalArgumentException("BUG! src is not a or b");
} | java | public <T extends SquareNode>T destination(SquareNode src) {
if( a == src )
return (T)b;
else if( b == src )
return (T)a;
else
throw new IllegalArgumentException("BUG! src is not a or b");
} | [
"public",
"<",
"T",
"extends",
"SquareNode",
">",
"T",
"destination",
"(",
"SquareNode",
"src",
")",
"{",
"if",
"(",
"a",
"==",
"src",
")",
"return",
"(",
"T",
")",
"b",
";",
"else",
"if",
"(",
"b",
"==",
"src",
")",
"return",
"(",
"T",
")",
"a... | Returns the destination node. | [
"Returns",
"the",
"destination",
"node",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareEdge.java#L51-L58 | train |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/sfm/ExampleVisualOdometryDepth.java | ExampleVisualOdometryDepth.inlierPercent | public static String inlierPercent(VisualOdometry alg) {
if( !(alg instanceof AccessPointTracks3D))
return "";
AccessPointTracks3D access = (AccessPointTracks3D)alg;
int count = 0;
int N = access.getAllTracks().size();
for( int i = 0; i < N; i++ ) {
if( access.isInlier(i) )
count++;
}
return ... | java | public static String inlierPercent(VisualOdometry alg) {
if( !(alg instanceof AccessPointTracks3D))
return "";
AccessPointTracks3D access = (AccessPointTracks3D)alg;
int count = 0;
int N = access.getAllTracks().size();
for( int i = 0; i < N; i++ ) {
if( access.isInlier(i) )
count++;
}
return ... | [
"public",
"static",
"String",
"inlierPercent",
"(",
"VisualOdometry",
"alg",
")",
"{",
"if",
"(",
"!",
"(",
"alg",
"instanceof",
"AccessPointTracks3D",
")",
")",
"return",
"\"\"",
";",
"AccessPointTracks3D",
"access",
"=",
"(",
"AccessPointTracks3D",
")",
"alg",... | If the algorithm implements AccessPointTracks3D, then count the number of inlier features
and return a string. | [
"If",
"the",
"algorithm",
"implements",
"AccessPointTracks3D",
"then",
"count",
"the",
"number",
"of",
"inlier",
"features",
"and",
"return",
"a",
"string",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/sfm/ExampleVisualOdometryDepth.java#L109-L123 | train |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java | ExampleFitPolygon.fitBinaryImage | public static void fitBinaryImage(GrayF32 input) {
GrayU8 binary = new GrayU8(input.width,input.height);
BufferedImage polygon = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
// the mean pixel value is often a reasonable threshold when creating a binary image
double mean = ImageStati... | java | public static void fitBinaryImage(GrayF32 input) {
GrayU8 binary = new GrayU8(input.width,input.height);
BufferedImage polygon = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
// the mean pixel value is often a reasonable threshold when creating a binary image
double mean = ImageStati... | [
"public",
"static",
"void",
"fitBinaryImage",
"(",
"GrayF32",
"input",
")",
"{",
"GrayU8",
"binary",
"=",
"new",
"GrayU8",
"(",
"input",
".",
"width",
",",
"input",
".",
"height",
")",
";",
"BufferedImage",
"polygon",
"=",
"new",
"BufferedImage",
"(",
"inp... | Fits polygons to found contours around binary blobs. | [
"Fits",
"polygons",
"to",
"found",
"contours",
"around",
"binary",
"blobs",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java#L66-L104 | train |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java | ExampleFitPolygon.fitCannyEdges | public static void fitCannyEdges( GrayF32 input ) {
BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
// Finds edges inside the image
CannyEdge<GrayF32,GrayF32> canny =
FactoryEdgeDetectors.canny(2, true, true, GrayF32.class, GrayF32.class);
canny.proces... | java | public static void fitCannyEdges( GrayF32 input ) {
BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
// Finds edges inside the image
CannyEdge<GrayF32,GrayF32> canny =
FactoryEdgeDetectors.canny(2, true, true, GrayF32.class, GrayF32.class);
canny.proces... | [
"public",
"static",
"void",
"fitCannyEdges",
"(",
"GrayF32",
"input",
")",
"{",
"BufferedImage",
"displayImage",
"=",
"new",
"BufferedImage",
"(",
"input",
".",
"width",
",",
"input",
".",
"height",
",",
"BufferedImage",
".",
"TYPE_INT_RGB",
")",
";",
"// Find... | Fits a sequence of line-segments into a sequence of points found using the Canny edge detector. In this case
the points are not connected in a loop. The canny detector produces a more complex tree and the fitted
points can be a bit noisy compared to the others. | [
"Fits",
"a",
"sequence",
"of",
"line",
"-",
"segments",
"into",
"a",
"sequence",
"of",
"points",
"found",
"using",
"the",
"Canny",
"edge",
"detector",
".",
"In",
"this",
"case",
"the",
"points",
"are",
"not",
"connected",
"in",
"a",
"loop",
".",
"The",
... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java#L111-L140 | train |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java | ExampleFitPolygon.fitCannyBinary | public static void fitCannyBinary( GrayF32 input ) {
BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
GrayU8 binary = new GrayU8(input.width,input.height);
// Finds edges inside the image
CannyEdge<GrayF32,GrayF32> canny =
FactoryEdgeDetectors.canny(2, f... | java | public static void fitCannyBinary( GrayF32 input ) {
BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
GrayU8 binary = new GrayU8(input.width,input.height);
// Finds edges inside the image
CannyEdge<GrayF32,GrayF32> canny =
FactoryEdgeDetectors.canny(2, f... | [
"public",
"static",
"void",
"fitCannyBinary",
"(",
"GrayF32",
"input",
")",
"{",
"BufferedImage",
"displayImage",
"=",
"new",
"BufferedImage",
"(",
"input",
".",
"width",
",",
"input",
".",
"height",
",",
"BufferedImage",
".",
"TYPE_INT_RGB",
")",
";",
"GrayU8... | Detects contours inside the binary image generated by canny. Only the external contour is relevant. Often
easier to deal with than working with Canny edges directly. | [
"Detects",
"contours",
"inside",
"the",
"binary",
"image",
"generated",
"by",
"canny",
".",
"Only",
"the",
"external",
"contour",
"is",
"relevant",
".",
"Often",
"easier",
"to",
"deal",
"with",
"than",
"working",
"with",
"Canny",
"edges",
"directly",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java#L146-L174 | train |
lessthanoptimal/BoofCV | main/boofcv-learning/src/main/java/boofcv/alg/bow/LearnSceneFromFiles.java | LearnSceneFromFiles.evaluate | protected Confusion evaluate( Map<String,List<String>> set ) {
ClassificationHistogram histogram = new ClassificationHistogram(scenes.size());
int total = 0;
for (int i = 0; i < scenes.size(); i++) {
total += set.get(scenes.get(i)).size();
}
System.out.println("total images "+total);
for (int i = 0; i ... | java | protected Confusion evaluate( Map<String,List<String>> set ) {
ClassificationHistogram histogram = new ClassificationHistogram(scenes.size());
int total = 0;
for (int i = 0; i < scenes.size(); i++) {
total += set.get(scenes.get(i)).size();
}
System.out.println("total images "+total);
for (int i = 0; i ... | [
"protected",
"Confusion",
"evaluate",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"set",
")",
"{",
"ClassificationHistogram",
"histogram",
"=",
"new",
"ClassificationHistogram",
"(",
"scenes",
".",
"size",
"(",
")",
")",
";",
"int",
"t... | Given a set of images with known classification, predict which scene each one belongs in and compute
a confusion matrix for the results.
@param set Set of classified images
@return Confusion matrix | [
"Given",
"a",
"set",
"of",
"images",
"with",
"known",
"classification",
"predict",
"which",
"scene",
"each",
"one",
"belongs",
"in",
"and",
"compute",
"a",
"confusion",
"matrix",
"for",
"the",
"results",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-learning/src/main/java/boofcv/alg/bow/LearnSceneFromFiles.java#L65-L86 | train |
lessthanoptimal/BoofCV | main/boofcv-learning/src/main/java/boofcv/alg/bow/LearnSceneFromFiles.java | LearnSceneFromFiles.findImages | public static Map<String,List<String>> findImages( File rootDir ) {
File files[] = rootDir.listFiles();
if( files == null )
return null;
List<File> imageDirectories = new ArrayList<>();
for( File f : files ) {
if( f.isDirectory() ) {
imageDirectories.add(f);
}
}
Map<String,List<String>> out = ... | java | public static Map<String,List<String>> findImages( File rootDir ) {
File files[] = rootDir.listFiles();
if( files == null )
return null;
List<File> imageDirectories = new ArrayList<>();
for( File f : files ) {
if( f.isDirectory() ) {
imageDirectories.add(f);
}
}
Map<String,List<String>> out = ... | [
"public",
"static",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"findImages",
"(",
"File",
"rootDir",
")",
"{",
"File",
"files",
"[",
"]",
"=",
"rootDir",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"files",
"==",
"null",
")",
"retu... | Loads the paths to image files contained in subdirectories of the root directory. Each sub directory
is assumed to be a different category of images. | [
"Loads",
"the",
"paths",
"to",
"image",
"files",
"contained",
"in",
"subdirectories",
"of",
"the",
"root",
"directory",
".",
"Each",
"sub",
"directory",
"is",
"assumed",
"to",
"be",
"a",
"different",
"category",
"of",
"images",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-learning/src/main/java/boofcv/alg/bow/LearnSceneFromFiles.java#L163-L196 | train |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/feature/CompareTwoImagePanel.java | CompareTwoImagePanel.setImages | public synchronized void setImages(BufferedImage leftImage , BufferedImage rightImage ) {
this.leftImage = leftImage;
this.rightImage = rightImage;
setPreferredSize(leftImage.getWidth(),leftImage.getHeight(),rightImage.getWidth(),rightImage.getHeight());
} | java | public synchronized void setImages(BufferedImage leftImage , BufferedImage rightImage ) {
this.leftImage = leftImage;
this.rightImage = rightImage;
setPreferredSize(leftImage.getWidth(),leftImage.getHeight(),rightImage.getWidth(),rightImage.getHeight());
} | [
"public",
"synchronized",
"void",
"setImages",
"(",
"BufferedImage",
"leftImage",
",",
"BufferedImage",
"rightImage",
")",
"{",
"this",
".",
"leftImage",
"=",
"leftImage",
";",
"this",
".",
"rightImage",
"=",
"rightImage",
";",
"setPreferredSize",
"(",
"leftImage"... | Sets the internal images. Not thread safe.
@param leftImage
@param rightImage | [
"Sets",
"the",
"internal",
"images",
".",
"Not",
"thread",
"safe",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/feature/CompareTwoImagePanel.java#L93-L98 | train |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/feature/CompareTwoImagePanel.java | CompareTwoImagePanel.computeScales | private void computeScales() {
int width = getWidth();
int height = getHeight();
width = (width-borderSize)/2;
// compute the scale factor for each image
scaleLeft = scaleRight = 1;
if( leftImage.getWidth() > width || leftImage.getHeight() > height ) {
double scaleX = (double)width/(double)leftImage.ge... | java | private void computeScales() {
int width = getWidth();
int height = getHeight();
width = (width-borderSize)/2;
// compute the scale factor for each image
scaleLeft = scaleRight = 1;
if( leftImage.getWidth() > width || leftImage.getHeight() > height ) {
double scaleX = (double)width/(double)leftImage.ge... | [
"private",
"void",
"computeScales",
"(",
")",
"{",
"int",
"width",
"=",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"getHeight",
"(",
")",
";",
"width",
"=",
"(",
"width",
"-",
"borderSize",
")",
"/",
"2",
";",
"// compute the scale factor for each im... | Compute individually how each image will be scaled | [
"Compute",
"individually",
"how",
"each",
"image",
"will",
"be",
"scaled"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/feature/CompareTwoImagePanel.java#L157-L175 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/deepboof/DataManipulationOps.java | DataManipulationOps.normalize | public static void normalize(GrayF32 image , float mean , float stdev ) {
for (int y = 0; y < image.height; y++) {
int index = image.startIndex + y*image.stride;
int end = index + image.width;
while( index < end ) {
image.data[index] = (image.data[index]-mean)/stdev;
index++;
}
}
} | java | public static void normalize(GrayF32 image , float mean , float stdev ) {
for (int y = 0; y < image.height; y++) {
int index = image.startIndex + y*image.stride;
int end = index + image.width;
while( index < end ) {
image.data[index] = (image.data[index]-mean)/stdev;
index++;
}
}
} | [
"public",
"static",
"void",
"normalize",
"(",
"GrayF32",
"image",
",",
"float",
"mean",
",",
"float",
"stdev",
")",
"{",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"image",
".",
"height",
";",
"y",
"++",
")",
"{",
"int",
"index",
"=",
"imag... | Normalizes a gray scale image by first subtracting the mean then dividing by stdev.
@param image Image that is to be normalized
@param mean Value which is subtracted by it
@param stdev The divisor | [
"Normalizes",
"a",
"gray",
"scale",
"image",
"by",
"first",
"subtracting",
"the",
"mean",
"then",
"dividing",
"by",
"stdev",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/deepboof/DataManipulationOps.java#L39-L48 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/deepboof/DataManipulationOps.java | DataManipulationOps.create1D_F32 | public static Kernel1D_F32 create1D_F32( double[] kernel ) {
Kernel1D_F32 k = new Kernel1D_F32(kernel.length,kernel.length/2);
for (int i = 0; i < kernel.length; i++) {
k.data[i] = (float)kernel[i];
}
return k;
} | java | public static Kernel1D_F32 create1D_F32( double[] kernel ) {
Kernel1D_F32 k = new Kernel1D_F32(kernel.length,kernel.length/2);
for (int i = 0; i < kernel.length; i++) {
k.data[i] = (float)kernel[i];
}
return k;
} | [
"public",
"static",
"Kernel1D_F32",
"create1D_F32",
"(",
"double",
"[",
"]",
"kernel",
")",
"{",
"Kernel1D_F32",
"k",
"=",
"new",
"Kernel1D_F32",
"(",
"kernel",
".",
"length",
",",
"kernel",
".",
"length",
"/",
"2",
")",
";",
"for",
"(",
"int",
"i",
"=... | Converts the double array into a 1D float kernel
@param kernel Kernel in array format
@return The kernel | [
"Converts",
"the",
"double",
"array",
"into",
"a",
"1D",
"float",
"kernel"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/deepboof/DataManipulationOps.java#L55-L61 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/deepboof/DataManipulationOps.java | DataManipulationOps.imageToTensor | public static void imageToTensor(Planar<GrayF32> input , Tensor_F32 output , int miniBatch) {
if( input.isSubimage())
throw new RuntimeException("Subimages not accepted");
if( output.getDimension() != 4 )
throw new IllegalArgumentException("Output should be 4-DOF. batch + spatial (channel,height,width)");
... | java | public static void imageToTensor(Planar<GrayF32> input , Tensor_F32 output , int miniBatch) {
if( input.isSubimage())
throw new RuntimeException("Subimages not accepted");
if( output.getDimension() != 4 )
throw new IllegalArgumentException("Output should be 4-DOF. batch + spatial (channel,height,width)");
... | [
"public",
"static",
"void",
"imageToTensor",
"(",
"Planar",
"<",
"GrayF32",
">",
"input",
",",
"Tensor_F32",
"output",
",",
"int",
"miniBatch",
")",
"{",
"if",
"(",
"input",
".",
"isSubimage",
"(",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Subi... | Converts an image into a spatial tensor
@param input BoofCV planar image
@param output Tensor
@param miniBatch Which mini-batch in the tensor should the image be written to | [
"Converts",
"an",
"image",
"into",
"a",
"spatial",
"tensor"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/deepboof/DataManipulationOps.java#L70-L89 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/LinearExternalContours.java | LinearExternalContours.process | public void process( GrayU8 binary , int adjustX , int adjustY ) {
// Initialize data structures
this.adjustX = adjustX;
this.adjustY = adjustY;
storagePoints.reset();
ImageMiscOps.fillBorder(binary, 0, 1);
tracer.setInputs(binary);
final byte binaryData[] = binary.data;
// Scan through the image one ... | java | public void process( GrayU8 binary , int adjustX , int adjustY ) {
// Initialize data structures
this.adjustX = adjustX;
this.adjustY = adjustY;
storagePoints.reset();
ImageMiscOps.fillBorder(binary, 0, 1);
tracer.setInputs(binary);
final byte binaryData[] = binary.data;
// Scan through the image one ... | [
"public",
"void",
"process",
"(",
"GrayU8",
"binary",
",",
"int",
"adjustX",
",",
"int",
"adjustY",
")",
"{",
"// Initialize data structures",
"this",
".",
"adjustX",
"=",
"adjustX",
";",
"this",
".",
"adjustY",
"=",
"adjustY",
";",
"storagePoints",
".",
"re... | Detects contours inside the binary image.
@param binary Binary image. Will be modified. See class description
@param adjustX adjustment applied to coordinate in binary image for contour. 0 or 1 is typical
@param adjustY adjustment applied to coordinate in binary image for contour. 0 or 1 is typical | [
"Detects",
"contours",
"inside",
"the",
"binary",
"image",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/LinearExternalContours.java#L78-L134 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/LinearExternalContours.java | LinearExternalContours.findNotZero | static int findNotZero( byte[] data , int index , int end ) {
while( index < end && data[index] == 0 ) {
index++;
}
return index;
} | java | static int findNotZero( byte[] data , int index , int end ) {
while( index < end && data[index] == 0 ) {
index++;
}
return index;
} | [
"static",
"int",
"findNotZero",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"index",
",",
"int",
"end",
")",
"{",
"while",
"(",
"index",
"<",
"end",
"&&",
"data",
"[",
"index",
"]",
"==",
"0",
")",
"{",
"index",
"++",
";",
"}",
"return",
"index",
... | Searches for a value in the array which is not zero. | [
"Searches",
"for",
"a",
"value",
"in",
"the",
"array",
"which",
"is",
"not",
"zero",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/LinearExternalContours.java#L140-L145 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/LinearExternalContours.java | LinearExternalContours.findZero | static int findZero( byte[] data , int index , int end ) {
while( index < end && data[index] != 0 ) {
index++;
}
return index;
} | java | static int findZero( byte[] data , int index , int end ) {
while( index < end && data[index] != 0 ) {
index++;
}
return index;
} | [
"static",
"int",
"findZero",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"index",
",",
"int",
"end",
")",
"{",
"while",
"(",
"index",
"<",
"end",
"&&",
"data",
"[",
"index",
"]",
"!=",
"0",
")",
"{",
"index",
"++",
";",
"}",
"return",
"index",
"... | Searches for a value in the array which is zero. | [
"Searches",
"for",
"a",
"value",
"in",
"the",
"array",
"which",
"is",
"zero",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/LinearExternalContours.java#L150-L155 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/SquareImage_to_FiducialDetector.java | SquareImage_to_FiducialDetector.addPatternImage | public void addPatternImage(T pattern, double threshold, double lengthSide) {
GrayU8 binary = new GrayU8(pattern.width,pattern.height);
GThresholdImageOps.threshold(pattern,binary,threshold,false);
alg.addPattern(binary, lengthSide);
} | java | public void addPatternImage(T pattern, double threshold, double lengthSide) {
GrayU8 binary = new GrayU8(pattern.width,pattern.height);
GThresholdImageOps.threshold(pattern,binary,threshold,false);
alg.addPattern(binary, lengthSide);
} | [
"public",
"void",
"addPatternImage",
"(",
"T",
"pattern",
",",
"double",
"threshold",
",",
"double",
"lengthSide",
")",
"{",
"GrayU8",
"binary",
"=",
"new",
"GrayU8",
"(",
"pattern",
".",
"width",
",",
"pattern",
".",
"height",
")",
";",
"GThresholdImageOps"... | Add a new pattern to be detected. This function takes in a raw gray scale image and thresholds it.
@param pattern Gray scale image of the pattern
@param threshold Threshold used to convert it into a binary image
@param lengthSide Length of a side on the square in world units. | [
"Add",
"a",
"new",
"pattern",
"to",
"be",
"detected",
".",
"This",
"function",
"takes",
"in",
"a",
"raw",
"gray",
"scale",
"image",
"and",
"thresholds",
"it",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/SquareImage_to_FiducialDetector.java#L48-L52 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.