use of org.ddogleg.struct.FastQueue in project BoofCV by lessthanoptimal.
the class CompareConvertedDescriptionsApp method describeImage.
public static <TD extends TupleDesc> FastQueue<TD> describeImage(GrayF32 input, InterestPointDetector<GrayF32> detector, DescribeRegionPoint<GrayF32, TD> describe, List<Point2D_F64> location) {
FastQueue<TD> list = new FastQueue<>(100, describe.getDescriptionType(), false);
System.out.println("Detecting");
detector.detect(input);
System.out.println("Describing");
describe.setImage(input);
for (int i = 0; i < detector.getNumberOfFeatures(); i++) {
Point2D_F64 p = detector.getLocation(i);
double radius = detector.getRadius(i);
double ori = detector.getOrientation(i);
TD d = describe.createDescription();
if (describe.process(p.x, p.y, ori, radius, d)) {
list.add(d);
location.add(p.copy());
}
}
return list;
}
use of org.ddogleg.struct.FastQueue in project BoofCV by lessthanoptimal.
the class ExampleMultiviewSceneReconstruction method detectImageFeatures.
/**
* Detect image features in all the images. Save location, description, and color
*/
private void detectImageFeatures(List<BufferedImage> colorImages) {
System.out.println("Detecting Features in each image. Total " + colorImages.size());
for (int i = 0; i < colorImages.size(); i++) {
System.out.print("*");
BufferedImage colorImage = colorImages.get(i);
FastQueue<BrightFeature> features = new SurfFeatureQueue(64);
FastQueue<Point2D_F64> pixels = new FastQueue<>(Point2D_F64.class, true);
GrowQueue_I32 colors = new GrowQueue_I32();
detectFeatures(colorImage, features, pixels, colors);
imageVisualFeatures.add(features);
imagePixels.add(pixels);
imageColors.add(colors);
}
System.out.println();
}
use of org.ddogleg.struct.FastQueue in project BoofCV by lessthanoptimal.
the class CreateRgbPointCloudFileApp method main.
public static void main(String[] args) throws IOException {
String baseDir = "log/";
String nameRgb = baseDir + "rgb0000000.ppm";
String nameDepth = baseDir + "depth0000000.depth";
String nameCalib = baseDir + "intrinsic.yaml";
CameraPinholeRadial param = CalibrationIO.load(nameCalib);
GrayU16 depth = new GrayU16(1, 1);
Planar<GrayU8> rgb = new Planar<>(GrayU8.class, 1, 1, 3);
UtilImageIO.loadPPM_U8(nameRgb, rgb, null);
UtilOpenKinect.parseDepth(nameDepth, depth, null);
FastQueue<Point3D_F64> cloud = new FastQueue<Point3D_F64>(Point3D_F64.class, true);
FastQueueArray_I32 cloudColor = new FastQueueArray_I32(3);
VisualDepthOps.depthTo3D(param, rgb, depth, cloud, cloudColor);
DataOutputStream file = new DataOutputStream(new FileOutputStream("kinect_pointcloud.txt"));
file.write("# Kinect RGB Point cloud. Units: millimeters. Format: X Y Z R G B\n".getBytes());
for (int i = 0; i < cloud.size; i++) {
Point3D_F64 p = cloud.get(i);
int[] color = cloudColor.get(i);
String line = String.format("%.10f %.10f %.10f %d %d %d\n", p.x, p.y, p.z, color[0], color[1], color[2]);
file.write(line.getBytes());
}
file.close();
System.out.println("Total points = " + cloud.size);
}
use of org.ddogleg.struct.FastQueue in project BoofCV by lessthanoptimal.
the class DisplayKinectPointCloudApp method main.
public static void main(String[] args) throws IOException {
String baseDir = UtilIO.pathExample("kinect/basket");
String nameRgb = "basket_rgb.png";
String nameDepth = "basket_depth.png";
String nameCalib = "intrinsic.yaml";
CameraPinholeRadial param = CalibrationIO.load(new File(baseDir, nameCalib));
GrayU16 depth = UtilImageIO.loadImage(new File(baseDir, nameDepth), false, ImageType.single(GrayU16.class));
Planar<GrayU8> rgb = UtilImageIO.loadImage(new File(baseDir, nameRgb), true, ImageType.pl(3, GrayU8.class));
FastQueue<Point3D_F64> cloud = new FastQueue<Point3D_F64>(Point3D_F64.class, true);
FastQueueArray_I32 cloudColor = new FastQueueArray_I32(3);
VisualDepthOps.depthTo3D(param, rgb, depth, cloud, cloudColor);
DMatrixRMaj K = PerspectiveOps.calibrationMatrix(param, (DMatrixRMaj) null);
PointCloudViewer viewer = new PointCloudViewer(K, 10.0);
viewer.setPreferredSize(new Dimension(rgb.width, rgb.height));
for (int i = 0; i < cloud.size; i++) {
Point3D_F64 p = cloud.get(i);
int[] color = cloudColor.get(i);
int c = (color[0] << 16) | (color[1] << 8) | color[2];
viewer.addPoint(p.x, p.y, p.z, c);
}
ShowImages.showWindow(viewer, "Point Cloud", true);
System.out.println("Total points = " + cloud.size);
// BufferedImage depthOut = VisualizeImageData.disparity(depth, null, 0, UtilOpenKinect.FREENECT_DEPTH_MM_MAX_VALUE, 0);
// ShowImages.showWindow(depthOut,"Depth Image", true);
}
use of org.ddogleg.struct.FastQueue in project BoofCV by lessthanoptimal.
the class TestBinaryEllipseDetectorPixel method undistortContour.
/**
* Undistort the image when no distoriton is provided
*/
@Test
public void undistortContour() {
List<Point2D_I32> input = new ArrayList<>();
FastQueue<Point2D_F64> output = new FastQueue<>(Point2D_F64.class, true);
for (int i = 0; i < 10; i++) {
input.add(new Point2D_I32(i, i));
}
BinaryEllipseDetectorPixel alg = new BinaryEllipseDetectorPixel();
alg.undistortContour(input, output);
assertEquals(input.size(), output.size);
for (int i = 0; i < input.size(); i++) {
Point2D_I32 p = input.get(i);
assertEquals(p.x, output.get(i).x, 1e-8);
assertEquals(p.y, output.get(i).y, 1e-8);
}
}
Aggregations