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-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrPose3DUtils.java | QrPose3DUtils.setLensDistortion | public void setLensDistortion(Point2Transform2_F64 pixelToNorm, Point2Transform2_F64 undistToDist) {
if( pixelToNorm == null ) {
this.pixelToNorm = new DoNothing2Transform2_F64();
this.undistToDist = new DoNothing2Transform2_F64();
} else {
this.pixelToNorm = pixelToNorm;
this.undistToDist = undistToDis... | java | public void setLensDistortion(Point2Transform2_F64 pixelToNorm, Point2Transform2_F64 undistToDist) {
if( pixelToNorm == null ) {
this.pixelToNorm = new DoNothing2Transform2_F64();
this.undistToDist = new DoNothing2Transform2_F64();
} else {
this.pixelToNorm = pixelToNorm;
this.undistToDist = undistToDis... | [
"public",
"void",
"setLensDistortion",
"(",
"Point2Transform2_F64",
"pixelToNorm",
",",
"Point2Transform2_F64",
"undistToDist",
")",
"{",
"if",
"(",
"pixelToNorm",
"==",
"null",
")",
"{",
"this",
".",
"pixelToNorm",
"=",
"new",
"DoNothing2Transform2_F64",
"(",
")",
... | Specifies transform from pixel to normalize image coordinates | [
"Specifies",
"transform",
"from",
"pixel",
"to",
"normalize",
"image",
"coordinates"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrPose3DUtils.java#L172-L180 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/edge/SnapToLineEdge.java | SnapToLineEdge.refine | public boolean refine(Point2D_F64 a, Point2D_F64 b, LineGeneral2D_F64 found) {
// determine the local coordinate system
center.x = (a.x + b.x)/2.0;
center.y = (a.y + b.y)/2.0;
localScale = a.distance(center);
// define the line which points are going to be sampled along
double slopeX = (b.x - a.x);
doub... | java | public boolean refine(Point2D_F64 a, Point2D_F64 b, LineGeneral2D_F64 found) {
// determine the local coordinate system
center.x = (a.x + b.x)/2.0;
center.y = (a.y + b.y)/2.0;
localScale = a.distance(center);
// define the line which points are going to be sampled along
double slopeX = (b.x - a.x);
doub... | [
"public",
"boolean",
"refine",
"(",
"Point2D_F64",
"a",
",",
"Point2D_F64",
"b",
",",
"LineGeneral2D_F64",
"found",
")",
"{",
"// determine the local coordinate system",
"center",
".",
"x",
"=",
"(",
"a",
".",
"x",
"+",
"b",
".",
"x",
")",
"/",
"2.0",
";",... | Fits a line defined by the two points. When fitting the line the weight of the edge is used to determine.
how influential the point is. Multiple calls might be required to get a perfect fit.
@param a Start of line
@param b End of line..
@param found (output) Fitted line to the edge
@return true if successful or false... | [
"Fits",
"a",
"line",
"defined",
"by",
"the",
"two",
"points",
".",
"When",
"fitting",
"the",
"line",
"the",
"weight",
"of",
"the",
"edge",
"is",
"used",
"to",
"determine",
".",
"how",
"influential",
"the",
"point",
"is",
".",
"Multiple",
"calls",
"might"... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/edge/SnapToLineEdge.java#L103-L138 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/edge/SnapToLineEdge.java | SnapToLineEdge.localToGlobal | protected void localToGlobal( LineGeneral2D_F64 line ) {
line.C = localScale*line.C - center.x*line.A - center.y*line.B;
} | java | protected void localToGlobal( LineGeneral2D_F64 line ) {
line.C = localScale*line.C - center.x*line.A - center.y*line.B;
} | [
"protected",
"void",
"localToGlobal",
"(",
"LineGeneral2D_F64",
"line",
")",
"{",
"line",
".",
"C",
"=",
"localScale",
"*",
"line",
".",
"C",
"-",
"center",
".",
"x",
"*",
"line",
".",
"A",
"-",
"center",
".",
"y",
"*",
"line",
".",
"B",
";",
"}"
] | Converts the line from local to global image coordinates | [
"Converts",
"the",
"line",
"from",
"local",
"to",
"global",
"image",
"coordinates"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/edge/SnapToLineEdge.java#L184-L186 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ComputeRegionMeanColor.java | ComputeRegionMeanColor.process | public void process( T image , GrayS32 pixelToRegion ,
GrowQueue_I32 regionMemberCount ,
FastQueue<float[]> regionColor ) {
this.image = image;
// Initialize data structures
regionSums.resize(regionColor.size);
for( int i = 0; i < regionSums.size; i++ ) {
float v[] = regionSums.get(i);
f... | java | public void process( T image , GrayS32 pixelToRegion ,
GrowQueue_I32 regionMemberCount ,
FastQueue<float[]> regionColor ) {
this.image = image;
// Initialize data structures
regionSums.resize(regionColor.size);
for( int i = 0; i < regionSums.size; i++ ) {
float v[] = regionSums.get(i);
f... | [
"public",
"void",
"process",
"(",
"T",
"image",
",",
"GrayS32",
"pixelToRegion",
",",
"GrowQueue_I32",
"regionMemberCount",
",",
"FastQueue",
"<",
"float",
"[",
"]",
">",
"regionColor",
")",
"{",
"this",
".",
"image",
"=",
"image",
";",
"// Initialize data str... | Compute the average color for each region
@param image Input image
@param pixelToRegion Conversion between pixel to region index
@param regionMemberCount List which stores the number of members for each region
@param regionColor (Output) Storage for mean color throughout the region. Internal array must be fully
decla... | [
"Compute",
"the",
"average",
"color",
"for",
"each",
"region"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ComputeRegionMeanColor.java#L61-L99 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.process | @Override
public boolean process(PairwiseImageGraph pairwiseGraph ) {
this.graph = new MetricSceneGraph(pairwiseGraph);
for (int i = 0; i < graph.edges.size(); i++) {
decomposeEssential(graph.edges.get(i));
}
declareModelFitting();
for (int i = 0; i < graph.edges.size(); i++) {
Motion e = graph.edges... | java | @Override
public boolean process(PairwiseImageGraph pairwiseGraph ) {
this.graph = new MetricSceneGraph(pairwiseGraph);
for (int i = 0; i < graph.edges.size(); i++) {
decomposeEssential(graph.edges.get(i));
}
declareModelFitting();
for (int i = 0; i < graph.edges.size(); i++) {
Motion e = graph.edges... | [
"@",
"Override",
"public",
"boolean",
"process",
"(",
"PairwiseImageGraph",
"pairwiseGraph",
")",
"{",
"this",
".",
"graph",
"=",
"new",
"MetricSceneGraph",
"(",
"pairwiseGraph",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"graph",
".",
"e... | Processes the paired up scene features and computes an initial estimate for the scene's
structure.
@param pairwiseGraph (Input) matched features across views/cameras. Must be calibrated. Modified.
@return true if successful | [
"Processes",
"the",
"paired",
"up",
"scene",
"features",
"and",
"computes",
"an",
"initial",
"estimate",
"for",
"the",
"scene",
"s",
"structure",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L110-L170 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.decomposeEssential | void decomposeEssential( Motion motion ) {
List<Se3_F64> candidates = MultiViewOps.decomposeEssential(motion.F);
int bestScore = 0;
Se3_F64 best = null;
PositiveDepthConstraintCheck check = new PositiveDepthConstraintCheck();
for (int i = 0; i < candidates.size(); i++) {
Se3_F64 a_to_b = candidates.get(... | java | void decomposeEssential( Motion motion ) {
List<Se3_F64> candidates = MultiViewOps.decomposeEssential(motion.F);
int bestScore = 0;
Se3_F64 best = null;
PositiveDepthConstraintCheck check = new PositiveDepthConstraintCheck();
for (int i = 0; i < candidates.size(); i++) {
Se3_F64 a_to_b = candidates.get(... | [
"void",
"decomposeEssential",
"(",
"Motion",
"motion",
")",
"{",
"List",
"<",
"Se3_F64",
">",
"candidates",
"=",
"MultiViewOps",
".",
"decomposeEssential",
"(",
"motion",
".",
"F",
")",
";",
"int",
"bestScore",
"=",
"0",
";",
"Se3_F64",
"best",
"=",
"null"... | Sets the a_to_b transform for the motion given. | [
"Sets",
"the",
"a_to_b",
"transform",
"for",
"the",
"motion",
"given",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L175-L205 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.medianTriangulationAngle | double medianTriangulationAngle( Motion edge ) {
GrowQueue_F64 angles = new GrowQueue_F64(edge.associated.size());
angles.size = edge.associated.size();
for (int i = 0; i < edge.associated.size(); i++) {
AssociatedIndex a = edge.associated.get(i);
Point2D_F64 normA = edge.viewSrc.observationNorm.get( a.sr... | java | double medianTriangulationAngle( Motion edge ) {
GrowQueue_F64 angles = new GrowQueue_F64(edge.associated.size());
angles.size = edge.associated.size();
for (int i = 0; i < edge.associated.size(); i++) {
AssociatedIndex a = edge.associated.get(i);
Point2D_F64 normA = edge.viewSrc.observationNorm.get( a.sr... | [
"double",
"medianTriangulationAngle",
"(",
"Motion",
"edge",
")",
"{",
"GrowQueue_F64",
"angles",
"=",
"new",
"GrowQueue_F64",
"(",
"edge",
".",
"associated",
".",
"size",
"(",
")",
")",
";",
"angles",
".",
"size",
"=",
"edge",
".",
"associated",
".",
"siz... | Compares the angle that different observations form when their lines intersect. Returns
the median angle. Used to determine if this edge is good for triangulation
@param edge edge
@return median angle between observations in radians | [
"Compares",
"the",
"angle",
"that",
"different",
"observations",
"form",
"when",
"their",
"lines",
"intersect",
".",
"Returns",
"the",
"median",
"angle",
".",
"Used",
"to",
"determine",
"if",
"this",
"edge",
"is",
"good",
"for",
"triangulation"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L213-L229 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.convertToOutput | private void convertToOutput( View origin ) {
structure = new SceneStructureMetric(false);
observations = new SceneObservations(viewsAdded.size());
// TODO can this be simplified?
int idx = 0;
for( String key : graph.cameras.keySet() ) {
cameraToIndex.put(key,idx++);
}
structure.initialize(cameraToIn... | java | private void convertToOutput( View origin ) {
structure = new SceneStructureMetric(false);
observations = new SceneObservations(viewsAdded.size());
// TODO can this be simplified?
int idx = 0;
for( String key : graph.cameras.keySet() ) {
cameraToIndex.put(key,idx++);
}
structure.initialize(cameraToIn... | [
"private",
"void",
"convertToOutput",
"(",
"View",
"origin",
")",
"{",
"structure",
"=",
"new",
"SceneStructureMetric",
"(",
"false",
")",
";",
"observations",
"=",
"new",
"SceneObservations",
"(",
"viewsAdded",
".",
"size",
"(",
")",
")",
";",
"// TODO can th... | Converts the internal data structures into the output format for bundle adjustment. Camera models are omitted
since they are not available
@param origin The origin of the coordinate system | [
"Converts",
"the",
"internal",
"data",
"structures",
"into",
"the",
"output",
"format",
"for",
"bundle",
"adjustment",
".",
"Camera",
"models",
"are",
"omitted",
"since",
"they",
"are",
"not",
"available"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L240-L289 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.addTriangulatedStereoFeatures | void addTriangulatedStereoFeatures(View base , Motion edge , double scale ) {
View viewA = edge.viewSrc;
View viewB = edge.viewDst;
boolean baseIsA = base == viewA;
View other = baseIsA ? viewB : viewA;
// Determine transform from other to world
edge.a_to_b.T.scale(scale);
Se3_F64 otherToBase = baseIsA ... | java | void addTriangulatedStereoFeatures(View base , Motion edge , double scale ) {
View viewA = edge.viewSrc;
View viewB = edge.viewDst;
boolean baseIsA = base == viewA;
View other = baseIsA ? viewB : viewA;
// Determine transform from other to world
edge.a_to_b.T.scale(scale);
Se3_F64 otherToBase = baseIsA ... | [
"void",
"addTriangulatedStereoFeatures",
"(",
"View",
"base",
",",
"Motion",
"edge",
",",
"double",
"scale",
")",
"{",
"View",
"viewA",
"=",
"edge",
".",
"viewSrc",
";",
"View",
"viewB",
"=",
"edge",
".",
"viewDst",
";",
"boolean",
"baseIsA",
"=",
"base",
... | Adds features which were triangulated using the stereo pair after the scale factor has been determined.
Don't mark the other view as being processed. It's 3D pose will be estimated later on using PNP with the
new features and features determined later on | [
"Adds",
"features",
"which",
"were",
"triangulated",
"using",
"the",
"stereo",
"pair",
"after",
"the",
"scale",
"factor",
"has",
"been",
"determined",
".",
"Don",
"t",
"mark",
"the",
"other",
"view",
"as",
"being",
"processed",
".",
"It",
"s",
"3D",
"pose"... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L296-L351 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.determineScale | static double determineScale(View base , Motion edge )
throws Exception
{
View viewA = edge.viewSrc;
View viewB = edge.viewDst;
boolean baseIsA = base == viewA;
// determine the scale factor difference
Point3D_F64 worldInBase3D = new Point3D_F64();
Point3D_F64 localInBase3D = new Point3D_F64();
GrowQ... | java | static double determineScale(View base , Motion edge )
throws Exception
{
View viewA = edge.viewSrc;
View viewB = edge.viewDst;
boolean baseIsA = base == viewA;
// determine the scale factor difference
Point3D_F64 worldInBase3D = new Point3D_F64();
Point3D_F64 localInBase3D = new Point3D_F64();
GrowQ... | [
"static",
"double",
"determineScale",
"(",
"View",
"base",
",",
"Motion",
"edge",
")",
"throws",
"Exception",
"{",
"View",
"viewA",
"=",
"edge",
".",
"viewSrc",
";",
"View",
"viewB",
"=",
"edge",
".",
"viewDst",
";",
"boolean",
"baseIsA",
"=",
"base",
"=... | Determine scale factor difference between edge triangulation and world | [
"Determine",
"scale",
"factor",
"difference",
"between",
"edge",
"triangulation",
"and",
"world"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L356-L397 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.estimateAllFeatures | private void estimateAllFeatures(View seedA, View seedB ) {
List<View> open = new ArrayList<>();
// Add features for all the other views connected to the root view and determine the translation scale factor
addUnvistedToStack(seedA, open);
addUnvistedToStack(seedB, open);
// Do a breath first search. The qu... | java | private void estimateAllFeatures(View seedA, View seedB ) {
List<View> open = new ArrayList<>();
// Add features for all the other views connected to the root view and determine the translation scale factor
addUnvistedToStack(seedA, open);
addUnvistedToStack(seedB, open);
// Do a breath first search. The qu... | [
"private",
"void",
"estimateAllFeatures",
"(",
"View",
"seedA",
",",
"View",
"seedB",
")",
"{",
"List",
"<",
"View",
">",
"open",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// Add features for all the other views connected to the root view and determine the translat... | Perform a breath first search to find the structure of all the remaining camrea views | [
"Perform",
"a",
"breath",
"first",
"search",
"to",
"find",
"the",
"structure",
"of",
"all",
"the",
"remaining",
"camrea",
"views"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L402-L462 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.countFeaturesWith3D | int countFeaturesWith3D(View v ) {
int count = 0;
for (int i = 0; i < v.connections.size(); i++) {
Motion m = v.connections.get(i);
boolean isSrc = m.viewSrc == v;
for (int j = 0; j < m.associated.size(); j++) {
AssociatedIndex a = m.associated.get(j);
if( isSrc ) {
count += m.viewDst.fea... | java | int countFeaturesWith3D(View v ) {
int count = 0;
for (int i = 0; i < v.connections.size(); i++) {
Motion m = v.connections.get(i);
boolean isSrc = m.viewSrc == v;
for (int j = 0; j < m.associated.size(); j++) {
AssociatedIndex a = m.associated.get(j);
if( isSrc ) {
count += m.viewDst.fea... | [
"int",
"countFeaturesWith3D",
"(",
"View",
"v",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"v",
".",
"connections",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Motion",
"m",
"=",
"v",
".",
... | Count how many 3D features are in view. | [
"Count",
"how",
"many",
"3D",
"features",
"are",
"in",
"view",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L479-L500 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.determinePose | boolean determinePose(View target ) {
// Find all Features which are visible in this view and have a known 3D location
List<Point2D3D> list = new ArrayList<>();
List<Feature3D> features = new ArrayList<>();
GrowQueue_I32 featureIndexes = new GrowQueue_I32();
// TODO mark need to handle casees where the targ... | java | boolean determinePose(View target ) {
// Find all Features which are visible in this view and have a known 3D location
List<Point2D3D> list = new ArrayList<>();
List<Feature3D> features = new ArrayList<>();
GrowQueue_I32 featureIndexes = new GrowQueue_I32();
// TODO mark need to handle casees where the targ... | [
"boolean",
"determinePose",
"(",
"View",
"target",
")",
"{",
"// Find all Features which are visible in this view and have a known 3D location",
"List",
"<",
"Point2D3D",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"Feature3D",
">",
"featur... | Uses the previously found motion between the two cameras to estimate the scale and 3D point of common features.
If a feature already has a known 3D point that is not modified. Scale is found by computing the 3D coordinate
of all points with a 3D point again then dividing the two distances. New features are also triangu... | [
"Uses",
"the",
"previously",
"found",
"motion",
"between",
"the",
"two",
"cameras",
"to",
"estimate",
"the",
"scale",
"and",
"3D",
"point",
"of",
"common",
"features",
".",
"If",
"a",
"feature",
"already",
"has",
"a",
"known",
"3D",
"point",
"that",
"is",
... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L510-L574 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.triangulateNoLocation | private void triangulateNoLocation( View target ) {
Se3_F64 otherToTarget = new Se3_F64();
Se3_F64 worldToTarget = target.viewToWorld.invert(null);
for( Motion c : target.connections ) {
boolean isSrc = c.viewSrc == target;
View other = c.destination(target);
if( other.state != ViewState.PROCESSED )
... | java | private void triangulateNoLocation( View target ) {
Se3_F64 otherToTarget = new Se3_F64();
Se3_F64 worldToTarget = target.viewToWorld.invert(null);
for( Motion c : target.connections ) {
boolean isSrc = c.viewSrc == target;
View other = c.destination(target);
if( other.state != ViewState.PROCESSED )
... | [
"private",
"void",
"triangulateNoLocation",
"(",
"View",
"target",
")",
"{",
"Se3_F64",
"otherToTarget",
"=",
"new",
"Se3_F64",
"(",
")",
";",
"Se3_F64",
"worldToTarget",
"=",
"target",
".",
"viewToWorld",
".",
"invert",
"(",
"null",
")",
";",
"for",
"(",
... | Go through all connections to the view and triangulate all features which have
not been triangulated already | [
"Go",
"through",
"all",
"connections",
"to",
"the",
"view",
"and",
"triangulate",
"all",
"features",
"which",
"have",
"not",
"been",
"triangulated",
"already"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L580-L635 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.triangulationAngle | double triangulationAngle( Point2D_F64 normA , Point2D_F64 normB , Se3_F64 a_to_b ) {
// the more parallel a line is worse the triangulation. Get rid of bad ideas early here
arrowA.set(normA.x,normA.y,1);
arrowB.set(normB.x,normB.y,1);
GeometryMath_F64.mult(a_to_b.R,arrowA,arrowA); // put them into the same ref... | java | double triangulationAngle( Point2D_F64 normA , Point2D_F64 normB , Se3_F64 a_to_b ) {
// the more parallel a line is worse the triangulation. Get rid of bad ideas early here
arrowA.set(normA.x,normA.y,1);
arrowB.set(normB.x,normB.y,1);
GeometryMath_F64.mult(a_to_b.R,arrowA,arrowA); // put them into the same ref... | [
"double",
"triangulationAngle",
"(",
"Point2D_F64",
"normA",
",",
"Point2D_F64",
"normB",
",",
"Se3_F64",
"a_to_b",
")",
"{",
"// the more parallel a line is worse the triangulation. Get rid of bad ideas early here",
"arrowA",
".",
"set",
"(",
"normA",
".",
"x",
",",
"nor... | Computes the acture angle between two vectors. Larger this angle is the better the triangulation
of the features 3D location is in general | [
"Computes",
"the",
"acture",
"angle",
"between",
"two",
"vectors",
".",
"Larger",
"this",
"angle",
"is",
"the",
"better",
"the",
"triangulation",
"of",
"the",
"features",
"3D",
"location",
"is",
"in",
"general"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L641-L648 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.addUnvistedToStack | void addUnvistedToStack(View viewed, List<View> open) {
for (int i = 0; i < viewed.connections.size(); i++) {
View other = viewed.connections.get(i).destination(viewed);
if( other.state == ViewState.UNPROCESSED) {
other.state = ViewState.PENDING;
open.add(other);
if( verbose != null )
verbose.p... | java | void addUnvistedToStack(View viewed, List<View> open) {
for (int i = 0; i < viewed.connections.size(); i++) {
View other = viewed.connections.get(i).destination(viewed);
if( other.state == ViewState.UNPROCESSED) {
other.state = ViewState.PENDING;
open.add(other);
if( verbose != null )
verbose.p... | [
"void",
"addUnvistedToStack",
"(",
"View",
"viewed",
",",
"List",
"<",
"View",
">",
"open",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"viewed",
".",
"connections",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"View",
"other",... | Looks to see which connections have yet to be visited and adds them to the open list | [
"Looks",
"to",
"see",
"which",
"connections",
"have",
"yet",
"to",
"be",
"visited",
"and",
"adds",
"them",
"to",
"the",
"open",
"list"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L653-L663 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.defineCoordinateSystem | void defineCoordinateSystem(View viewA, Motion motion) {
View viewB = motion.destination(viewA);
viewA.viewToWorld.reset(); // identity since it's the origin
viewB.viewToWorld.set(motion.motionSrcToDst(viewB));
// translation is only known up to a scale factor so pick a reasonable scale factor
double scale =... | java | void defineCoordinateSystem(View viewA, Motion motion) {
View viewB = motion.destination(viewA);
viewA.viewToWorld.reset(); // identity since it's the origin
viewB.viewToWorld.set(motion.motionSrcToDst(viewB));
// translation is only known up to a scale factor so pick a reasonable scale factor
double scale =... | [
"void",
"defineCoordinateSystem",
"(",
"View",
"viewA",
",",
"Motion",
"motion",
")",
"{",
"View",
"viewB",
"=",
"motion",
".",
"destination",
"(",
"viewA",
")",
";",
"viewA",
".",
"viewToWorld",
".",
"reset",
"(",
")",
";",
"// identity since it's the origin"... | Sets the origin and scale of the coordinate system
@param viewA The origin of the coordinate system
@param motion Motion which will define the coordinate system's scale | [
"Sets",
"the",
"origin",
"and",
"scale",
"of",
"the",
"coordinate",
"system"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L671-L720 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.selectOriginNode | View selectOriginNode() {
double bestScore = 0;
View best = null;
if( verbose != null )
verbose.println("selectOriginNode");
for (int i = 0; i < graph.nodes.size(); i++) {
double score = scoreNodeAsOrigin(graph.nodes.get(i));
if( score > bestScore ) {
bestScore = score;
best = graph.nodes.get... | java | View selectOriginNode() {
double bestScore = 0;
View best = null;
if( verbose != null )
verbose.println("selectOriginNode");
for (int i = 0; i < graph.nodes.size(); i++) {
double score = scoreNodeAsOrigin(graph.nodes.get(i));
if( score > bestScore ) {
bestScore = score;
best = graph.nodes.get... | [
"View",
"selectOriginNode",
"(",
")",
"{",
"double",
"bestScore",
"=",
"0",
";",
"View",
"best",
"=",
"null",
";",
"if",
"(",
"verbose",
"!=",
"null",
")",
"verbose",
".",
"println",
"(",
"\"selectOriginNode\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
... | Select the view which will be coordinate system's origin. This should be a well connected node which have
favorable geometry to the other views it's connected to.
@return The selected view | [
"Select",
"the",
"view",
"which",
"will",
"be",
"coordinate",
"system",
"s",
"origin",
".",
"This",
"should",
"be",
"a",
"well",
"connected",
"node",
"which",
"have",
"favorable",
"geometry",
"to",
"the",
"other",
"views",
"it",
"s",
"connected",
"to",
"."... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L727-L748 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.selectCoordinateBase | Motion selectCoordinateBase(View view ) {
double bestScore = 0;
Motion best = null;
if( verbose != null )
verbose.println("selectCoordinateBase");
for (int i = 0; i < view.connections.size(); i++) {
Motion e = view.connections.get(i);
double s = e.scoreTriangulation();
if( verbose != null )
ve... | java | Motion selectCoordinateBase(View view ) {
double bestScore = 0;
Motion best = null;
if( verbose != null )
verbose.println("selectCoordinateBase");
for (int i = 0; i < view.connections.size(); i++) {
Motion e = view.connections.get(i);
double s = e.scoreTriangulation();
if( verbose != null )
ve... | [
"Motion",
"selectCoordinateBase",
"(",
"View",
"view",
")",
"{",
"double",
"bestScore",
"=",
"0",
";",
"Motion",
"best",
"=",
"null",
";",
"if",
"(",
"verbose",
"!=",
"null",
")",
"verbose",
".",
"println",
"(",
"\"selectCoordinateBase\"",
")",
";",
"for",... | Select motion which will define the coordinate system. | [
"Select",
"motion",
"which",
"will",
"define",
"the",
"coordinate",
"system",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L765-L783 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.triangulateStereoEdges | void triangulateStereoEdges(Motion edge ) {
View viewA = edge.viewSrc;
View viewB = edge.viewDst;
triangulationError.configure(viewA.camera.pinhole,viewB.camera.pinhole);
for (int i = 0; i < edge.associated.size(); i++) {
AssociatedIndex f = edge.associated.get(i);
Point2D_F64 normA = viewA.observation... | java | void triangulateStereoEdges(Motion edge ) {
View viewA = edge.viewSrc;
View viewB = edge.viewDst;
triangulationError.configure(viewA.camera.pinhole,viewB.camera.pinhole);
for (int i = 0; i < edge.associated.size(); i++) {
AssociatedIndex f = edge.associated.get(i);
Point2D_F64 normA = viewA.observation... | [
"void",
"triangulateStereoEdges",
"(",
"Motion",
"edge",
")",
"{",
"View",
"viewA",
"=",
"edge",
".",
"viewSrc",
";",
"View",
"viewB",
"=",
"edge",
".",
"viewDst",
";",
"triangulationError",
".",
"configure",
"(",
"viewA",
".",
"camera",
".",
"pinhole",
",... | An edge has been declared as defining a good stereo pair. All associated feature will now be
triangulated. It is assumed that there is no global coordinate system at this point. | [
"An",
"edge",
"has",
"been",
"declared",
"as",
"defining",
"a",
"good",
"stereo",
"pair",
".",
"All",
"associated",
"feature",
"will",
"now",
"be",
"triangulated",
".",
"It",
"is",
"assumed",
"that",
"there",
"is",
"no",
"global",
"coordinate",
"system",
"... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L789-L828 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.approximatePinhole | public static CameraPinhole approximatePinhole( Point2Transform2_F64 p2n ,
int width , int height )
{
Point2D_F64 na = new Point2D_F64();
Point2D_F64 nb = new Point2D_F64();
// determine horizontal FOV using dot product of (na.x, na.y, 1 ) and (nb.x, nb.y, 1)
p2n.compute(0,height/2,na);
p2n.com... | java | public static CameraPinhole approximatePinhole( Point2Transform2_F64 p2n ,
int width , int height )
{
Point2D_F64 na = new Point2D_F64();
Point2D_F64 nb = new Point2D_F64();
// determine horizontal FOV using dot product of (na.x, na.y, 1 ) and (nb.x, nb.y, 1)
p2n.compute(0,height/2,na);
p2n.com... | [
"public",
"static",
"CameraPinhole",
"approximatePinhole",
"(",
"Point2Transform2_F64",
"p2n",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Point2D_F64",
"na",
"=",
"new",
"Point2D_F64",
"(",
")",
";",
"Point2D_F64",
"nb",
"=",
"new",
"Point2D_F64",
"... | Approximates a pinhole camera using the distoriton model
@param p2n Distorted pixel to undistorted normalized image coordinates
@return | [
"Approximates",
"a",
"pinhole",
"camera",
"using",
"the",
"distoriton",
"model"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L59-L86 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.createIntrinsic | public static CameraPinhole createIntrinsic(int width, int height, double hfov, double vfov) {
CameraPinhole intrinsic = new CameraPinhole();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.cx = width / 2;
intrinsic.cy = height / 2;
intrinsic.fx = intrinsic.cx / Math.tan(UtilAngle.degreeToRadi... | java | public static CameraPinhole createIntrinsic(int width, int height, double hfov, double vfov) {
CameraPinhole intrinsic = new CameraPinhole();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.cx = width / 2;
intrinsic.cy = height / 2;
intrinsic.fx = intrinsic.cx / Math.tan(UtilAngle.degreeToRadi... | [
"public",
"static",
"CameraPinhole",
"createIntrinsic",
"(",
"int",
"width",
",",
"int",
"height",
",",
"double",
"hfov",
",",
"double",
"vfov",
")",
"{",
"CameraPinhole",
"intrinsic",
"=",
"new",
"CameraPinhole",
"(",
")",
";",
"intrinsic",
".",
"width",
"=... | Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics
@param width Image width
@param height Image height
@param hfov Horizontal FOV in degrees
@param vfov Vertical FOV in degrees
@return guess camera parameters | [
"Creates",
"a",
"set",
"of",
"intrinsic",
"parameters",
"without",
"distortion",
"for",
"a",
"camera",
"with",
"the",
"specified",
"characteristics"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L97-L107 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.createIntrinsic | public static CameraPinholeBrown createIntrinsic(int width, int height, double hfov) {
CameraPinholeBrown intrinsic = new CameraPinholeBrown();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.cx = width / 2;
intrinsic.cy = height / 2;
intrinsic.fx = intrinsic.cx / Math.tan(UtilAngle.degreeToRa... | java | public static CameraPinholeBrown createIntrinsic(int width, int height, double hfov) {
CameraPinholeBrown intrinsic = new CameraPinholeBrown();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.cx = width / 2;
intrinsic.cy = height / 2;
intrinsic.fx = intrinsic.cx / Math.tan(UtilAngle.degreeToRa... | [
"public",
"static",
"CameraPinholeBrown",
"createIntrinsic",
"(",
"int",
"width",
",",
"int",
"height",
",",
"double",
"hfov",
")",
"{",
"CameraPinholeBrown",
"intrinsic",
"=",
"new",
"CameraPinholeBrown",
"(",
")",
";",
"intrinsic",
".",
"width",
"=",
"width",
... | Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics.
The focal length is assumed to be the same for x and y.
@param width Image width
@param height Image height
@param hfov Horizontal FOV in degrees
@return guess camera parameters | [
"Creates",
"a",
"set",
"of",
"intrinsic",
"parameters",
"without",
"distortion",
"for",
"a",
"camera",
"with",
"the",
"specified",
"characteristics",
".",
"The",
"focal",
"length",
"is",
"assumed",
"to",
"be",
"the",
"same",
"for",
"x",
"and",
"y",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L118-L128 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.scaleIntrinsic | public static void scaleIntrinsic(CameraPinhole param , double scale ) {
param.width = (int)(param.width*scale);
param.height = (int)(param.height*scale);
param.cx *= scale;
param.cy *= scale;
param.fx *= scale;
param.fy *= scale;
param.skew *= scale;
} | java | public static void scaleIntrinsic(CameraPinhole param , double scale ) {
param.width = (int)(param.width*scale);
param.height = (int)(param.height*scale);
param.cx *= scale;
param.cy *= scale;
param.fx *= scale;
param.fy *= scale;
param.skew *= scale;
} | [
"public",
"static",
"void",
"scaleIntrinsic",
"(",
"CameraPinhole",
"param",
",",
"double",
"scale",
")",
"{",
"param",
".",
"width",
"=",
"(",
"int",
")",
"(",
"param",
".",
"width",
"*",
"scale",
")",
";",
"param",
".",
"height",
"=",
"(",
"int",
"... | Multiplies each element of the intrinsic parameters by the provided scale factor. Useful
if the image has been rescaled.
@param param Intrinsic parameters
@param scale Scale factor that input image is being scaled by. | [
"Multiplies",
"each",
"element",
"of",
"the",
"intrinsic",
"parameters",
"by",
"the",
"provided",
"scale",
"factor",
".",
"Useful",
"if",
"the",
"image",
"has",
"been",
"rescaled",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L137-L145 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.invertPinhole | public static void invertPinhole( DMatrix3x3 K , DMatrix3x3 Kinv) {
double fx = K.a11;
double skew = K.a12;
double cx = K.a13;
double fy = K.a22;
double cy = K.a23;
Kinv.a11 = 1.0/fx;
Kinv.a12 = -skew/(fx*fy);
Kinv.a13 = (skew*cy - cx*fy)/(fx*fy);
Kinv.a22 = 1.0/fy;
Kinv.a23 = -cy/fy;
Kinv.a33 = 1... | java | public static void invertPinhole( DMatrix3x3 K , DMatrix3x3 Kinv) {
double fx = K.a11;
double skew = K.a12;
double cx = K.a13;
double fy = K.a22;
double cy = K.a23;
Kinv.a11 = 1.0/fx;
Kinv.a12 = -skew/(fx*fy);
Kinv.a13 = (skew*cy - cx*fy)/(fx*fy);
Kinv.a22 = 1.0/fy;
Kinv.a23 = -cy/fy;
Kinv.a33 = 1... | [
"public",
"static",
"void",
"invertPinhole",
"(",
"DMatrix3x3",
"K",
",",
"DMatrix3x3",
"Kinv",
")",
"{",
"double",
"fx",
"=",
"K",
".",
"a11",
";",
"double",
"skew",
"=",
"K",
".",
"a12",
";",
"double",
"cx",
"=",
"K",
".",
"a13",
";",
"double",
"... | Analytic matrix inversion to 3x3 camera calibration matrix. Input and output
can be the same matrix. Zeros are not set.
@param K (Input) Calibration matrix
@param Kinv (Output) inverse. | [
"Analytic",
"matrix",
"inversion",
"to",
"3x3",
"camera",
"calibration",
"matrix",
".",
"Input",
"and",
"output",
"can",
"be",
"the",
"same",
"matrix",
".",
"Zeros",
"are",
"not",
"set",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L223-L235 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.renderPixel | public static Point2D_F64 renderPixel( Se3_F64 worldToCamera , DMatrixRMaj K , Point3D_F64 X ) {
return ImplPerspectiveOps_F64.renderPixel(worldToCamera,K,X);
// if( K == null )
// return renderPixel(worldToCamera,X);
// return ImplPerspectiveOps_F64.renderPixel(worldToCamera,
// K.data[0], K.data[1], K.data[2... | java | public static Point2D_F64 renderPixel( Se3_F64 worldToCamera , DMatrixRMaj K , Point3D_F64 X ) {
return ImplPerspectiveOps_F64.renderPixel(worldToCamera,K,X);
// if( K == null )
// return renderPixel(worldToCamera,X);
// return ImplPerspectiveOps_F64.renderPixel(worldToCamera,
// K.data[0], K.data[1], K.data[2... | [
"public",
"static",
"Point2D_F64",
"renderPixel",
"(",
"Se3_F64",
"worldToCamera",
",",
"DMatrixRMaj",
"K",
",",
"Point3D_F64",
"X",
")",
"{",
"return",
"ImplPerspectiveOps_F64",
".",
"renderPixel",
"(",
"worldToCamera",
",",
"K",
",",
"X",
")",
";",
"//\t\tif( ... | Renders a point in world coordinates into the image plane in pixels or normalized image
coordinates.
@param worldToCamera Transform from world to camera frame
@param K Optional. Intrinsic camera calibration matrix. If null then normalized image coordinates are returned.
@param X 3D Point in world reference frame..
@... | [
"Renders",
"a",
"point",
"in",
"world",
"coordinates",
"into",
"the",
"image",
"plane",
"in",
"pixels",
"or",
"normalized",
"image",
"coordinates",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L513-L519 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.renderPixel | public static Point2D_F64 renderPixel(CameraPinhole intrinsic , Point3D_F64 X ) {
Point2D_F64 norm = new Point2D_F64(X.x/X.z,X.y/X.z);
return convertNormToPixel(intrinsic, norm, norm);
} | java | public static Point2D_F64 renderPixel(CameraPinhole intrinsic , Point3D_F64 X ) {
Point2D_F64 norm = new Point2D_F64(X.x/X.z,X.y/X.z);
return convertNormToPixel(intrinsic, norm, norm);
} | [
"public",
"static",
"Point2D_F64",
"renderPixel",
"(",
"CameraPinhole",
"intrinsic",
",",
"Point3D_F64",
"X",
")",
"{",
"Point2D_F64",
"norm",
"=",
"new",
"Point2D_F64",
"(",
"X",
".",
"x",
"/",
"X",
".",
"z",
",",
"X",
".",
"y",
"/",
"X",
".",
"z",
... | Renders a point in camera coordinates into the image plane in pixels.
@param intrinsic Intrinsic camera parameters.
@param X 3D Point in world reference frame..
@return 2D Render point on image plane or null if it's behind the camera | [
"Renders",
"a",
"point",
"in",
"camera",
"coordinates",
"into",
"the",
"image",
"plane",
"in",
"pixels",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L538-L541 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.renderPixel | public static Point2D_F64 renderPixel( DMatrixRMaj worldToCamera , Point3D_F64 X ) {
return renderPixel(worldToCamera,X,(Point2D_F64)null);
} | java | public static Point2D_F64 renderPixel( DMatrixRMaj worldToCamera , Point3D_F64 X ) {
return renderPixel(worldToCamera,X,(Point2D_F64)null);
} | [
"public",
"static",
"Point2D_F64",
"renderPixel",
"(",
"DMatrixRMaj",
"worldToCamera",
",",
"Point3D_F64",
"X",
")",
"{",
"return",
"renderPixel",
"(",
"worldToCamera",
",",
"X",
",",
"(",
"Point2D_F64",
")",
"null",
")",
";",
"}"
] | Computes the image coordinate of a point given its 3D location and the camera matrix.
@param worldToCamera 3x4 camera matrix for transforming a 3D point from world to image coordinates.
@param X 3D Point in world reference frame..
@return 2D Render point on image plane. | [
"Computes",
"the",
"image",
"coordinate",
"of",
"a",
"point",
"given",
"its",
"3D",
"location",
"and",
"the",
"camera",
"matrix",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L550-L552 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.crossRatios | public static double crossRatios( Point3D_F64 a0 , Point3D_F64 a1 , Point3D_F64 a2 , Point3D_F64 a3) {
double d01 = a0.distance(a1);
double d23 = a2.distance(a3);
double d02 = a0.distance(a2);
double d13 = a1.distance(a3);
return (d01*d23)/(d02*d13);
} | java | public static double crossRatios( Point3D_F64 a0 , Point3D_F64 a1 , Point3D_F64 a2 , Point3D_F64 a3) {
double d01 = a0.distance(a1);
double d23 = a2.distance(a3);
double d02 = a0.distance(a2);
double d13 = a1.distance(a3);
return (d01*d23)/(d02*d13);
} | [
"public",
"static",
"double",
"crossRatios",
"(",
"Point3D_F64",
"a0",
",",
"Point3D_F64",
"a1",
",",
"Point3D_F64",
"a2",
",",
"Point3D_F64",
"a3",
")",
"{",
"double",
"d01",
"=",
"a0",
".",
"distance",
"(",
"a1",
")",
";",
"double",
"d23",
"=",
"a2",
... | Computes the cross-ratio between 4 points. This is an invariant under projective geometry.
@param a0 Point
@param a1 Point
@param a2 Point
@param a3 Point
@return cross ratio | [
"Computes",
"the",
"cross",
"-",
"ratio",
"between",
"4",
"points",
".",
"This",
"is",
"an",
"invariant",
"under",
"projective",
"geometry",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L720-L727 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.extractColumn | public static void extractColumn(DMatrixRMaj P, int col, GeoTuple3D_F64 a) {
a.x = P.unsafe_get(0,col);
a.y = P.unsafe_get(1,col);
a.z = P.unsafe_get(2,col);
} | java | public static void extractColumn(DMatrixRMaj P, int col, GeoTuple3D_F64 a) {
a.x = P.unsafe_get(0,col);
a.y = P.unsafe_get(1,col);
a.z = P.unsafe_get(2,col);
} | [
"public",
"static",
"void",
"extractColumn",
"(",
"DMatrixRMaj",
"P",
",",
"int",
"col",
",",
"GeoTuple3D_F64",
"a",
")",
"{",
"a",
".",
"x",
"=",
"P",
".",
"unsafe_get",
"(",
"0",
",",
"col",
")",
";",
"a",
".",
"y",
"=",
"P",
".",
"unsafe_get",
... | Extracts a column from the camera matrix and puts it into the geometric 3-tuple. | [
"Extracts",
"a",
"column",
"from",
"the",
"camera",
"matrix",
"and",
"puts",
"it",
"into",
"the",
"geometric",
"3",
"-",
"tuple",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L766-L770 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.insertColumn | public static void insertColumn(DMatrixRMaj P, int col, GeoTuple3D_F64 a) {
P.unsafe_set(0,col,a.x);
P.unsafe_set(1,col,a.y);
P.unsafe_set(2,col,a.z);
} | java | public static void insertColumn(DMatrixRMaj P, int col, GeoTuple3D_F64 a) {
P.unsafe_set(0,col,a.x);
P.unsafe_set(1,col,a.y);
P.unsafe_set(2,col,a.z);
} | [
"public",
"static",
"void",
"insertColumn",
"(",
"DMatrixRMaj",
"P",
",",
"int",
"col",
",",
"GeoTuple3D_F64",
"a",
")",
"{",
"P",
".",
"unsafe_set",
"(",
"0",
",",
"col",
",",
"a",
".",
"x",
")",
";",
"P",
".",
"unsafe_set",
"(",
"1",
",",
"col",
... | Inserts 3-tuple into the camera matrix's columns | [
"Inserts",
"3",
"-",
"tuple",
"into",
"the",
"camera",
"matrix",
"s",
"columns"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L775-L779 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/DecomposeEssential.java | DecomposeEssential.decompose | public void decompose( DMatrixRMaj E ) {
if( svd.inputModified() ) {
E_copy.set(E);
E = E_copy;
}
if( !svd.decompose(E))
throw new RuntimeException("Svd some how failed");
U = svd.getU(U,false);
V = svd.getV(V,false);
S = svd.getW(S);
SingularOps_DDRM.descendingOrder(U,false,S,V,false);
dec... | java | public void decompose( DMatrixRMaj E ) {
if( svd.inputModified() ) {
E_copy.set(E);
E = E_copy;
}
if( !svd.decompose(E))
throw new RuntimeException("Svd some how failed");
U = svd.getU(U,false);
V = svd.getV(V,false);
S = svd.getW(S);
SingularOps_DDRM.descendingOrder(U,false,S,V,false);
dec... | [
"public",
"void",
"decompose",
"(",
"DMatrixRMaj",
"E",
")",
"{",
"if",
"(",
"svd",
".",
"inputModified",
"(",
")",
")",
"{",
"E_copy",
".",
"set",
"(",
"E",
")",
";",
"E",
"=",
"E_copy",
";",
"}",
"if",
"(",
"!",
"svd",
".",
"decompose",
"(",
... | Computes the decomposition from an essential matrix.
@param E essential matrix | [
"Computes",
"the",
"decomposition",
"from",
"an",
"essential",
"matrix",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/DecomposeEssential.java#L82-L98 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/DecomposeEssential.java | DecomposeEssential.extractTransform | private void extractTransform( DMatrixRMaj U , DMatrixRMaj V , DMatrixRMaj S ,
Se3_F64 se , boolean optionA , boolean optionB )
{
DMatrixRMaj R = se.getR();
Vector3D_F64 T = se.getT();
// extract rotation
if( optionA )
CommonOps_DDRM.mult(U,Rz,temp);
else
CommonOps_DDRM.multTransB(U,Rz,temp... | java | private void extractTransform( DMatrixRMaj U , DMatrixRMaj V , DMatrixRMaj S ,
Se3_F64 se , boolean optionA , boolean optionB )
{
DMatrixRMaj R = se.getR();
Vector3D_F64 T = se.getT();
// extract rotation
if( optionA )
CommonOps_DDRM.mult(U,Rz,temp);
else
CommonOps_DDRM.multTransB(U,Rz,temp... | [
"private",
"void",
"extractTransform",
"(",
"DMatrixRMaj",
"U",
",",
"DMatrixRMaj",
"V",
",",
"DMatrixRMaj",
"S",
",",
"Se3_F64",
"se",
",",
"boolean",
"optionA",
",",
"boolean",
"optionB",
")",
"{",
"DMatrixRMaj",
"R",
"=",
"se",
".",
"getR",
"(",
")",
... | There are four possible reconstructions from an essential matrix. This function will compute different
permutations depending on optionA and optionB being true or false. | [
"There",
"are",
"four",
"possible",
"reconstructions",
"from",
"an",
"essential",
"matrix",
".",
"This",
"function",
"will",
"compute",
"different",
"permutations",
"depending",
"on",
"optionA",
"and",
"optionB",
"being",
"true",
"or",
"false",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/DecomposeEssential.java#L147-L171 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java | PnPInfinitesimalPlanePoseEstimation.process | public boolean process( List<AssociatedPair> points )
{
if( points.size() < estimateHomography.getMinimumPoints())
throw new IllegalArgumentException("At least "+estimateHomography.getMinimumPoints()+" must be provided");
// center location of points in model
zeroMeanWorldPoints(points);
// make sure there... | java | public boolean process( List<AssociatedPair> points )
{
if( points.size() < estimateHomography.getMinimumPoints())
throw new IllegalArgumentException("At least "+estimateHomography.getMinimumPoints()+" must be provided");
// center location of points in model
zeroMeanWorldPoints(points);
// make sure there... | [
"public",
"boolean",
"process",
"(",
"List",
"<",
"AssociatedPair",
">",
"points",
")",
"{",
"if",
"(",
"points",
".",
"size",
"(",
")",
"<",
"estimateHomography",
".",
"getMinimumPoints",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"At... | Estimates the transform from world coordinate system to camera given known points and observations.
For each observation p1=World 3D location. z=0 is implicit. p2=Observed location of points in image in
normalized image coordinates
@param points List of world coordinates in 2D (p1) and normalized image coordinates (p2... | [
"Estimates",
"the",
"transform",
"from",
"world",
"coordinate",
"system",
"to",
"camera",
"given",
"known",
"points",
"and",
"observations",
".",
"For",
"each",
"observation",
"p1",
"=",
"World",
"3D",
"location",
".",
"z",
"=",
"0",
"is",
"implicit",
".",
... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java#L115-L166 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java | PnPInfinitesimalPlanePoseEstimation.computeError | double computeError( List<AssociatedPair> points , Se3_F64 worldToCamera ) {
double error = 0;
for (int i = 0; i < points.size(); i++) {
AssociatedPair pair = points.get(i);
tmpP.set(pair.p1.x,pair.p1.y,0);
SePointOps_F64.transform(worldToCamera,tmpP,tmpP);
error += pair.p2.distance2(tmpP.x/tmpP.z,tm... | java | double computeError( List<AssociatedPair> points , Se3_F64 worldToCamera ) {
double error = 0;
for (int i = 0; i < points.size(); i++) {
AssociatedPair pair = points.get(i);
tmpP.set(pair.p1.x,pair.p1.y,0);
SePointOps_F64.transform(worldToCamera,tmpP,tmpP);
error += pair.p2.distance2(tmpP.x/tmpP.z,tm... | [
"double",
"computeError",
"(",
"List",
"<",
"AssociatedPair",
">",
"points",
",",
"Se3_F64",
"worldToCamera",
")",
"{",
"double",
"error",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"points",
".",
"size",
"(",
")",
";",
"i",
"+... | Computes reprojection error to select best model | [
"Computes",
"reprojection",
"error",
"to",
"select",
"best",
"model"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java#L172-L185 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java | PnPInfinitesimalPlanePoseEstimation.zeroMeanWorldPoints | private void zeroMeanWorldPoints(List<AssociatedPair> points) {
center.set(0,0);
pointsAdj.reset();
for (int i = 0; i < points.size(); i++) {
AssociatedPair pair = points.get(i);
Point2D_F64 p = pair.p1;
pointsAdj.grow().p2.set(pair.p2);
center.x += p.x;
center.y += p.y;
}
center.x /= points.si... | java | private void zeroMeanWorldPoints(List<AssociatedPair> points) {
center.set(0,0);
pointsAdj.reset();
for (int i = 0; i < points.size(); i++) {
AssociatedPair pair = points.get(i);
Point2D_F64 p = pair.p1;
pointsAdj.grow().p2.set(pair.p2);
center.x += p.x;
center.y += p.y;
}
center.x /= points.si... | [
"private",
"void",
"zeroMeanWorldPoints",
"(",
"List",
"<",
"AssociatedPair",
">",
"points",
")",
"{",
"center",
".",
"set",
"(",
"0",
",",
"0",
")",
";",
"pointsAdj",
".",
"reset",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
... | Ensure zero mean for world location. Creates a local copy of the input | [
"Ensure",
"zero",
"mean",
"for",
"world",
"location",
".",
"Creates",
"a",
"local",
"copy",
"of",
"the",
"input"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java#L190-L206 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java | PnPInfinitesimalPlanePoseEstimation.estimateTranslation | void estimateTranslation( DMatrixRMaj R , List<AssociatedPair> points , Vector3D_F64 T )
{
final int N = points.size();
W.reshape(N*2,3);
y.reshape(N*2,1);
Wty.reshape(3,1);
DMatrix3x3 Rtmp = new DMatrix3x3();
ConvertDMatrixStruct.convert(R,Rtmp);
int indexY = 0,indexW = 0;
for (int i = 0; i < N; i++... | java | void estimateTranslation( DMatrixRMaj R , List<AssociatedPair> points , Vector3D_F64 T )
{
final int N = points.size();
W.reshape(N*2,3);
y.reshape(N*2,1);
Wty.reshape(3,1);
DMatrix3x3 Rtmp = new DMatrix3x3();
ConvertDMatrixStruct.convert(R,Rtmp);
int indexY = 0,indexW = 0;
for (int i = 0; i < N; i++... | [
"void",
"estimateTranslation",
"(",
"DMatrixRMaj",
"R",
",",
"List",
"<",
"AssociatedPair",
">",
"points",
",",
"Vector3D_F64",
"T",
")",
"{",
"final",
"int",
"N",
"=",
"points",
".",
"size",
"(",
")",
";",
"W",
".",
"reshape",
"(",
"N",
"*",
"2",
",... | Estimate's the translation given the previously found rotation
@param R Rotation matrix
@param T (Output) estimated translation | [
"Estimate",
"s",
"the",
"translation",
"given",
"the",
"previously",
"found",
"rotation"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java#L213-L258 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java | PnPInfinitesimalPlanePoseEstimation.IPPE | protected void IPPE( DMatrixRMaj R1 , DMatrixRMaj R2 ) {
// Equation 23 - Compute R_v from v
double norm_v = Math.sqrt(v1*v1 + v2*v2);
if( norm_v <= UtilEjml.EPS ) {
// the plane is fronto-parallel to the camera, so set the corrective rotation Rv to identity.
// There will be only one solution to pose.
... | java | protected void IPPE( DMatrixRMaj R1 , DMatrixRMaj R2 ) {
// Equation 23 - Compute R_v from v
double norm_v = Math.sqrt(v1*v1 + v2*v2);
if( norm_v <= UtilEjml.EPS ) {
// the plane is fronto-parallel to the camera, so set the corrective rotation Rv to identity.
// There will be only one solution to pose.
... | [
"protected",
"void",
"IPPE",
"(",
"DMatrixRMaj",
"R1",
",",
"DMatrixRMaj",
"R2",
")",
"{",
"// Equation 23 - Compute R_v from v",
"double",
"norm_v",
"=",
"Math",
".",
"sqrt",
"(",
"v1",
"*",
"v1",
"+",
"v2",
"*",
"v2",
")",
";",
"if",
"(",
"norm_v",
"<=... | Solves the IPPE problem | [
"Solves",
"the",
"IPPE",
"problem"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java#L263-L306 | train |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/recognition/ExampleClassifySceneKnn.java | ExampleClassifySceneKnn.learnAndSave | public void learnAndSave() {
System.out.println("======== Learning Classifier");
// Either load pre-computed words or compute the words from the training images
AssignCluster<double[]> assignment;
if( new File(CLUSTER_FILE_NAME).exists() ) {
assignment = UtilIO.load(CLUSTER_FILE_NAME);
} else {
System.... | java | public void learnAndSave() {
System.out.println("======== Learning Classifier");
// Either load pre-computed words or compute the words from the training images
AssignCluster<double[]> assignment;
if( new File(CLUSTER_FILE_NAME).exists() ) {
assignment = UtilIO.load(CLUSTER_FILE_NAME);
} else {
System.... | [
"public",
"void",
"learnAndSave",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"======== Learning Classifier\"",
")",
";",
"// Either load pre-computed words or compute the words from the training images",
"AssignCluster",
"<",
"double",
"[",
"]",
">",
"ass... | Process all the data in the training data set to learn the classifications. See code for details. | [
"Process",
"all",
"the",
"data",
"in",
"the",
"training",
"data",
"set",
"to",
"learn",
"the",
"classifications",
".",
"See",
"code",
"for",
"details",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/recognition/ExampleClassifySceneKnn.java#L107-L130 | train |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/recognition/ExampleClassifySceneKnn.java | ExampleClassifySceneKnn.computeClusters | private AssignCluster<double[]> computeClusters() {
System.out.println("Image Features");
// computes features in the training image set
List<TupleDesc_F64> features = new ArrayList<>();
for( String scene : train.keySet() ) {
List<String> imagePaths = train.get(scene);
System.out.println(" " + scene);
... | java | private AssignCluster<double[]> computeClusters() {
System.out.println("Image Features");
// computes features in the training image set
List<TupleDesc_F64> features = new ArrayList<>();
for( String scene : train.keySet() ) {
List<String> imagePaths = train.get(scene);
System.out.println(" " + scene);
... | [
"private",
"AssignCluster",
"<",
"double",
"[",
"]",
">",
"computeClusters",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Image Features\"",
")",
";",
"// computes features in the training image set",
"List",
"<",
"TupleDesc_F64",
">",
"features",
... | Extract dense features across the training set. Then clusters are found within those features. | [
"Extract",
"dense",
"features",
"across",
"the",
"training",
"set",
".",
"Then",
"clusters",
"are",
"found",
"within",
"those",
"features",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/recognition/ExampleClassifySceneKnn.java#L135-L166 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java | PackedSetsPoint2D_I32.grow | public void grow() {
if( tailBlockSize >= blockLength ) {
tailBlockSize = 0;
blocks.grow();
}
BlockIndexLength s = sets.grow();
s.block = blocks.size-1;
s.start = tailBlockSize;
s.length = 0;
tail = s;
} | java | public void grow() {
if( tailBlockSize >= blockLength ) {
tailBlockSize = 0;
blocks.grow();
}
BlockIndexLength s = sets.grow();
s.block = blocks.size-1;
s.start = tailBlockSize;
s.length = 0;
tail = s;
} | [
"public",
"void",
"grow",
"(",
")",
"{",
"if",
"(",
"tailBlockSize",
">=",
"blockLength",
")",
"{",
"tailBlockSize",
"=",
"0",
";",
"blocks",
".",
"grow",
"(",
")",
";",
"}",
"BlockIndexLength",
"s",
"=",
"sets",
".",
"grow",
"(",
")",
";",
"s",
".... | Adds a new point set to the end. | [
"Adds",
"a",
"new",
"point",
"set",
"to",
"the",
"end",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java#L81-L93 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java | PackedSetsPoint2D_I32.removeTail | public void removeTail() {
while( blocks.size-1 != tail.block )
blocks.removeTail();
tailBlockSize = tail.start;
sets.removeTail();
tail = sets.size > 0 ? sets.get( sets.size-1 ) : null;
} | java | public void removeTail() {
while( blocks.size-1 != tail.block )
blocks.removeTail();
tailBlockSize = tail.start;
sets.removeTail();
tail = sets.size > 0 ? sets.get( sets.size-1 ) : null;
} | [
"public",
"void",
"removeTail",
"(",
")",
"{",
"while",
"(",
"blocks",
".",
"size",
"-",
"1",
"!=",
"tail",
".",
"block",
")",
"blocks",
".",
"removeTail",
"(",
")",
";",
"tailBlockSize",
"=",
"tail",
".",
"start",
";",
"sets",
".",
"removeTail",
"("... | Removes the current point set from the end | [
"Removes",
"the",
"current",
"point",
"set",
"from",
"the",
"end"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java#L98-L104 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java | PackedSetsPoint2D_I32.addPointToTail | public void addPointToTail( int x , int y ) {
int index = tail.start + tail.length*2;
int block[];
int blockIndex = tail.block + index/blockLength;
if( blockIndex == blocks.size ) {
tailBlockSize = 0;
block = blocks.grow();
} else {
block = blocks.get( blockIndex );
}
tailBlockSize += 2;
index... | java | public void addPointToTail( int x , int y ) {
int index = tail.start + tail.length*2;
int block[];
int blockIndex = tail.block + index/blockLength;
if( blockIndex == blocks.size ) {
tailBlockSize = 0;
block = blocks.grow();
} else {
block = blocks.get( blockIndex );
}
tailBlockSize += 2;
index... | [
"public",
"void",
"addPointToTail",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"index",
"=",
"tail",
".",
"start",
"+",
"tail",
".",
"length",
"*",
"2",
";",
"int",
"block",
"[",
"]",
";",
"int",
"blockIndex",
"=",
"tail",
".",
"block",
"... | Adds a point to the tail point set
@param x coordinate
@param y coordinate | [
"Adds",
"a",
"point",
"to",
"the",
"tail",
"point",
"set"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java#L111-L128 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java | PackedSetsPoint2D_I32.getSet | public void getSet(int which , FastQueue<Point2D_I32> list ) {
list.reset();
BlockIndexLength set = sets.get(which);
for (int i = 0; i < set.length; i++) {
int index = set.start + i*2;
int blockIndex = set.block + index/blockLength;
index %= blockLength;
int block[] = blocks.get( blockIndex );
l... | java | public void getSet(int which , FastQueue<Point2D_I32> list ) {
list.reset();
BlockIndexLength set = sets.get(which);
for (int i = 0; i < set.length; i++) {
int index = set.start + i*2;
int blockIndex = set.block + index/blockLength;
index %= blockLength;
int block[] = blocks.get( blockIndex );
l... | [
"public",
"void",
"getSet",
"(",
"int",
"which",
",",
"FastQueue",
"<",
"Point2D_I32",
">",
"list",
")",
"{",
"list",
".",
"reset",
"(",
")",
";",
"BlockIndexLength",
"set",
"=",
"sets",
".",
"get",
"(",
"which",
")",
";",
"for",
"(",
"int",
"i",
"... | Copies all the points in the set into the specified list
@param which (Input) which point set
@param list (Output) Storage for points | [
"Copies",
"all",
"the",
"points",
"in",
"the",
"set",
"into",
"the",
"specified",
"list"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java#L160-L173 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java | PackedSetsPoint2D_I32.writeOverSet | public void writeOverSet(int which, List<Point2D_I32> points) {
BlockIndexLength set = sets.get(which);
if( set.length != points.size() )
throw new IllegalArgumentException("points and set don't have the same length");
for (int i = 0; i < set.length; i++) {
int index = set.start + i*2;
int blockIndex = ... | java | public void writeOverSet(int which, List<Point2D_I32> points) {
BlockIndexLength set = sets.get(which);
if( set.length != points.size() )
throw new IllegalArgumentException("points and set don't have the same length");
for (int i = 0; i < set.length; i++) {
int index = set.start + i*2;
int blockIndex = ... | [
"public",
"void",
"writeOverSet",
"(",
"int",
"which",
",",
"List",
"<",
"Point2D_I32",
">",
"points",
")",
"{",
"BlockIndexLength",
"set",
"=",
"sets",
".",
"get",
"(",
"which",
")",
";",
"if",
"(",
"set",
".",
"length",
"!=",
"points",
".",
"size",
... | Overwrites the points in the set with the list of points.
@param points Points which are to be written into the set. Must be the same size as the set. | [
"Overwrites",
"the",
"points",
"in",
"the",
"set",
"with",
"the",
"list",
"of",
"points",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java#L199-L214 | train |
lessthanoptimal/BoofCV | demonstrations/src/main/java/boofcv/demonstrations/fiducial/DetectFiducialSquareBinaryApp.java | DetectFiducialSquareBinaryApp.viewUpdated | public void viewUpdated() {
BufferedImage active = null;
if( controls.selectedView == 0 ) {
active = original;
} else if( controls.selectedView == 1 ) {
synchronized (lockProcessing) {
VisualizeBinaryData.renderBinary(detector.getBinary(), false, work);
}
active = work;
work.setRGB(0, 0, work.g... | java | public void viewUpdated() {
BufferedImage active = null;
if( controls.selectedView == 0 ) {
active = original;
} else if( controls.selectedView == 1 ) {
synchronized (lockProcessing) {
VisualizeBinaryData.renderBinary(detector.getBinary(), false, work);
}
active = work;
work.setRGB(0, 0, work.g... | [
"public",
"void",
"viewUpdated",
"(",
")",
"{",
"BufferedImage",
"active",
"=",
"null",
";",
"if",
"(",
"controls",
".",
"selectedView",
"==",
"0",
")",
"{",
"active",
"=",
"original",
";",
"}",
"else",
"if",
"(",
"controls",
".",
"selectedView",
"==",
... | Called when how the data is visualized has changed | [
"Called",
"when",
"how",
"the",
"data",
"is",
"visualized",
"has",
"changed"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/fiducial/DetectFiducialSquareBinaryApp.java#L176-L197 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquaresIntoRegularClusters.java | SquaresIntoRegularClusters.disconnectSingleConnections | void disconnectSingleConnections() {
List<SquareNode> open = new ArrayList<>();
List<SquareNode> open2 = new ArrayList<>();
for (int i = 0; i < nodes.size(); i++) {
SquareNode n = nodes.get(i);
checkDisconnectSingleEdge(open, n);
}
while( !open.isEmpty() ) {
for (int i = 0; i < open.size(); i++) ... | java | void disconnectSingleConnections() {
List<SquareNode> open = new ArrayList<>();
List<SquareNode> open2 = new ArrayList<>();
for (int i = 0; i < nodes.size(); i++) {
SquareNode n = nodes.get(i);
checkDisconnectSingleEdge(open, n);
}
while( !open.isEmpty() ) {
for (int i = 0; i < open.size(); i++) ... | [
"void",
"disconnectSingleConnections",
"(",
")",
"{",
"List",
"<",
"SquareNode",
">",
"open",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"SquareNode",
">",
"open2",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
... | Nodes that have only a single connection to one other node are disconnected since they are likely to be noise.
This is done recursively | [
"Nodes",
"that",
"have",
"only",
"a",
"single",
"connection",
"to",
"one",
"other",
"node",
"are",
"disconnected",
"since",
"they",
"are",
"likely",
"to",
"be",
"noise",
".",
"This",
"is",
"done",
"recursively"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquaresIntoRegularClusters.java#L158-L180 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquaresIntoRegularClusters.java | SquaresIntoRegularClusters.areMiddlePointsClose | boolean areMiddlePointsClose( Point2D_F64 p0 , Point2D_F64 p1 , Point2D_F64 p2 , Point2D_F64 p3 ) {
UtilLine2D_F64.convert(p0,p3,line);
// (computed expected length of a square) * (fractional tolerance)
double tol1 = p0.distance(p1)*distanceTol;
// see if inner points are close to the line
if(Distance2D_F64... | java | boolean areMiddlePointsClose( Point2D_F64 p0 , Point2D_F64 p1 , Point2D_F64 p2 , Point2D_F64 p3 ) {
UtilLine2D_F64.convert(p0,p3,line);
// (computed expected length of a square) * (fractional tolerance)
double tol1 = p0.distance(p1)*distanceTol;
// see if inner points are close to the line
if(Distance2D_F64... | [
"boolean",
"areMiddlePointsClose",
"(",
"Point2D_F64",
"p0",
",",
"Point2D_F64",
"p1",
",",
"Point2D_F64",
"p2",
",",
"Point2D_F64",
"p3",
")",
"{",
"UtilLine2D_F64",
".",
"convert",
"(",
"p0",
",",
"p3",
",",
"line",
")",
";",
"// (computed expected length of a... | Returns true if point p1 and p2 are close to the line defined by points p0 and p3. | [
"Returns",
"true",
"if",
"point",
"p1",
"and",
"p2",
"are",
"close",
"to",
"the",
"line",
"defined",
"by",
"points",
"p0",
"and",
"p3",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquaresIntoRegularClusters.java#L204-L230 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java | VisOdomDualTrackPnP.process | public boolean process( T left , T right ) {
// System.out.println("----------- Process --------------");
this.inputLeft = left;
this.inputRight = right;
tick++;
trackerLeft.process(left);
trackerRight.process(right);
if( first ) {
addNewTracks();
first = false;
} else {
mutualTrackDrop();
... | java | public boolean process( T left , T right ) {
// System.out.println("----------- Process --------------");
this.inputLeft = left;
this.inputRight = right;
tick++;
trackerLeft.process(left);
trackerRight.process(right);
if( first ) {
addNewTracks();
first = false;
} else {
mutualTrackDrop();
... | [
"public",
"boolean",
"process",
"(",
"T",
"left",
",",
"T",
"right",
")",
"{",
"//\t\tSystem.out.println(\"----------- Process --------------\");",
"this",
".",
"inputLeft",
"=",
"left",
";",
"this",
".",
"inputRight",
"=",
"right",
";",
"tick",
"++",
";",
"trac... | Updates motion estimate using the stereo pair.
@param left Image from left camera
@param right Image from right camera
@return true if motion estimate was updated and false if not | [
"Updates",
"motion",
"estimate",
"using",
"the",
"stereo",
"pair",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java#L181-L214 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java | VisOdomDualTrackPnP.refineMotionEstimate | private void refineMotionEstimate() {
// use observations from the inlier set
List<Stereo2D3D> data = new ArrayList<>();
int N = matcher.getMatchSet().size();
for( int i = 0; i < N; i++ ) {
int index = matcher.getInputIndex(i);
PointTrack l = candidates.get(index);
LeftTrackInfo info = l.getCookie()... | java | private void refineMotionEstimate() {
// use observations from the inlier set
List<Stereo2D3D> data = new ArrayList<>();
int N = matcher.getMatchSet().size();
for( int i = 0; i < N; i++ ) {
int index = matcher.getInputIndex(i);
PointTrack l = candidates.get(index);
LeftTrackInfo info = l.getCookie()... | [
"private",
"void",
"refineMotionEstimate",
"(",
")",
"{",
"// use observations from the inlier set",
"List",
"<",
"Stereo2D3D",
">",
"data",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"N",
"=",
"matcher",
".",
"getMatchSet",
"(",
")",
".",
"size",
... | Non-linear refinement of motion estimate | [
"Non",
"-",
"linear",
"refinement",
"of",
"motion",
"estimate"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java#L219-L246 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java | VisOdomDualTrackPnP.estimateMotion | private boolean estimateMotion() {
// organize the data
List<Stereo2D3D> data = new ArrayList<>();
for( PointTrack l : candidates ) {
LeftTrackInfo info = l.getCookie();
PointTrack r = info.right;
Stereo2D3D stereo = info.location;
// compute normalized image coordinate for track in left and right i... | java | private boolean estimateMotion() {
// organize the data
List<Stereo2D3D> data = new ArrayList<>();
for( PointTrack l : candidates ) {
LeftTrackInfo info = l.getCookie();
PointTrack r = info.right;
Stereo2D3D stereo = info.location;
// compute normalized image coordinate for track in left and right i... | [
"private",
"boolean",
"estimateMotion",
"(",
")",
"{",
"// organize the data",
"List",
"<",
"Stereo2D3D",
">",
"data",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"PointTrack",
"l",
":",
"candidates",
")",
"{",
"LeftTrackInfo",
"info",
"=",
"... | Given the set of active tracks, estimate the cameras motion robustly
@return | [
"Given",
"the",
"set",
"of",
"active",
"tracks",
"estimate",
"the",
"cameras",
"motion",
"robustly"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java#L252-L286 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java | VisOdomDualTrackPnP.mutualTrackDrop | private void mutualTrackDrop() {
for( PointTrack t : trackerLeft.getDroppedTracks(null) ) {
LeftTrackInfo info = t.getCookie();
trackerRight.dropTrack(info.right);
}
for( PointTrack t : trackerRight.getDroppedTracks(null) ) {
RightTrackInfo info = t.getCookie();
// a track could be dropped twice here,... | java | private void mutualTrackDrop() {
for( PointTrack t : trackerLeft.getDroppedTracks(null) ) {
LeftTrackInfo info = t.getCookie();
trackerRight.dropTrack(info.right);
}
for( PointTrack t : trackerRight.getDroppedTracks(null) ) {
RightTrackInfo info = t.getCookie();
// a track could be dropped twice here,... | [
"private",
"void",
"mutualTrackDrop",
"(",
")",
"{",
"for",
"(",
"PointTrack",
"t",
":",
"trackerLeft",
".",
"getDroppedTracks",
"(",
"null",
")",
")",
"{",
"LeftTrackInfo",
"info",
"=",
"t",
".",
"getCookie",
"(",
")",
";",
"trackerRight",
".",
"dropTrack... | If a track was dropped in one image make sure it was dropped in the other image | [
"If",
"a",
"track",
"was",
"dropped",
"in",
"one",
"image",
"make",
"sure",
"it",
"was",
"dropped",
"in",
"the",
"other",
"image"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java#L291-L301 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java | VisOdomDualTrackPnP.selectCandidateTracks | private void selectCandidateTracks() {
// mark tracks in right frame that are active
List<PointTrack> activeRight = trackerRight.getActiveTracks(null);
for( PointTrack t : activeRight ) {
RightTrackInfo info = t.getCookie();
info.lastActiveList = tick;
}
int mutualActive = 0;
List<PointTrack> activeL... | java | private void selectCandidateTracks() {
// mark tracks in right frame that are active
List<PointTrack> activeRight = trackerRight.getActiveTracks(null);
for( PointTrack t : activeRight ) {
RightTrackInfo info = t.getCookie();
info.lastActiveList = tick;
}
int mutualActive = 0;
List<PointTrack> activeL... | [
"private",
"void",
"selectCandidateTracks",
"(",
")",
"{",
"// mark tracks in right frame that are active",
"List",
"<",
"PointTrack",
">",
"activeRight",
"=",
"trackerRight",
".",
"getActiveTracks",
"(",
"null",
")",
";",
"for",
"(",
"PointTrack",
"t",
":",
"active... | Searches for tracks which are active and meet the epipolar constraints | [
"Searches",
"for",
"tracks",
"which",
"are",
"active",
"and",
"meet",
"the",
"epipolar",
"constraints"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java#L307-L344 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java | VisOdomDualTrackPnP.addNewTracks | private void addNewTracks() {
trackerLeft.spawnTracks();
trackerRight.spawnTracks();
List<PointTrack> newLeft = trackerLeft.getNewTracks(null);
List<PointTrack> newRight = trackerRight.getNewTracks(null);
// get a list of new tracks and their descriptions
addNewToList(inputLeft, newLeft, pointsLeft, descL... | java | private void addNewTracks() {
trackerLeft.spawnTracks();
trackerRight.spawnTracks();
List<PointTrack> newLeft = trackerLeft.getNewTracks(null);
List<PointTrack> newRight = trackerRight.getNewTracks(null);
// get a list of new tracks and their descriptions
addNewToList(inputLeft, newLeft, pointsLeft, descL... | [
"private",
"void",
"addNewTracks",
"(",
")",
"{",
"trackerLeft",
".",
"spawnTracks",
"(",
")",
";",
"trackerRight",
".",
"spawnTracks",
"(",
")",
";",
"List",
"<",
"PointTrack",
">",
"newLeft",
"=",
"trackerLeft",
".",
"getNewTracks",
"(",
"null",
")",
";"... | Spawns tracks in each image and associates features together. | [
"Spawns",
"tracks",
"in",
"each",
"image",
"and",
"associates",
"features",
"together",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java#L392-L480 | train |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/imageprocessing/ExampleImageConvert.java | ExampleImageConvert.createImages | public void createImages() {
image = UtilImageIO.loadImage(UtilIO.pathExample("standard/barbara.jpg"));
gray = ConvertBufferedImage.convertFromSingle(image, null, GrayU8.class);
derivX = GeneralizedImageOps.createSingleBand(GrayS16.class, gray.getWidth(), gray.getHeight());
derivY = GeneralizedImageOps.createS... | java | public void createImages() {
image = UtilImageIO.loadImage(UtilIO.pathExample("standard/barbara.jpg"));
gray = ConvertBufferedImage.convertFromSingle(image, null, GrayU8.class);
derivX = GeneralizedImageOps.createSingleBand(GrayS16.class, gray.getWidth(), gray.getHeight());
derivY = GeneralizedImageOps.createS... | [
"public",
"void",
"createImages",
"(",
")",
"{",
"image",
"=",
"UtilImageIO",
".",
"loadImage",
"(",
"UtilIO",
".",
"pathExample",
"(",
"\"standard/barbara.jpg\"",
")",
")",
";",
"gray",
"=",
"ConvertBufferedImage",
".",
"convertFromSingle",
"(",
"image",
",",
... | Load and generate images | [
"Load",
"and",
"generate",
"images"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/imageprocessing/ExampleImageConvert.java#L98-L106 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.fillRectangle | public static void fillRectangle(InterleavedS32 img, int value, int x0, int y0, int width, int height) {
int x1 = x0 + width;
int y1 = y0 + height;
if( x0 < 0 ) x0 = 0; if( x1 > img.width ) x1 = img.width;
if( y0 < 0 ) y0 = 0; if( y1 > img.height ) y1 = img.height;
int length = (x1-x0)*img.numBands;
for (... | java | public static void fillRectangle(InterleavedS32 img, int value, int x0, int y0, int width, int height) {
int x1 = x0 + width;
int y1 = y0 + height;
if( x0 < 0 ) x0 = 0; if( x1 > img.width ) x1 = img.width;
if( y0 < 0 ) y0 = 0; if( y1 > img.height ) y1 = img.height;
int length = (x1-x0)*img.numBands;
for (... | [
"public",
"static",
"void",
"fillRectangle",
"(",
"InterleavedS32",
"img",
",",
"int",
"value",
",",
"int",
"x0",
",",
"int",
"y0",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"int",
"x1",
"=",
"x0",
"+",
"width",
";",
"int",
"y1",
"=",
"y... | Draws a filled rectangle that is aligned along the image axis inside the image. All bands
are filled with the same value.
@param img Image the rectangle is drawn in. Modified
@param value Value of the rectangle
@param x0 Top left x-coordinate
@param y0 Top left y-coordinate
@param width Rectangle width
@param height... | [
"Draws",
"a",
"filled",
"rectangle",
"that",
"is",
"aligned",
"along",
"the",
"image",
"axis",
"inside",
"the",
"image",
".",
"All",
"bands",
"are",
"filled",
"with",
"the",
"same",
"value",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L1355-L1370 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.flipVertical | public static void flipVertical( GrayS32 input ) {
int h2 = input.height/2;
for( int y = 0; y < h2; y++ ) {
int index1 = input.getStartIndex() + y * input.getStride();
int index2 = input.getStartIndex() + (input.height - y - 1) * input.getStride();
int end = index1 + input.width;
while( index1 < end ... | java | public static void flipVertical( GrayS32 input ) {
int h2 = input.height/2;
for( int y = 0; y < h2; y++ ) {
int index1 = input.getStartIndex() + y * input.getStride();
int index2 = input.getStartIndex() + (input.height - y - 1) * input.getStride();
int end = index1 + input.width;
while( index1 < end ... | [
"public",
"static",
"void",
"flipVertical",
"(",
"GrayS32",
"input",
")",
"{",
"int",
"h2",
"=",
"input",
".",
"height",
"/",
"2",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"h2",
";",
"y",
"++",
")",
"{",
"int",
"index1",
"=",
"inpu... | Flips the image from top to bottom | [
"Flips",
"the",
"image",
"from",
"top",
"to",
"bottom"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L1471-L1486 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.flipHorizontal | public static void flipHorizontal( GrayS32 input ) {
int w2 = input.width/2;
for( int y = 0; y < input.height; y++ ) {
int index1 = input.getStartIndex() + y * input.getStride();
int index2 = index1 + input.width-1;
int end = index1 + w2;
while( index1 < end ) {
int tmp = input.data[index1];
... | java | public static void flipHorizontal( GrayS32 input ) {
int w2 = input.width/2;
for( int y = 0; y < input.height; y++ ) {
int index1 = input.getStartIndex() + y * input.getStride();
int index2 = index1 + input.width-1;
int end = index1 + w2;
while( index1 < end ) {
int tmp = input.data[index1];
... | [
"public",
"static",
"void",
"flipHorizontal",
"(",
"GrayS32",
"input",
")",
"{",
"int",
"w2",
"=",
"input",
".",
"width",
"/",
"2",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"input",
".",
"height",
";",
"y",
"++",
")",
"{",
"int",
"... | Flips the image from left to right | [
"Flips",
"the",
"image",
"from",
"left",
"to",
"right"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L1491-L1506 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.rotateCCW | public static void rotateCCW( GrayS64 image ) {
if( image.width != image.height )
throw new IllegalArgumentException("Image must be square");
int w = image.height/2 + image.height%2;
int h = image.height/2;
for( int y0 = 0; y0 < h; y0++ ) {
int y1 = image.height-y0-1;
for( int x0 = 0; x0 < w; x0++ )... | java | public static void rotateCCW( GrayS64 image ) {
if( image.width != image.height )
throw new IllegalArgumentException("Image must be square");
int w = image.height/2 + image.height%2;
int h = image.height/2;
for( int y0 = 0; y0 < h; y0++ ) {
int y1 = image.height-y0-1;
for( int x0 = 0; x0 < w; x0++ )... | [
"public",
"static",
"void",
"rotateCCW",
"(",
"GrayS64",
"image",
")",
"{",
"if",
"(",
"image",
".",
"width",
"!=",
"image",
".",
"height",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Image must be square\"",
")",
";",
"int",
"w",
"=",
"image",
... | In-place 90 degree image rotation in the counter-clockwise direction. Only works on
square images. | [
"In",
"-",
"place",
"90",
"degree",
"image",
"rotation",
"in",
"the",
"counter",
"-",
"clockwise",
"direction",
".",
"Only",
"works",
"on",
"square",
"images",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L2121-L2147 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.rotateCCW | public static void rotateCCW( GrayS64 input , GrayS64 output ) {
if( input.width != output.height || input.height != output.width )
throw new IllegalArgumentException("Incompatible shapes");
int w = input.width-1;
for( int y = 0; y < input.height; y++ ) {
int indexIn = input.startIndex + y*input.stride;
... | java | public static void rotateCCW( GrayS64 input , GrayS64 output ) {
if( input.width != output.height || input.height != output.width )
throw new IllegalArgumentException("Incompatible shapes");
int w = input.width-1;
for( int y = 0; y < input.height; y++ ) {
int indexIn = input.startIndex + y*input.stride;
... | [
"public",
"static",
"void",
"rotateCCW",
"(",
"GrayS64",
"input",
",",
"GrayS64",
"output",
")",
"{",
"if",
"(",
"input",
".",
"width",
"!=",
"output",
".",
"height",
"||",
"input",
".",
"height",
"!=",
"output",
".",
"width",
")",
"throw",
"new",
"Ill... | Rotates the image 90 degrees in the counter-clockwise direction. | [
"Rotates",
"the",
"image",
"90",
"degrees",
"in",
"the",
"counter",
"-",
"clockwise",
"direction",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L2152-L2164 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.fillBand | public static void fillBand(InterleavedF64 input, int band , double value) {
final int numBands = input.numBands;
for (int y = 0; y < input.height; y++) {
int index = input.getStartIndex() + y * input.getStride() + band;
int end = index + input.width*numBands - band;
for (; index < end; index += numBands ... | java | public static void fillBand(InterleavedF64 input, int band , double value) {
final int numBands = input.numBands;
for (int y = 0; y < input.height; y++) {
int index = input.getStartIndex() + y * input.getStride() + band;
int end = index + input.width*numBands - band;
for (; index < end; index += numBands ... | [
"public",
"static",
"void",
"fillBand",
"(",
"InterleavedF64",
"input",
",",
"int",
"band",
",",
"double",
"value",
")",
"{",
"final",
"int",
"numBands",
"=",
"input",
".",
"numBands",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"input",
".... | Fills one band in the image with the specified value
@param input An image.
@param band Which band is to be filled with the specified value
@param value The value that the image is being filled with. | [
"Fills",
"one",
"band",
"in",
"the",
"image",
"with",
"the",
"specified",
"value"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L2847-L2857 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.fillBorder | public static void fillBorder(GrayF64 input, double value, int radius ) {
// top and bottom
for (int y = 0; y < radius; y++) {
int indexTop = input.startIndex + y * input.stride;
int indexBottom = input.startIndex + (input.height-y-1) * input.stride;
for (int x = 0; x < input.width; x++) {
input.data[... | java | public static void fillBorder(GrayF64 input, double value, int radius ) {
// top and bottom
for (int y = 0; y < radius; y++) {
int indexTop = input.startIndex + y * input.stride;
int indexBottom = input.startIndex + (input.height-y-1) * input.stride;
for (int x = 0; x < input.width; x++) {
input.data[... | [
"public",
"static",
"void",
"fillBorder",
"(",
"GrayF64",
"input",
",",
"double",
"value",
",",
"int",
"radius",
")",
"{",
"// top and bottom",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"radius",
";",
"y",
"++",
")",
"{",
"int",
"indexTop",
"=... | Fills the outside border with the specified value
@param input An image.
@param value The value that the image is being filled with.
@param radius Border width. | [
"Fills",
"the",
"outside",
"border",
"with",
"the",
"specified",
"value"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L2906-L2932 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.fillRectangle | public static void fillRectangle(GrayF64 img, double value, int x0, int y0, int width, int height) {
int x1 = x0 + width;
int y1 = y0 + height;
if( x0 < 0 ) x0 = 0; if( x1 > img.width ) x1 = img.width;
if( y0 < 0 ) y0 = 0; if( y1 > img.height ) y1 = img.height;
for (int y = y0; y < y1; y++) {
for (int x ... | java | public static void fillRectangle(GrayF64 img, double value, int x0, int y0, int width, int height) {
int x1 = x0 + width;
int y1 = y0 + height;
if( x0 < 0 ) x0 = 0; if( x1 > img.width ) x1 = img.width;
if( y0 < 0 ) y0 = 0; if( y1 > img.height ) y1 = img.height;
for (int y = y0; y < y1; y++) {
for (int x ... | [
"public",
"static",
"void",
"fillRectangle",
"(",
"GrayF64",
"img",
",",
"double",
"value",
",",
"int",
"x0",
",",
"int",
"y0",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"int",
"x1",
"=",
"x0",
"+",
"width",
";",
"int",
"y1",
"=",
"y0",
... | Draws a filled rectangle that is aligned along the image axis inside the image.
@param img Image the rectangle is drawn in. Modified
@param value Value of the rectangle
@param x0 Top left x-coordinate
@param y0 Top left y-coordinate
@param width Rectangle width
@param height Rectangle height | [
"Draws",
"a",
"filled",
"rectangle",
"that",
"is",
"aligned",
"along",
"the",
"image",
"axis",
"inside",
"the",
"image",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L2944-L2956 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/distort/LensDistortionOps_F32.java | LensDistortionOps_F32.boundBoxInside | public static RectangleLength2D_F32 boundBoxInside(int srcWidth, int srcHeight,
PixelTransform<Point2D_F32> transform,
Point2D_F32 work )
{
List<Point2D_F32> points = computeBoundingPoints(srcWidth, srcHeight, transform, work);
Point2D_F32 center = new Point2D_F32();
UtilPoint2D_F... | java | public static RectangleLength2D_F32 boundBoxInside(int srcWidth, int srcHeight,
PixelTransform<Point2D_F32> transform,
Point2D_F32 work )
{
List<Point2D_F32> points = computeBoundingPoints(srcWidth, srcHeight, transform, work);
Point2D_F32 center = new Point2D_F32();
UtilPoint2D_F... | [
"public",
"static",
"RectangleLength2D_F32",
"boundBoxInside",
"(",
"int",
"srcWidth",
",",
"int",
"srcHeight",
",",
"PixelTransform",
"<",
"Point2D_F32",
">",
"transform",
",",
"Point2D_F32",
"work",
")",
"{",
"List",
"<",
"Point2D_F32",
">",
"points",
"=",
"co... | Ensures that the entire box will be inside
@param srcWidth Width of the source image
@param srcHeight Height of the source image
@param transform Transform being applied to the image
@return Bounding box | [
"Ensures",
"that",
"the",
"entire",
"box",
"will",
"be",
"inside"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/LensDistortionOps_F32.java#L140-L201 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java | TrackerMeanShiftComaniciu2003.initialize | public void initialize( T image , RectangleRotate_F32 initial ) {
this.region.set(initial);
calcHistogram.computeHistogram(image,initial);
System.arraycopy(calcHistogram.getHistogram(),0,keyHistogram,0,keyHistogram.length);
this.minimumWidth = initial.width*minimumSizeRatio;
} | java | public void initialize( T image , RectangleRotate_F32 initial ) {
this.region.set(initial);
calcHistogram.computeHistogram(image,initial);
System.arraycopy(calcHistogram.getHistogram(),0,keyHistogram,0,keyHistogram.length);
this.minimumWidth = initial.width*minimumSizeRatio;
} | [
"public",
"void",
"initialize",
"(",
"T",
"image",
",",
"RectangleRotate_F32",
"initial",
")",
"{",
"this",
".",
"region",
".",
"set",
"(",
"initial",
")",
";",
"calcHistogram",
".",
"computeHistogram",
"(",
"image",
",",
"initial",
")",
";",
"System",
"."... | Specifies the initial image to learn the target description
@param image Image
@param initial Initial image which contains the target | [
"Specifies",
"the",
"initial",
"image",
"to",
"learn",
"the",
"target",
"description"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java#L141-L147 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java | TrackerMeanShiftComaniciu2003.track | public void track( T image ) {
// configure the different regions based on size
region0.set( region );
region1.set( region );
region2.set( region );
region0.width *= 1-scaleChange;
region0.height *= 1-scaleChange;
region2.width *= 1+scaleChange;
region2.height *= 1+scaleChange;
// distance from h... | java | public void track( T image ) {
// configure the different regions based on size
region0.set( region );
region1.set( region );
region2.set( region );
region0.width *= 1-scaleChange;
region0.height *= 1-scaleChange;
region2.width *= 1+scaleChange;
region2.height *= 1+scaleChange;
// distance from h... | [
"public",
"void",
"track",
"(",
"T",
"image",
")",
"{",
"// configure the different regions based on size",
"region0",
".",
"set",
"(",
"region",
")",
";",
"region1",
".",
"set",
"(",
"region",
")",
";",
"region2",
".",
"set",
"(",
"region",
")",
";",
"reg... | Searches for the target in the most recent image.
@param image Most recent image in the sequence | [
"Searches",
"for",
"the",
"target",
"in",
"the",
"most",
"recent",
"image",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java#L162-L219 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java | TrackerMeanShiftComaniciu2003.selectBest | private int selectBest( double a , double b , double c ) {
if( a < b ) {
if( a < c )
return 0;
else
return 2;
} else if( b <= c ) {
return 1;
} else {
return 2;
}
} | java | private int selectBest( double a , double b , double c ) {
if( a < b ) {
if( a < c )
return 0;
else
return 2;
} else if( b <= c ) {
return 1;
} else {
return 2;
}
} | [
"private",
"int",
"selectBest",
"(",
"double",
"a",
",",
"double",
"b",
",",
"double",
"c",
")",
"{",
"if",
"(",
"a",
"<",
"b",
")",
"{",
"if",
"(",
"a",
"<",
"c",
")",
"return",
"0",
";",
"else",
"return",
"2",
";",
"}",
"else",
"if",
"(",
... | Given the 3 scores return the index of the best | [
"Given",
"the",
"3",
"scores",
"return",
"the",
"index",
"of",
"the",
"best"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java#L224-L235 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java | TrackerMeanShiftComaniciu2003.updateLocation | protected void updateLocation( T image , RectangleRotate_F32 region ) {
double bestHistScore = Double.MAX_VALUE;
float bestX = -1, bestY = -1;
for( int i = 0; i < maxIterations; i++ ) {
calcHistogram.computeHistogram(image,region);
float histogram[] = calcHistogram.getHistogram();
updateWeights(histog... | java | protected void updateLocation( T image , RectangleRotate_F32 region ) {
double bestHistScore = Double.MAX_VALUE;
float bestX = -1, bestY = -1;
for( int i = 0; i < maxIterations; i++ ) {
calcHistogram.computeHistogram(image,region);
float histogram[] = calcHistogram.getHistogram();
updateWeights(histog... | [
"protected",
"void",
"updateLocation",
"(",
"T",
"image",
",",
"RectangleRotate_F32",
"region",
")",
"{",
"double",
"bestHistScore",
"=",
"Double",
".",
"MAX_VALUE",
";",
"float",
"bestX",
"=",
"-",
"1",
",",
"bestY",
"=",
"-",
"1",
";",
"for",
"(",
"int... | Updates the region's location using the standard mean-shift algorithm | [
"Updates",
"the",
"region",
"s",
"location",
"using",
"the",
"standard",
"mean",
"-",
"shift",
"algorithm"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java#L240-L303 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java | TrackerMeanShiftComaniciu2003.updateWeights | private void updateWeights(float[] histogram) {
for( int j = 0; j < weightHistogram.length; j++ ) {
float h = histogram[j];
if( h != 0 ) {
weightHistogram[j] = (float)Math.sqrt(keyHistogram[j]/h);
}
}
} | java | private void updateWeights(float[] histogram) {
for( int j = 0; j < weightHistogram.length; j++ ) {
float h = histogram[j];
if( h != 0 ) {
weightHistogram[j] = (float)Math.sqrt(keyHistogram[j]/h);
}
}
} | [
"private",
"void",
"updateWeights",
"(",
"float",
"[",
"]",
"histogram",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"weightHistogram",
".",
"length",
";",
"j",
"++",
")",
"{",
"float",
"h",
"=",
"histogram",
"[",
"j",
"]",
";",
"i... | Update the weights for each element in the histogram. Weights are used to favor colors which are
less than expected. | [
"Update",
"the",
"weights",
"for",
"each",
"element",
"in",
"the",
"histogram",
".",
"Weights",
"are",
"used",
"to",
"favor",
"colors",
"which",
"are",
"less",
"than",
"expected",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java#L309-L316 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java | TrackerMeanShiftComaniciu2003.distanceHistogram | protected double distanceHistogram(float histogramA[], float histogramB[]) {
double sumP = 0;
for( int i = 0; i < histogramA.length; i++ ) {
float q = histogramA[i];
float p = histogramB[i];
sumP += Math.abs(q-p);
}
return sumP;
} | java | protected double distanceHistogram(float histogramA[], float histogramB[]) {
double sumP = 0;
for( int i = 0; i < histogramA.length; i++ ) {
float q = histogramA[i];
float p = histogramB[i];
sumP += Math.abs(q-p);
}
return sumP;
} | [
"protected",
"double",
"distanceHistogram",
"(",
"float",
"histogramA",
"[",
"]",
",",
"float",
"histogramB",
"[",
"]",
")",
"{",
"double",
"sumP",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"histogramA",
".",
"length",
";",
"i",... | Computes the difference between two histograms using SAD.
This is a change from the paper, which uses Bhattacharyya. Bhattacharyya could give poor performance
even with perfect data since two errors can cancel each other out. For example, part of the histogram
is too small and another part is too large. | [
"Computes",
"the",
"difference",
"between",
"two",
"histograms",
"using",
"SAD",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java#L325-L333 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSift.java | DescribePointSift.setImageGradient | public void setImageGradient(Deriv derivX , Deriv derivY ) {
this.imageDerivX.wrap(derivX);
this.imageDerivY.wrap(derivY);
} | java | public void setImageGradient(Deriv derivX , Deriv derivY ) {
this.imageDerivX.wrap(derivX);
this.imageDerivY.wrap(derivY);
} | [
"public",
"void",
"setImageGradient",
"(",
"Deriv",
"derivX",
",",
"Deriv",
"derivY",
")",
"{",
"this",
".",
"imageDerivX",
".",
"wrap",
"(",
"derivX",
")",
";",
"this",
".",
"imageDerivY",
".",
"wrap",
"(",
"derivY",
")",
";",
"}"
] | Sets the image spacial derivatives. These should be computed from an image at the appropriate scale
in scale-space.
@param derivX x-derivative of input image
@param derivY y-derivative of input image | [
"Sets",
"the",
"image",
"spacial",
"derivatives",
".",
"These",
"should",
"be",
"computed",
"from",
"an",
"image",
"at",
"the",
"appropriate",
"scale",
"in",
"scale",
"-",
"space",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSift.java#L91-L94 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSift.java | DescribePointSift.process | public void process( double c_x , double c_y , double sigma , double orientation , TupleDesc_F64 descriptor )
{
descriptor.fill(0);
computeRawDescriptor(c_x, c_y, sigma, orientation, descriptor);
normalizeDescriptor(descriptor,maxDescriptorElementValue);
} | java | public void process( double c_x , double c_y , double sigma , double orientation , TupleDesc_F64 descriptor )
{
descriptor.fill(0);
computeRawDescriptor(c_x, c_y, sigma, orientation, descriptor);
normalizeDescriptor(descriptor,maxDescriptorElementValue);
} | [
"public",
"void",
"process",
"(",
"double",
"c_x",
",",
"double",
"c_y",
",",
"double",
"sigma",
",",
"double",
"orientation",
",",
"TupleDesc_F64",
"descriptor",
")",
"{",
"descriptor",
".",
"fill",
"(",
"0",
")",
";",
"computeRawDescriptor",
"(",
"c_x",
... | Computes the SIFT descriptor for the specified key point
@param c_x center of key point. x-axis
@param c_y center of key point. y-axis
@param sigma Computed sigma in scale-space for this point
@param orientation Orientation of keypoint in radians
@param descriptor (output) Storage for computed descriptor. Make sure... | [
"Computes",
"the",
"SIFT",
"descriptor",
"for",
"the",
"specified",
"key",
"point"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSift.java#L105-L112 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSift.java | DescribePointSift.computeRawDescriptor | void computeRawDescriptor(double c_x, double c_y, double sigma, double orientation, TupleDesc_F64 descriptor) {
double c = Math.cos(orientation);
double s = Math.sin(orientation);
float fwidthSubregion = widthSubregion;
int sampleWidth = widthGrid*widthSubregion;
double sampleRadius = sampleWidth/2;
doubl... | java | void computeRawDescriptor(double c_x, double c_y, double sigma, double orientation, TupleDesc_F64 descriptor) {
double c = Math.cos(orientation);
double s = Math.sin(orientation);
float fwidthSubregion = widthSubregion;
int sampleWidth = widthGrid*widthSubregion;
double sampleRadius = sampleWidth/2;
doubl... | [
"void",
"computeRawDescriptor",
"(",
"double",
"c_x",
",",
"double",
"c_y",
",",
"double",
"sigma",
",",
"double",
"orientation",
",",
"TupleDesc_F64",
"descriptor",
")",
"{",
"double",
"c",
"=",
"Math",
".",
"cos",
"(",
"orientation",
")",
";",
"double",
... | Computes the descriptor by sampling the input image. This is raw because the descriptor hasn't been massaged
yet. | [
"Computes",
"the",
"descriptor",
"by",
"sampling",
"the",
"input",
"image",
".",
"This",
"is",
"raw",
"because",
"the",
"descriptor",
"hasn",
"t",
"been",
"massaged",
"yet",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSift.java#L118-L165 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribeSiftCommon.java | DescribeSiftCommon.normalizeDescriptor | public static void normalizeDescriptor(TupleDesc_F64 descriptor , double maxDescriptorElementValue ) {
// normalize descriptor to unit length
UtilFeature.normalizeL2(descriptor);
// clip the values
for (int i = 0; i < descriptor.size(); i++) {
double value = descriptor.value[i];
if( value > maxDescriptor... | java | public static void normalizeDescriptor(TupleDesc_F64 descriptor , double maxDescriptorElementValue ) {
// normalize descriptor to unit length
UtilFeature.normalizeL2(descriptor);
// clip the values
for (int i = 0; i < descriptor.size(); i++) {
double value = descriptor.value[i];
if( value > maxDescriptor... | [
"public",
"static",
"void",
"normalizeDescriptor",
"(",
"TupleDesc_F64",
"descriptor",
",",
"double",
"maxDescriptorElementValue",
")",
"{",
"// normalize descriptor to unit length",
"UtilFeature",
".",
"normalizeL2",
"(",
"descriptor",
")",
";",
"// clip the values",
"for"... | Adjusts the descriptor. This adds lighting invariance and reduces the affects of none-affine changes
in lighting.
1) Apply L2 normalization
2) Clip using max descriptor value
3) Apply L2 normalization again | [
"Adjusts",
"the",
"descriptor",
".",
"This",
"adds",
"lighting",
"invariance",
"and",
"reduces",
"the",
"affects",
"of",
"none",
"-",
"affine",
"changes",
"in",
"lighting",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribeSiftCommon.java#L84-L98 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribeSiftCommon.java | DescribeSiftCommon.createGaussianWeightKernel | protected static float[] createGaussianWeightKernel( double sigma , int radius ) {
Kernel2D_F32 ker = FactoryKernelGaussian.gaussian2D_F32(sigma,radius,false,false);
float maxValue = KernelMath.maxAbs(ker.data,4*radius*radius);
KernelMath.divide(ker,maxValue);
return ker.data;
} | java | protected static float[] createGaussianWeightKernel( double sigma , int radius ) {
Kernel2D_F32 ker = FactoryKernelGaussian.gaussian2D_F32(sigma,radius,false,false);
float maxValue = KernelMath.maxAbs(ker.data,4*radius*radius);
KernelMath.divide(ker,maxValue);
return ker.data;
} | [
"protected",
"static",
"float",
"[",
"]",
"createGaussianWeightKernel",
"(",
"double",
"sigma",
",",
"int",
"radius",
")",
"{",
"Kernel2D_F32",
"ker",
"=",
"FactoryKernelGaussian",
".",
"gaussian2D_F32",
"(",
"sigma",
",",
"radius",
",",
"false",
",",
"false",
... | Creates a gaussian weighting kernel with an even number of elements along its width | [
"Creates",
"a",
"gaussian",
"weighting",
"kernel",
"with",
"an",
"even",
"number",
"of",
"elements",
"along",
"its",
"width"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribeSiftCommon.java#L103-L108 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribeSiftCommon.java | DescribeSiftCommon.trilinearInterpolation | protected void trilinearInterpolation( float weight , float sampleX , float sampleY , double angle , TupleDesc_F64 descriptor )
{
for (int i = 0; i < widthGrid; i++) {
double weightGridY = 1.0 - Math.abs(sampleY-i);
if( weightGridY <= 0) continue;
for (int j = 0; j < widthGrid; j++) {
double weightGridX... | java | protected void trilinearInterpolation( float weight , float sampleX , float sampleY , double angle , TupleDesc_F64 descriptor )
{
for (int i = 0; i < widthGrid; i++) {
double weightGridY = 1.0 - Math.abs(sampleY-i);
if( weightGridY <= 0) continue;
for (int j = 0; j < widthGrid; j++) {
double weightGridX... | [
"protected",
"void",
"trilinearInterpolation",
"(",
"float",
"weight",
",",
"float",
"sampleX",
",",
"float",
"sampleY",
",",
"double",
"angle",
",",
"TupleDesc_F64",
"descriptor",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"widthGrid",
";"... | Applies trilinear interpolation across the descriptor | [
"Applies",
"trilinear",
"interpolation",
"across",
"the",
"descriptor"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribeSiftCommon.java#L113-L131 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeCodeWordLocations.java | QrCodeCodeWordLocations.computeFeatureMask | private void computeFeatureMask(int numModules, int[] alignment, boolean hasVersion) {
// mark alignment patterns + format info
markSquare(0,0,9);
markRectangle(numModules-8,0,9,8);
markRectangle(0,numModules-8,8,9);
// timing pattern
markRectangle(8,6,1,numModules-8-8);
markRectangle(6,8,numModules-8-8,... | java | private void computeFeatureMask(int numModules, int[] alignment, boolean hasVersion) {
// mark alignment patterns + format info
markSquare(0,0,9);
markRectangle(numModules-8,0,9,8);
markRectangle(0,numModules-8,8,9);
// timing pattern
markRectangle(8,6,1,numModules-8-8);
markRectangle(6,8,numModules-8-8,... | [
"private",
"void",
"computeFeatureMask",
"(",
"int",
"numModules",
",",
"int",
"[",
"]",
"alignment",
",",
"boolean",
"hasVersion",
")",
"{",
"// mark alignment patterns + format info",
"markSquare",
"(",
"0",
",",
"0",
",",
"9",
")",
";",
"markRectangle",
"(",
... | Blocks out the location of features in the image. Needed for codeworld location extraction
@param numModules
@param alignment
@param hasVersion | [
"Blocks",
"out",
"the",
"location",
"of",
"features",
"in",
"the",
"image",
".",
"Needed",
"for",
"codeworld",
"location",
"extraction"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeCodeWordLocations.java#L54-L86 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeCodeWordLocations.java | QrCodeCodeWordLocations.computeBitLocations | private void computeBitLocations() {
int N = numRows;
int row = N-1;
int col = N-1;
int direction = -1;
while (col > 0) {
if (col == 6)
col -= 1;
if (!get(row,col)) {
bits.add( new Point2D_I32(col,row));
}
if (!get(row,col-1)) {
bits.add( new Point2D_I32(col-1,row));
}
row += ... | java | private void computeBitLocations() {
int N = numRows;
int row = N-1;
int col = N-1;
int direction = -1;
while (col > 0) {
if (col == 6)
col -= 1;
if (!get(row,col)) {
bits.add( new Point2D_I32(col,row));
}
if (!get(row,col-1)) {
bits.add( new Point2D_I32(col-1,row));
}
row += ... | [
"private",
"void",
"computeBitLocations",
"(",
")",
"{",
"int",
"N",
"=",
"numRows",
";",
"int",
"row",
"=",
"N",
"-",
"1",
";",
"int",
"col",
"=",
"N",
"-",
"1",
";",
"int",
"direction",
"=",
"-",
"1",
";",
"while",
"(",
"col",
">",
"0",
")",
... | Snakes through and specifies the location of each bit for all the code words in the grid. | [
"Snakes",
"through",
"and",
"specifies",
"the",
"location",
"of",
"each",
"bit",
"for",
"all",
"the",
"code",
"words",
"in",
"the",
"grid",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeCodeWordLocations.java#L107-L132 | train |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/feature/VisualizeShapes.java | VisualizeShapes.drawRectangle | public static void drawRectangle( Rectangle2D_I32 rect , Graphics2D g2 ) {
g2.drawLine(rect.x0, rect.y0, rect.x1, rect.y0);
g2.drawLine(rect.x1, rect.y0, rect.x1, rect.y1);
g2.drawLine(rect.x0, rect.y1, rect.x1, rect.y1);
g2.drawLine(rect.x0, rect.y1, rect.x0, rect.y0);
} | java | public static void drawRectangle( Rectangle2D_I32 rect , Graphics2D g2 ) {
g2.drawLine(rect.x0, rect.y0, rect.x1, rect.y0);
g2.drawLine(rect.x1, rect.y0, rect.x1, rect.y1);
g2.drawLine(rect.x0, rect.y1, rect.x1, rect.y1);
g2.drawLine(rect.x0, rect.y1, rect.x0, rect.y0);
} | [
"public",
"static",
"void",
"drawRectangle",
"(",
"Rectangle2D_I32",
"rect",
",",
"Graphics2D",
"g2",
")",
"{",
"g2",
".",
"drawLine",
"(",
"rect",
".",
"x0",
",",
"rect",
".",
"y0",
",",
"rect",
".",
"x1",
",",
"rect",
".",
"y0",
")",
";",
"g2",
"... | Draws an axis aligned rectangle
@param rect Rectangle
@param g2 Graphics object | [
"Draws",
"an",
"axis",
"aligned",
"rectangle"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/feature/VisualizeShapes.java#L335-L340 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactorySteerCoefficients.java | FactorySteerCoefficients.polynomial | public static SteerableCoefficients polynomial( int order ) {
if( order == 1 )
return new PolyOrder1();
else if( order == 2 )
return new PolyOrder2();
else if( order == 3 )
return new PolyOrder3();
else if( order == 4 )
return new PolyOrder4();
else
throw new IllegalArgumentException("Only supp... | java | public static SteerableCoefficients polynomial( int order ) {
if( order == 1 )
return new PolyOrder1();
else if( order == 2 )
return new PolyOrder2();
else if( order == 3 )
return new PolyOrder3();
else if( order == 4 )
return new PolyOrder4();
else
throw new IllegalArgumentException("Only supp... | [
"public",
"static",
"SteerableCoefficients",
"polynomial",
"(",
"int",
"order",
")",
"{",
"if",
"(",
"order",
"==",
"1",
")",
"return",
"new",
"PolyOrder1",
"(",
")",
";",
"else",
"if",
"(",
"order",
"==",
"2",
")",
"return",
"new",
"PolyOrder2",
"(",
... | Coefficients for even or odd parity polynomials.
@param order order of the polynomial.
@return Steering coeficient. | [
"Coefficients",
"for",
"even",
"or",
"odd",
"parity",
"polynomials",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactorySteerCoefficients.java#L46-L57 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/associate/AssociateThreeByPairs.java | AssociateThreeByPairs.pruneMatches | private void pruneMatches() {
int index = 0;
while( index < matches.size ) {
AssociatedTripleIndex a = matches.get(index);
// not matched. Remove it from the list by copying that last element over it
if( a.c == -1 ) {
a.set(matches.get(matches.size-1));
matches.size--;
} else {
index++;
}... | java | private void pruneMatches() {
int index = 0;
while( index < matches.size ) {
AssociatedTripleIndex a = matches.get(index);
// not matched. Remove it from the list by copying that last element over it
if( a.c == -1 ) {
a.set(matches.get(matches.size-1));
matches.size--;
} else {
index++;
}... | [
"private",
"void",
"pruneMatches",
"(",
")",
"{",
"int",
"index",
"=",
"0",
";",
"while",
"(",
"index",
"<",
"matches",
".",
"size",
")",
"{",
"AssociatedTripleIndex",
"a",
"=",
"matches",
".",
"get",
"(",
"index",
")",
";",
"// not matched. Remove it from... | Removes by swapping all elements with a 'c' index of -1 | [
"Removes",
"by",
"swapping",
"all",
"elements",
"with",
"a",
"c",
"index",
"of",
"-",
"1"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/associate/AssociateThreeByPairs.java#L151-L163 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/Relinearlize.java | Relinearlize.setNumberControl | public void setNumberControl( int numControl ) {
this.numControl = numControl;
if( numControl == 4 ) {
x0.reshape(10,1,false);
AA.reshape(10,9,false);
yy.reshape(10,1,false);
xx.reshape(9,1,false);
numNull = 3;
} else {
x0.reshape(6,1,false);
AA.reshape(4,2,false);
yy.reshape(4,1,false);
... | java | public void setNumberControl( int numControl ) {
this.numControl = numControl;
if( numControl == 4 ) {
x0.reshape(10,1,false);
AA.reshape(10,9,false);
yy.reshape(10,1,false);
xx.reshape(9,1,false);
numNull = 3;
} else {
x0.reshape(6,1,false);
AA.reshape(4,2,false);
yy.reshape(4,1,false);
... | [
"public",
"void",
"setNumberControl",
"(",
"int",
"numControl",
")",
"{",
"this",
".",
"numControl",
"=",
"numControl",
";",
"if",
"(",
"numControl",
"==",
"4",
")",
"{",
"x0",
".",
"reshape",
"(",
"10",
",",
"1",
",",
"false",
")",
";",
"AA",
".",
... | Specified the number of control points.
@param numControl 3 = planar, 4 = general | [
"Specified",
"the",
"number",
"of",
"control",
"points",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/Relinearlize.java#L78-L101 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/Relinearlize.java | Relinearlize.process | public void process( DMatrixRMaj L_full , DMatrixRMaj y , double betas[] ) {
svd.decompose(L_full);
// extract null space
V = svd.getV(null,true);
// compute one possible solution
pseudo.setA(L_full);
pseudo.solve(y,x0);
// add additional constraints to reduce the number of possible solutions
DMatri... | java | public void process( DMatrixRMaj L_full , DMatrixRMaj y , double betas[] ) {
svd.decompose(L_full);
// extract null space
V = svd.getV(null,true);
// compute one possible solution
pseudo.setA(L_full);
pseudo.solve(y,x0);
// add additional constraints to reduce the number of possible solutions
DMatri... | [
"public",
"void",
"process",
"(",
"DMatrixRMaj",
"L_full",
",",
"DMatrixRMaj",
"y",
",",
"double",
"betas",
"[",
"]",
")",
"{",
"svd",
".",
"decompose",
"(",
"L_full",
")",
";",
"// extract null space",
"V",
"=",
"svd",
".",
"getV",
"(",
"null",
",",
"... | Estimates betas using relinearization.
@param L_full Linear constraint matrix
@param y distances between world control points
@param betas Estimated betas. Output. | [
"Estimates",
"betas",
"using",
"relinearization",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/Relinearlize.java#L110-L141 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/Relinearlize.java | Relinearlize.solveConstraintMatrix | protected DMatrixRMaj solveConstraintMatrix() {
int rowAA = 0;
for( int i = 0; i < numControl; i++ ) {
for( int j = i+1; j < numControl; j++ ) {
for( int k = j; k < numControl; k++ , rowAA++ ) {
// x_{ii}*x_{jk} = x_{ik}*x_{ji}
extractXaXb(getIndex(i, i), getIndex(j, k), XiiXjk);
extractXaXb(... | java | protected DMatrixRMaj solveConstraintMatrix() {
int rowAA = 0;
for( int i = 0; i < numControl; i++ ) {
for( int j = i+1; j < numControl; j++ ) {
for( int k = j; k < numControl; k++ , rowAA++ ) {
// x_{ii}*x_{jk} = x_{ik}*x_{ji}
extractXaXb(getIndex(i, i), getIndex(j, k), XiiXjk);
extractXaXb(... | [
"protected",
"DMatrixRMaj",
"solveConstraintMatrix",
"(",
")",
"{",
"int",
"rowAA",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numControl",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"i",
"+",
"1",
";",
"j",
"<... | Apply additional constraints to reduce the number of possible solutions
x(k) = x_{ij} = bi*bj = x0(k) + a1*V0(k) + a2*V1(k) + a3*V2(k)
constraint:
x_{ii}*x_{jk} = x_{ik}*x_{ji} | [
"Apply",
"additional",
"constraints",
"to",
"reduce",
"the",
"number",
"of",
"possible",
"solutions"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/Relinearlize.java#L152-L173 | train |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/ConvertRaster.java | ConvertRaster.orderBandsIntoRGB | public static <T extends ImageGray<T>>
void orderBandsIntoRGB(Planar<T> image , BufferedImage input ) {
boolean swap = swapBandOrder(input);
// Output formats are: RGB and RGBA
if( swap ) {
if( image.getNumBands() == 3 ) {
int bufferedImageType = input.getType();
if( bufferedImageType == BufferedIm... | java | public static <T extends ImageGray<T>>
void orderBandsIntoRGB(Planar<T> image , BufferedImage input ) {
boolean swap = swapBandOrder(input);
// Output formats are: RGB and RGBA
if( swap ) {
if( image.getNumBands() == 3 ) {
int bufferedImageType = input.getType();
if( bufferedImageType == BufferedIm... | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"void",
"orderBandsIntoRGB",
"(",
"Planar",
"<",
"T",
">",
"image",
",",
"BufferedImage",
"input",
")",
"{",
"boolean",
"swap",
"=",
"swapBandOrder",
"(",
"input",
")",
";",
"// Ou... | If a Planar was created from a BufferedImage its colors might not be in the expected order.
Invoking this function ensures that the image will have the expected ordering. For images with
3 bands it will be RGB and for 4 bands it will be ARGB. | [
"If",
"a",
"Planar",
"was",
"created",
"from",
"a",
"BufferedImage",
"its",
"colors",
"might",
"not",
"be",
"in",
"the",
"expected",
"order",
".",
"Invoking",
"this",
"function",
"ensures",
"that",
"the",
"image",
"will",
"have",
"the",
"expected",
"ordering... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertRaster.java#L309-L348 | train |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/ConvertRaster.java | ConvertRaster.isKnownByteFormat | public static boolean isKnownByteFormat( BufferedImage image ) {
int type = image.getType();
return type != BufferedImage.TYPE_BYTE_INDEXED &&
type != BufferedImage.TYPE_BYTE_BINARY &&
type != BufferedImage.TYPE_CUSTOM;
} | java | public static boolean isKnownByteFormat( BufferedImage image ) {
int type = image.getType();
return type != BufferedImage.TYPE_BYTE_INDEXED &&
type != BufferedImage.TYPE_BYTE_BINARY &&
type != BufferedImage.TYPE_CUSTOM;
} | [
"public",
"static",
"boolean",
"isKnownByteFormat",
"(",
"BufferedImage",
"image",
")",
"{",
"int",
"type",
"=",
"image",
".",
"getType",
"(",
")",
";",
"return",
"type",
"!=",
"BufferedImage",
".",
"TYPE_BYTE_INDEXED",
"&&",
"type",
"!=",
"BufferedImage",
"."... | Checks to see if it is a known byte format | [
"Checks",
"to",
"see",
"if",
"it",
"is",
"a",
"known",
"byte",
"format"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertRaster.java#L696-L701 | train |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java | UtilImageIO.loadImages | public static List<BufferedImage> loadImages( String directory , final String regex ) {
List<String> paths = UtilIO.listByRegex(directory,regex);
List<BufferedImage> ret = new ArrayList<>();
if( paths.size() == 0 )
return ret;
// Sort so that the order is deterministic
Collections.sort(paths);
for( ... | java | public static List<BufferedImage> loadImages( String directory , final String regex ) {
List<String> paths = UtilIO.listByRegex(directory,regex);
List<BufferedImage> ret = new ArrayList<>();
if( paths.size() == 0 )
return ret;
// Sort so that the order is deterministic
Collections.sort(paths);
for( ... | [
"public",
"static",
"List",
"<",
"BufferedImage",
">",
"loadImages",
"(",
"String",
"directory",
",",
"final",
"String",
"regex",
")",
"{",
"List",
"<",
"String",
">",
"paths",
"=",
"UtilIO",
".",
"listByRegex",
"(",
"directory",
",",
"regex",
")",
";",
... | Loads all the image in the specified directory which match the provided regex
@param directory File directory
@param regex Regex used to match file names
@return List of found images. | [
"Loads",
"all",
"the",
"image",
"in",
"the",
"specified",
"directory",
"which",
"match",
"the",
"provided",
"regex"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L60-L79 | train |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java | UtilImageIO.loadImage | public static BufferedImage loadImage(URL url) {
if( url == null )
return null;
try {
BufferedImage buffered = ImageIO.read(url);
if( buffered != null )
return buffered;
if( url.getProtocol().equals("file")) {
String path = URLDecoder.decode(url.getPath(), "UTF-8");
if( !new File(path).exist... | java | public static BufferedImage loadImage(URL url) {
if( url == null )
return null;
try {
BufferedImage buffered = ImageIO.read(url);
if( buffered != null )
return buffered;
if( url.getProtocol().equals("file")) {
String path = URLDecoder.decode(url.getPath(), "UTF-8");
if( !new File(path).exist... | [
"public",
"static",
"BufferedImage",
"loadImage",
"(",
"URL",
"url",
")",
"{",
"if",
"(",
"url",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"BufferedImage",
"buffered",
"=",
"ImageIO",
".",
"read",
"(",
"url",
")",
";",
"if",
"(",
"buffered"... | A function that load the specified image. If anything goes wrong it returns a
null. | [
"A",
"function",
"that",
"load",
"the",
"specified",
"image",
".",
"If",
"anything",
"goes",
"wrong",
"it",
"returns",
"a",
"null",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L85-L112 | train |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java | UtilImageIO.loadImage | public static <T extends ImageGray<T>> T loadImage(String fileName, Class<T> imageType ) {
BufferedImage img = loadImage(fileName);
if( img == null )
return null;
return ConvertBufferedImage.convertFromSingle(img, (T) null, imageType);
} | java | public static <T extends ImageGray<T>> T loadImage(String fileName, Class<T> imageType ) {
BufferedImage img = loadImage(fileName);
if( img == null )
return null;
return ConvertBufferedImage.convertFromSingle(img, (T) null, imageType);
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"T",
"loadImage",
"(",
"String",
"fileName",
",",
"Class",
"<",
"T",
">",
"imageType",
")",
"{",
"BufferedImage",
"img",
"=",
"loadImage",
"(",
"fileName",
")",
";",
"if",
"(",
... | Loads the image and converts into the specified image type.
@param fileName Path to image file.
@param imageType Type of image that should be returned.
@return The image or null if the image could not be loaded. | [
"Loads",
"the",
"image",
"and",
"converts",
"into",
"the",
"specified",
"image",
"type",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L121-L127 | train |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java | UtilImageIO.loadPPM | public static BufferedImage loadPPM( String fileName , BufferedImage storage ) throws IOException {
return loadPPM(new FileInputStream(fileName),storage);
} | java | public static BufferedImage loadPPM( String fileName , BufferedImage storage ) throws IOException {
return loadPPM(new FileInputStream(fileName),storage);
} | [
"public",
"static",
"BufferedImage",
"loadPPM",
"(",
"String",
"fileName",
",",
"BufferedImage",
"storage",
")",
"throws",
"IOException",
"{",
"return",
"loadPPM",
"(",
"new",
"FileInputStream",
"(",
"fileName",
")",
",",
"storage",
")",
";",
"}"
] | Loads a PPM image from a file.
@param fileName Location of PPM image
@param storage (Optional) Storage for output image. Must be the width and height of the image being read.
Better performance of type BufferedImage.TYPE_INT_RGB. If null or width/height incorrect a new image
will be declared.
@return The read in ima... | [
"Loads",
"a",
"PPM",
"image",
"from",
"a",
"file",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L203-L205 | train |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java | UtilImageIO.loadPGM | public static BufferedImage loadPGM( String fileName , BufferedImage storage ) throws IOException {
return loadPGM(new FileInputStream(fileName), storage);
} | java | public static BufferedImage loadPGM( String fileName , BufferedImage storage ) throws IOException {
return loadPGM(new FileInputStream(fileName), storage);
} | [
"public",
"static",
"BufferedImage",
"loadPGM",
"(",
"String",
"fileName",
",",
"BufferedImage",
"storage",
")",
"throws",
"IOException",
"{",
"return",
"loadPGM",
"(",
"new",
"FileInputStream",
"(",
"fileName",
")",
",",
"storage",
")",
";",
"}"
] | Loads a PGM image from a file.
@param fileName Location of PGM image
@param storage (Optional) Storage for output image. Must be the width and height of the image being read.
Better performance of type BufferedImage.TYPE_BYTE_GRAY. If null or width/height incorrect a new image
will be declared.
@return The image
@th... | [
"Loads",
"a",
"PGM",
"image",
"from",
"a",
"file",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L217-L219 | train |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java | UtilImageIO.savePPM | public static void savePPM(Planar<GrayU8> rgb , String fileName , GrowQueue_I8 temp ) throws IOException {
File out = new File(fileName);
DataOutputStream os = new DataOutputStream(new FileOutputStream(out));
String header = String.format("P6\n%d %d\n255\n", rgb.width, rgb.height);
os.write(header.getBytes());... | java | public static void savePPM(Planar<GrayU8> rgb , String fileName , GrowQueue_I8 temp ) throws IOException {
File out = new File(fileName);
DataOutputStream os = new DataOutputStream(new FileOutputStream(out));
String header = String.format("P6\n%d %d\n255\n", rgb.width, rgb.height);
os.write(header.getBytes());... | [
"public",
"static",
"void",
"savePPM",
"(",
"Planar",
"<",
"GrayU8",
">",
"rgb",
",",
"String",
"fileName",
",",
"GrowQueue_I8",
"temp",
")",
"throws",
"IOException",
"{",
"File",
"out",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"DataOutputStream",
"o... | Saves an image in PPM format.
@param rgb 3-band RGB image
@param fileName Location where the image is to be written to.
@param temp (Optional) Used internally to store the image. Can be null.
@throws IOException Thrown if there is a problem reading the image | [
"Saves",
"an",
"image",
"in",
"PPM",
"format",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L462-L491 | train |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java | UtilImageIO.savePGM | public static void savePGM(GrayU8 gray , String fileName ) throws IOException {
File out = new File(fileName);
DataOutputStream os = new DataOutputStream(new FileOutputStream(out));
String header = String.format("P5\n%d %d\n255\n", gray.width, gray.height);
os.write(header.getBytes());
os.write(gray.data,0,... | java | public static void savePGM(GrayU8 gray , String fileName ) throws IOException {
File out = new File(fileName);
DataOutputStream os = new DataOutputStream(new FileOutputStream(out));
String header = String.format("P5\n%d %d\n255\n", gray.width, gray.height);
os.write(header.getBytes());
os.write(gray.data,0,... | [
"public",
"static",
"void",
"savePGM",
"(",
"GrayU8",
"gray",
",",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"File",
"out",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"DataOutputStream",
"os",
"=",
"new",
"DataOutputStream",
"(",
"new",
... | Saves an image in PGM format.
@param gray Gray scale image
@param fileName Location where the image is to be written to.
@throws IOException Thrown if there is a problem reading the image | [
"Saves",
"an",
"image",
"in",
"PGM",
"format",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L500-L510 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java | FactoryKernelGaussian.gaussian | public static <T extends KernelBase> T gaussian(Class<T> kernelType, double sigma, int radius )
{
if (Kernel1D_F32.class == kernelType) {
return gaussian(1, true, 32, sigma, radius);
} else if (Kernel1D_F64.class == kernelType) {
return gaussian(1,true, 64, sigma,radius);
} else if (Kernel1D_S32.class == k... | java | public static <T extends KernelBase> T gaussian(Class<T> kernelType, double sigma, int radius )
{
if (Kernel1D_F32.class == kernelType) {
return gaussian(1, true, 32, sigma, radius);
} else if (Kernel1D_F64.class == kernelType) {
return gaussian(1,true, 64, sigma,radius);
} else if (Kernel1D_S32.class == k... | [
"public",
"static",
"<",
"T",
"extends",
"KernelBase",
">",
"T",
"gaussian",
"(",
"Class",
"<",
"T",
">",
"kernelType",
",",
"double",
"sigma",
",",
"int",
"radius",
")",
"{",
"if",
"(",
"Kernel1D_F32",
".",
"class",
"==",
"kernelType",
")",
"{",
"retu... | Creates a Gaussian kernel of the specified type.
@param kernelType The type of kernel which is to be created.
@param sigma The distributions stdev. If ≤ 0 then the sigma will be computed from the radius.
@param radius Number of pixels in the kernel's radius. If ≤ 0 then the sigma will be computed from the sigm... | [
"Creates",
"a",
"Gaussian",
"kernel",
"of",
"the",
"specified",
"type",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java#L50-L67 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java | FactoryKernelGaussian.gaussian1D | public static <T extends ImageGray<T>, K extends Kernel1D>
K gaussian1D(Class<T> imageType, double sigma, int radius )
{
boolean isFloat = GeneralizedImageOps.isFloatingPoint(imageType);
int numBits = GeneralizedImageOps.getNumBits(imageType);
if( numBits < 32 )
numBits = 32;
return gaussian(1,isFloat, num... | java | public static <T extends ImageGray<T>, K extends Kernel1D>
K gaussian1D(Class<T> imageType, double sigma, int radius )
{
boolean isFloat = GeneralizedImageOps.isFloatingPoint(imageType);
int numBits = GeneralizedImageOps.getNumBits(imageType);
if( numBits < 32 )
numBits = 32;
return gaussian(1,isFloat, num... | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
",",
"K",
"extends",
"Kernel1D",
">",
"K",
"gaussian1D",
"(",
"Class",
"<",
"T",
">",
"imageType",
",",
"double",
"sigma",
",",
"int",
"radius",
")",
"{",
"boolean",
"isFloat",
"=",
... | Creates a 1D Gaussian kernel of the specified type.
@param imageType The type of image which is to be convolved by this kernel.
@param sigma The distributions stdev. If ≤ 0 then the sigma will be computed from the radius.
@param radius Number of pixels in the kernel's radius. If ≤ 0 then the sigma will be comp... | [
"Creates",
"a",
"1D",
"Gaussian",
"kernel",
"of",
"the",
"specified",
"type",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java#L77-L85 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java | FactoryKernelGaussian.gaussian2D | public static <T extends ImageGray<T>, K extends Kernel2D>
K gaussian2D(Class<T> imageType, double sigma, int radius )
{
boolean isFloat = GeneralizedImageOps.isFloatingPoint(imageType);
int numBits = Math.max(32, GeneralizedImageOps.getNumBits(imageType));
return gaussian(2,isFloat, numBits, sigma,radius);
} | java | public static <T extends ImageGray<T>, K extends Kernel2D>
K gaussian2D(Class<T> imageType, double sigma, int radius )
{
boolean isFloat = GeneralizedImageOps.isFloatingPoint(imageType);
int numBits = Math.max(32, GeneralizedImageOps.getNumBits(imageType));
return gaussian(2,isFloat, numBits, sigma,radius);
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
",",
"K",
"extends",
"Kernel2D",
">",
"K",
"gaussian2D",
"(",
"Class",
"<",
"T",
">",
"imageType",
",",
"double",
"sigma",
",",
"int",
"radius",
")",
"{",
"boolean",
"isFloat",
"=",
... | Creates a 2D Gaussian kernel of the specified type.
@param imageType The type of image which is to be convolved by this kernel.
@param sigma The distributions stdev. If ≤ 0 then the sigma will be computed from the radius.
@param radius Number of pixels in the kernel's radius. If ≤ 0 then the sigma will be comp... | [
"Creates",
"a",
"2D",
"Gaussian",
"kernel",
"of",
"the",
"specified",
"type",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java#L95-L101 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java | FactoryKernelGaussian.gaussian | public static <T extends KernelBase> T gaussian(int DOF, boolean isFloat, int numBits, double sigma, int radius)
{
if( radius <= 0 )
radius = FactoryKernelGaussian.radiusForSigma(sigma,0);
else if( sigma <= 0 )
sigma = FactoryKernelGaussian.sigmaForRadius(radius,0);
if( DOF == 2 ) {
if( numBits == 32 )... | java | public static <T extends KernelBase> T gaussian(int DOF, boolean isFloat, int numBits, double sigma, int radius)
{
if( radius <= 0 )
radius = FactoryKernelGaussian.radiusForSigma(sigma,0);
else if( sigma <= 0 )
sigma = FactoryKernelGaussian.sigmaForRadius(radius,0);
if( DOF == 2 ) {
if( numBits == 32 )... | [
"public",
"static",
"<",
"T",
"extends",
"KernelBase",
">",
"T",
"gaussian",
"(",
"int",
"DOF",
",",
"boolean",
"isFloat",
",",
"int",
"numBits",
",",
"double",
"sigma",
",",
"int",
"radius",
")",
"{",
"if",
"(",
"radius",
"<=",
"0",
")",
"radius",
"... | Creates a Gaussian kernel with the specified properties.
@param DOF 1 for 1D kernel and 2 for 2D kernel.
@param isFloat True for F32 kernel and false for I32.
@param numBits Number of bits in each data element. 32 or 64
@param sigma The distributions stdev. If ≤ 0 then the sigma will be computed from the radius.
@... | [
"Creates",
"a",
"Gaussian",
"kernel",
"with",
"the",
"specified",
"properties",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java#L120-L159 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java | FactoryKernelGaussian.derivative | public static <T extends Kernel1D> T derivative( int order, boolean isFloat,
double sigma, int radius )
{
// zero order is a regular gaussian
if( order == 0 ) {
return gaussian(1,isFloat, 32, sigma,radius);
}
if( radius <= 0 )
radius = FactoryKernelGaussian.radiusForSigma(sigma,order);
e... | java | public static <T extends Kernel1D> T derivative( int order, boolean isFloat,
double sigma, int radius )
{
// zero order is a regular gaussian
if( order == 0 ) {
return gaussian(1,isFloat, 32, sigma,radius);
}
if( radius <= 0 )
radius = FactoryKernelGaussian.radiusForSigma(sigma,order);
e... | [
"public",
"static",
"<",
"T",
"extends",
"Kernel1D",
">",
"T",
"derivative",
"(",
"int",
"order",
",",
"boolean",
"isFloat",
",",
"double",
"sigma",
",",
"int",
"radius",
")",
"{",
"// zero order is a regular gaussian",
"if",
"(",
"order",
"==",
"0",
")",
... | Creates a 1D Gaussian kernel with the specified properties.
@param order The order of the gaussian derivative.
@param isFloat True for F32 kernel and false for I32.
@param sigma The distributions stdev. If ≤ 0 then the sigma will be computed from the radius.
@param radius Number of pixels in the kernel's radius. ... | [
"Creates",
"a",
"1D",
"Gaussian",
"kernel",
"with",
"the",
"specified",
"properties",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java#L187-L206 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java | FactoryKernelGaussian.gaussian2D_F32 | public static Kernel2D_F32 gaussian2D_F32(double sigma, int radius, boolean odd, boolean normalize) {
Kernel1D_F32 kernel1D = gaussian1D_F32(sigma,radius, odd, false);
Kernel2D_F32 ret = KernelMath.convolve2D(kernel1D, kernel1D);
if (normalize) {
KernelMath.normalizeSumToOne(ret);
}
return ret;
} | java | public static Kernel2D_F32 gaussian2D_F32(double sigma, int radius, boolean odd, boolean normalize) {
Kernel1D_F32 kernel1D = gaussian1D_F32(sigma,radius, odd, false);
Kernel2D_F32 ret = KernelMath.convolve2D(kernel1D, kernel1D);
if (normalize) {
KernelMath.normalizeSumToOne(ret);
}
return ret;
} | [
"public",
"static",
"Kernel2D_F32",
"gaussian2D_F32",
"(",
"double",
"sigma",
",",
"int",
"radius",
",",
"boolean",
"odd",
",",
"boolean",
"normalize",
")",
"{",
"Kernel1D_F32",
"kernel1D",
"=",
"gaussian1D_F32",
"(",
"sigma",
",",
"radius",
",",
"odd",
",",
... | Creates a kernel for a 2D convolution. This should only be used for validation purposes.
@param sigma Distributions standard deviation.
@param radius Kernel's radius.
@param odd Does the kernel have an even or add width
@param normalize If the kernel should be normalized to one or not. | [
"Creates",
"a",
"kernel",
"for",
"a",
"2D",
"convolution",
".",
"This",
"should",
"only",
"be",
"used",
"for",
"validation",
"purposes",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java#L269-L278 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java | FactoryKernelGaussian.derivative1D_F32 | protected static Kernel1D_F32 derivative1D_F32(int order, double sigma, int radius, boolean normalize) {
Kernel1D_F32 ret = new Kernel1D_F32(radius * 2 + 1);
float[] gaussian = ret.data;
int index = 0;
switch( order ) {
case 1:
for (int i = radius; i >= -radius; i--) {
gaussian[index++] = (float) U... | java | protected static Kernel1D_F32 derivative1D_F32(int order, double sigma, int radius, boolean normalize) {
Kernel1D_F32 ret = new Kernel1D_F32(radius * 2 + 1);
float[] gaussian = ret.data;
int index = 0;
switch( order ) {
case 1:
for (int i = radius; i >= -radius; i--) {
gaussian[index++] = (float) U... | [
"protected",
"static",
"Kernel1D_F32",
"derivative1D_F32",
"(",
"int",
"order",
",",
"double",
"sigma",
",",
"int",
"radius",
",",
"boolean",
"normalize",
")",
"{",
"Kernel1D_F32",
"ret",
"=",
"new",
"Kernel1D_F32",
"(",
"radius",
"*",
"2",
"+",
"1",
")",
... | Computes the derivative of a Gaussian kernel.
@param sigma Distributions standard deviation.
@param radius Kernel's radius.
@param normalize
@return The derivative of the gaussian | [
"Computes",
"the",
"derivative",
"of",
"a",
"Gaussian",
"kernel",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java#L299-L346 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.