use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.
the class ExampleAssociateThreeView method detectFeatures.
/**
* Detects and saves features in the specified image
*/
public void detectFeatures(GrayU8 gray, int which) {
DogArray<Point2D_F64> locations = listLocations.get(which);
DogArray<TupleDesc_F64> features = listFeatures.get(which);
DogArray_I32 featureSet = listFeatureSets.get(which);
detDesc.detect(gray);
for (int i = 0; i < detDesc.getNumberOfFeatures(); i++) {
Point2D_F64 pixel = detDesc.getLocation(i);
locations.grow().setTo(pixel.x, pixel.y);
features.grow().setTo(detDesc.getDescription(i));
featureSet.add(detDesc.getSet(i));
}
}
use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.
the class CompareTwoImagePanel method findBestPoints.
private void findBestPoints(int x, int y, List<Point2D_F64> pts, List<Integer> selected) {
double bestDist = clickDistance * clickDistance;
DogArray_I32 bestIndexes = new DogArray_I32(20);
for (int i = 0; i < pts.size(); i++) {
if (!isValidPoint(i))
continue;
Point2D_F64 p = pts.get(i);
double d = UtilPoint2D_F64.distanceSq(p.x, p.y, x, y);
if (d < bestDist) {
bestDist = d;
bestIndexes.reset();
bestIndexes.add(i);
} else if (Math.abs(d - bestDist) < 0.01) {
bestIndexes.add(i);
}
}
for (int i = 0; i < bestIndexes.size(); i++) {
selected.add(bestIndexes.get(i));
}
}
use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.
the class SplitMergeLineFitLoop method mergeSegments.
/**
* Merges lines together if the common corner is close to a common line
*
* @return true the list being changed
*/
protected boolean mergeSegments() {
// See if merging will cause a degenerate case
if (splits.size() <= 3)
return false;
boolean change = false;
work.reset();
for (int i = 0; i < splits.size; i++) {
int start = splits.data[i];
int end = splits.data[(i + 2) % splits.size];
if (selectSplitOffset(start, circularDistance(start, end)) < 0) {
// merge the two lines by not adding it
change = true;
} else {
work.add(splits.data[(i + 1) % splits.size]);
}
}
// swap the two lists
DogArray_I32 tmp = work;
work = splits;
splits = tmp;
return change;
}
use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.
the class SplitMergeLineFitLoop method splitSegments.
/**
* Splits a line in two if there is a point that is too far away
*
* @return true for change
*/
protected boolean splitSegments() {
boolean change = false;
work.reset();
for (int i = 0; i < splits.size - 1; i++) {
change |= checkSplit(change, i, i + 1);
}
change |= checkSplit(change, splits.size - 1, 0);
// swap the two lists
DogArray_I32 tmp = work;
work = splits;
splits = tmp;
return change;
}
use of org.ddogleg.struct.DogArray_I32 in project BoofCV by lessthanoptimal.
the class DetectDescribeAssociateTracker method spawnTracks.
/**
* Takes the current crop of detected features and makes them the keyframe
*/
public void spawnTracks() {
// in an undefined state
if (tracksAll.size == 0) {
for (int i = 0; i < dstDesc.size; i++) {
Point2D_F64 loc = dstPixels.get(i);
addNewTrack(dstSet.get(i), loc.x, loc.y, dstDesc.get(i));
}
return;
}
// create new tracks from latest unassociated detected features
DogArray_I32 unassociated = associate.getUnassociatedDestination();
for (int i = 0; i < unassociated.size; i++) {
int indexDst = unassociated.get(i);
Point2D_F64 loc = dstPixels.get(indexDst);
addNewTrack(dstSet.get(i), loc.x, loc.y, dstDesc.get(indexDst));
}
}
Aggregations