use of org.ddogleg.struct.DogArray in project BoofCV by lessthanoptimal.
the class TestMicroQrCodeDecoderImage method simple_rotateSquare.
/**
* Rotate the square and see if it can always decode it
*/
@Test
void simple_rotateSquare() {
MicroQrCode qr = new MicroQrCodeEncoder().addAutomatic("123LK").fixate();
GrayU8 image = render(qr);
var patterns = new DogArray<>(PositionPatternNode::new);
PositionPatternNode pp = addPositionPattern(qr, patterns);
var alg = new MicroQrCodeDecoderImage<>(null, "", GrayU8.class);
for (int i = 0; i < 4; i++) {
alg.process(patterns.toList(), image);
assertEquals(1, alg.found.size());
assertEquals(0, alg.failures.size());
assertEquals("123LK", alg.found.get(0).message);
// Rotate the polygon so that it now needs to compensate for that
UtilPolygons2D_F64.shiftDown(pp.square);
}
}
use of org.ddogleg.struct.DogArray in project BoofCV by lessthanoptimal.
the class TestMicroQrCodeDecoderImage method decode_byte.
/**
* Decode a marker with byte encoded data
*/
@Test
void decode_byte() {
MicroQrCode qr = new MicroQrCodeEncoder().addBytes("123LK%$63").fixate();
GrayU8 image = render(qr);
var patterns = new DogArray<>(PositionPatternNode::new);
addPositionPattern(qr, patterns);
var alg = new MicroQrCodeDecoderImage<>(null, "", GrayU8.class);
alg.process(patterns.toList(), image);
assertEquals(1, alg.found.size());
assertEquals(0, alg.failures.size());
assertEquals("123LK%$63", alg.found.get(0).message);
}
use of org.ddogleg.struct.DogArray in project BoofCV by lessthanoptimal.
the class GenericAssociateGreedyChecks method createData.
protected DogArray<TupleDesc_F64> createData(double... values) {
DogArray<TupleDesc_F64> ret = new DogArray<>(() -> new TupleDesc_F64(1));
ret.resize(values.length);
for (int i = 0; i < values.length; i++) {
ret.get(i).setTo(values[i]);
}
return ret;
}
use of org.ddogleg.struct.DogArray in project BoofCV by lessthanoptimal.
the class TestAssociateGreedyDesc_MT method createData.
public static DogArray<TupleDesc_F64> createData(int count) {
Random rand = new Random(234);
DogArray<TupleDesc_F64> ret = new DogArray<>(count, () -> new TupleDesc_F64(1));
for (int i = 0; i < count; i++) {
ret.grow().setTo(rand.nextDouble() * 10);
}
return ret;
}
use of org.ddogleg.struct.DogArray in project BoofCV by lessthanoptimal.
the class TestUtilFeature method setDestination_2D.
@Test
void setDestination_2D() {
var associate = new PAssociateDescriptionSets2D<>(new MockAssociateDescriptionSets2D());
var descriptors = new DogArray<>(() -> new TupleDesc_F64(1));
var locs = new DogArray<>(Point2D_F64::new);
var sets = new DogArray_I32();
for (int i = 0; i < 5; i++) {
descriptors.grow();
locs.grow();
}
sets.add(1);
sets.add(0);
sets.add(0);
sets.add(2);
sets.add(0);
associate.initializeSets(3);
UtilFeature.setDestination(descriptors, sets, locs, associate);
assertEquals(3, associate.getCountDst(0));
assertEquals(1, associate.getCountDst(1));
assertEquals(1, associate.getCountDst(2));
for (int i = 0; i < 3; i++) {
assertEquals(0, associate.getCountSrc(i));
}
}
Aggregations