code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
Double truncate(Number numberValue) {
// http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html
double doubleValue = numberValue.doubleValue();
if (truncateEnabled) {
final int exponent = Math.getExponent(doubleValue);
if (Double.isNaN(doubleValue)) {
... | java |
public static Metric toValidValue(Metric metric) {
MonitorConfig cfg = metric.getConfig();
MonitorConfig.Builder cfgBuilder = MonitorConfig.builder(toValidCharset(cfg.getName()));
for (Tag orig : cfg.getTags()) {
final String key = orig.getKey();
if (RELAXED_GROUP_KEYS.contains(key)) {
c... | java |
public static List<Metric> toValidValues(List<Metric> metrics) {
return metrics.stream().map(ValidCharacters::toValidValue).collect(Collectors.toList());
} | java |
public static void tagToJson(JsonGenerator gen, Tag tag) throws IOException {
final String key = tag.getKey();
if (RELAXED_GROUP_KEYS.contains(key)) {
gen.writeStringField(key, toValidCharsetTable(CHARS_ALLOWED_GROUPS, tag.getValue()));
} else {
gen.writeStringField(toValidCharset(tag.getKey()),... | java |
public void record(long measurement) {
lastUsed = clock.now();
if (isExpired()) {
LOGGER.info("Attempting to get the value for an expired monitor: {}."
+ "Will start computing stats again.",
getConfig().getName());
startComputingStats(executor, statsConfig.getFrequencyMillis(... | java |
@Override
public Long getValue(int pollerIndex) {
final long n = getCount(pollerIndex);
return n > 0 ? totalMeasurement.getValue(pollerIndex).longValue() / n : 0L;
} | java |
public List<V> values() {
final Collection<Entry<V>> values = map.values();
// Note below that e.value avoids updating the access time
final List<V> res = values.stream().map(e -> e.value).collect(Collectors.toList());
return Collections.unmodifiableList(res);
} | java |
public void addPoller(PollRunnable task, long delay, TimeUnit timeUnit) {
ScheduledExecutorService service = executor.get();
if (service != null) {
service.scheduleWithFixedDelay(task, 0, delay, timeUnit);
} else {
throw new IllegalStateException(
"you must start the scheduler before t... | java |
public void start() {
int numThreads = Runtime.getRuntime().availableProcessors();
ThreadFactory factory = ThreadFactories.withName("ServoPollScheduler-%d");
start(Executors.newScheduledThreadPool(numThreads, factory));
} | java |
public void stop() {
ScheduledExecutorService service = executor.get();
if (service != null && executor.compareAndSet(service, null)) {
service.shutdown();
} else {
throw new IllegalStateException("scheduler must be started before you stop it");
}
} | java |
public static String join(String separator, Iterator<?> parts) {
Preconditions.checkNotNull(separator, "separator");
Preconditions.checkNotNull(parts, "parts");
StringBuilder builder = new StringBuilder();
if (parts.hasNext()) {
builder.append(parts.next().toString());
while (parts.hasNext(... | java |
public static <T> T checkNotNull(T obj, String name) {
if (obj == null) {
String msg = String.format("parameter '%s' cannot be null", name);
throw new NullPointerException(msg);
}
return obj;
} | java |
public void update(long v) {
for (int i = 0; i < Pollers.NUM_POLLERS; ++i) {
updateMin(i, v);
}
} | java |
public long getCurrentValue(int nth) {
long v = min.getCurrent(nth).get();
return (v == Long.MAX_VALUE) ? 0L : v;
} | java |
public List<List<Metric>> getObservations() {
List<List<Metric>> builder = new ArrayList<>();
int pos = next;
for (List<Metric> ignored : observations) {
if (observations[pos] != null) {
builder.add(observations[pos]);
}
pos = (pos + 1) % observations.length;
}
return Colle... | java |
private MonitorConfig.Builder copy() {
return MonitorConfig.builder(name).withTags(tags).withPublishingPolicy(policy);
} | java |
public void update(long v) {
spectatorGauge.set(v);
for (int i = 0; i < Pollers.NUM_POLLERS; ++i) {
updateMax(i, v);
}
} | java |
public int sendAll(Iterable<Observable<Integer>> batches,
final int numMetrics, long timeoutMillis) {
final AtomicBoolean err = new AtomicBoolean(false);
final AtomicInteger updated = new AtomicInteger(0);
LOGGER.debug("Got {} ms to send {} metrics", timeoutMillis, numMetrics);
try ... | java |
public Response get(HttpClientRequest<ByteBuf> req, long timeout, TimeUnit timeUnit) {
final String uri = req.getUri();
final Response result = new Response();
try {
final Func1<HttpClientResponse<ByteBuf>, Observable<byte[]>> process = response -> {
result.status = response.getStatus().code()... | java |
public static void increment(String name, TagList list) {
final MonitorConfig config = new MonitorConfig.Builder(name).withTags(list).build();
increment(config);
} | java |
public static void increment(String name, TagList list, long delta) {
final MonitorConfig config = MonitorConfig.builder(name).withTags(list).build();
increment(config, delta);
} | java |
@Override
public Collection<Monitor<?>> getRegisteredMonitors() {
if (updatePending.getAndSet(false)) {
monitorList.set(UnmodifiableList.copyOf(monitors.values()));
}
return monitorList.get();
} | java |
public void set(Long n) {
spectatorGauge.set(n);
AtomicLong number = getNumber();
number.set(n);
} | java |
public Long getCount(int pollerIndex) {
long updates = 0;
for (Counter c : bucketCount) {
updates += c.getValue(pollerIndex).longValue();
}
updates += overflowCount.getValue(pollerIndex).longValue();
return updates;
} | java |
private TagList createTagList(ObjectName name) {
Map<String, String> props = name.getKeyPropertyList();
SmallTagMap.Builder tagsBuilder = SmallTagMap.builder();
for (Map.Entry<String, String> e : props.entrySet()) {
String key = PROP_KEY_PREFIX + "." + e.getKey();
tagsBuilder.add(Tags.newTag(key... | java |
private void addMetric(
List<Metric> metrics,
String name,
TagList tags,
Object value) {
long now = System.currentTimeMillis();
if (onlyNumericMetrics) {
value = asNumber(value);
}
if (value != null) {
TagList newTags = counters.matches(MonitorConfig.builder(name).wi... | java |
private static Number asNumber(Object value) {
Number num = null;
if (value == null) {
num = null;
} else if (value instanceof Number) {
num = (Number) value;
} else if (value instanceof Boolean) {
num = ((Boolean) value) ? 1 : 0;
}
return num;
} | java |
public static void set(String name, double value) {
set(MonitorConfig.builder(name).build(), value);
} | java |
public static void set(String name, TagList list, double value) {
final MonitorConfig config = MonitorConfig.builder(name).withTags(list).build();
set(config, value);
} | java |
private static String join(long[] a) {
assert (a.length > 0);
StringBuilder builder = new StringBuilder();
builder.append(a[0]);
for (int i = 1; i < a.length; ++i) {
builder.append(',');
builder.append(a[i]);
}
return builder.toString();
} | java |
static long[] parse(String pollers) {
String[] periods = pollers.split(",\\s*");
long[] result = new long[periods.length];
boolean errors = false;
Logger logger = LoggerFactory.getLogger(Pollers.class);
for (int i = 0; i < periods.length; ++i) {
String period = periods[i];
try {
... | java |
private List<Container> filterByVolumeAndWeight(List<Box> boxes, List<Container> containers, int count) {
long volume = 0;
long minVolume = Long.MAX_VALUE;
long weight = 0;
long minWeight = Long.MAX_VALUE;
for (Box box : boxes) {
// volume
long boxVolume = box.getVolume();
volume += boxVolume;
... | java |
public Box rotate3D() {
int height = this.height;
this.height = width;
this.width = depth;
this.depth = height;
return this;
} | java |
boolean fitRotate2D(Dimension dimension) {
if (dimension.getHeight() < height) {
return false;
}
return fitRotate2D(dimension.getWidth(), dimension.getDepth());
} | java |
protected boolean fit2D(List<Box> containerProducts, Container holder, Box usedSpace, Space freeSpace, BooleanSupplier interrupt) {
if(rotate3D) {
// minimize footprint
usedSpace.fitRotate3DSmallestFootprint(freeSpace);
}
// add used space box now, but possibly rotate later - this depends on the actual re... | java |
protected int isBetter2D(Box a, Box b) {
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
return Long.compare(b.getFootprint(), a.getFootprint()); // i.e. smaller i better
} | java |
protected int isBetter3D(Box a, Box b, Space space) {
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
// determine lowest fit
a.fitRotate3DSmallestFootprint(space);
b.fitRotate3DSmallestFootprint(space);
return Long.compare(b.getFootprint(), a.getFootprin... | java |
public void removePermutations(List<Integer> removed) {
int[] permutations = new int[this.permutations.length];
int index = 0;
permutations:
for (int j : this.permutations) {
for (int i = 0; i < removed.size(); i++) {
if(removed.get(i) == j) {
// skip this
removed.remove(i);
continue pe... | java |
public Dimension getFreeLevelSpace() {
int remainder = height - getStackHeight();
if(remainder < 0) {
throw new IllegalArgumentException("Remaining free space is negative at " + remainder + " for " + this);
}
return new Dimension(width, depth, remainder);
} | java |
public void process( List<Point3D_F64> worldPts , List<Point2D_F64> observed , Se3_F64 solutionModel )
{
if( worldPts.size() < 4 )
throw new IllegalArgumentException("Must provide at least 4 points");
if( worldPts.size() != observed.size() )
throw new IllegalArgumentException("Must have the same number of ob... | java |
private void computeResultFromBest( Se3_F64 solutionModel ) {
double bestScore = Double.MAX_VALUE;
int bestSolution=-1;
for( int i = 0; i < numControl; i++ ) {
double score = score(solutions.get(i));
if( score < bestScore ) {
bestScore = score;
bestSolution = i;
}
// System.out.println(i+" scor... | java |
private double score(double betas[]) {
UtilLepetitEPnP.computeCameraControl(betas,nullPts, solutionPts,numControl);
int index = 0;
double score = 0;
for( int i = 0; i < numControl; i++ ) {
Point3D_F64 si = solutionPts.get(i);
Point3D_F64 wi = controlWorldPts.get(i);
for( int j = i+1; j < numControl; ... | java |
public void selectWorldControlPoints(List<Point3D_F64> worldPts, FastQueue<Point3D_F64> controlWorldPts) {
UtilPoint3D_F64.mean(worldPts,meanWorldPts);
// covariance matrix elements, summed up here for speed
double c11=0,c12=0,c13=0,c22=0,c23=0,c33=0;
final int N = worldPts.size();
for( int i = 0; i < N; i... | java |
protected static void constructM(List<Point2D_F64> obsPts,
DMatrixRMaj alphas, DMatrixRMaj M)
{
int N = obsPts.size();
M.reshape(3*alphas.numCols,2*N,false);
for( int i = 0; i < N; i++ ) {
Point2D_F64 p2 = obsPts.get(i);
int row = i*2;
for( int j = 0; j < alphas.numCols; j++ ) {
int col... | java |
protected double matchScale( List<Point3D_F64> nullPts ,
FastQueue<Point3D_F64> controlWorldPts ) {
Point3D_F64 meanNull = UtilPoint3D_F64.mean(nullPts,numControl,null);
Point3D_F64 meanWorld = UtilPoint3D_F64.mean(controlWorldPts.toList(),numControl,null);
// compute the ratio of distance between worl... | java |
private double adjustBetaSign( double beta , List<Point3D_F64> nullPts ) {
if( beta == 0 )
return 0;
int N = alphas.numRows;
int positiveCount = 0;
for( int i = 0; i < N; i++ ) {
double z = 0;
for( int j = 0; j < numControl; j++ ) {
Point3D_F64 c = nullPts.get(j);
z += alphas.get(i,j)*c.z;
... | java |
protected void estimateCase1( double betas[] ) {
betas[0] = matchScale(nullPts[0], controlWorldPts);
betas[0] = adjustBetaSign(betas[0],nullPts[0]);
betas[1] = 0; betas[2] = 0; betas[3] = 0;
} | java |
protected void estimateCase3_planar( double betas[] ) {
relinearizeBeta.setNumberControl(3);
relinearizeBeta.process(L_full,y,betas);
refine(betas);
} | java |
private void gaussNewton( double betas[] ) {
A_temp.reshape(L_full.numRows, numControl);
v_temp.reshape(L_full.numRows, 1);
x.reshape(numControl,1,false);
// don't check numControl inside in hope that the JVM can optimize the code better
if( numControl == 4 ) {
for( int i = 0; i < numIterations; i++ ) {
... | java |
public QrCodeEncoder addAutomatic(String message) {
// very simple coding algorithm. Doesn't try to compress by using multiple formats
if(containsKanji(message)) {
// split into kanji and non-kanji segments
int start = 0;
boolean kanji = isKanji(message.charAt(0));
for (int i = 0; i < message.length(); ... | java |
public QrCodeEncoder addAlphanumeric(String alphaNumeric) {
byte values[] = alphanumericToValues(alphaNumeric);
MessageSegment segment = new MessageSegment();
segment.message = alphaNumeric;
segment.data = values;
segment.length = values.length;
segment.mode = QrCode.Mode.ALPHANUMERIC;
segment.encodedSi... | java |
public QrCodeEncoder addBytes(byte[] data) {
StringBuilder builder = new StringBuilder(data.length);
for (int i = 0; i < data.length; i++) {
builder.append((char)data[i]);
}
MessageSegment segment = new MessageSegment();
segment.message = builder.toString();
segment.data = data;
segment.length = data.... | java |
public QrCodeEncoder addKanji(String message) {
byte[] bytes;
try {
bytes = message.getBytes("Shift_JIS");
} catch (UnsupportedEncodingException ex) {
throw new IllegalArgumentException(ex);
}
MessageSegment segment = new MessageSegment();
segment.message = message;
segment.data = bytes;
segment.... | java |
private static int getLengthBits(int version, int bitsA, int bitsB, int bitsC) {
int lengthBits;
if (version < 10)
lengthBits = bitsA;
else if (version < 27)
lengthBits = bitsB;
else
lengthBits = bitsC;
return lengthBits;
} | java |
public QrCode fixate() {
autoSelectVersionAndError();
// sanity check of code
int expectedBitSize = bitsAtVersion(qr.version);
qr.message = "";
for( MessageSegment m : segments ) {
qr.message += m.message;
switch( m.mode ) {
case NUMERIC:encodeNumeric(m.data,m.length);break;
case ALPHANUMERIC:... | java |
static QrCodeMaskPattern selectMask( QrCode qr ) {
int N = qr.getNumberOfModules();
int totalBytes = QrCode.VERSION_INFO[qr.version].codewords;
List<Point2D_I32> locations = QrCode.LOCATION_BITS[qr.version];
QrCodeMaskPattern bestMask = null;
double bestScore = Double.MAX_VALUE;
PackedBits8 bits = new Pac... | java |
static void detectAdjacentAndPositionPatterns(int N, QrCodeCodeWordLocations matrix, FoundFeatures features) {
for (int foo = 0; foo < 2; foo++) {
for (int row = 0; row < N; row++) {
int index = row * N;
for (int col = 1; col < N; col++, index++) {
if (matrix.data[index] == matrix.data[index + 1])
... | java |
private int bitsAtVersion( int version ) {
int total = 0;
for (int i = 0; i < segments.size(); i++) {
total += segments.get(i).sizeInBits(version);
}
return total;
} | java |
public boolean process(DMatrixRMaj F21 ,
double x1 , double y1, double x2, double y2,
Point2D_F64 p1 , Point2D_F64 p2 )
{
// translations used to move points to the origin
assignTinv(T1,x1,y1);
assignTinv(T2,x2,y2);
// take F to the new coordinate system
// F1 = T2'*F*T1
PerspectiveOps.m... | java |
public static boolean convert( LineGeneral2D_F64[] lines , Polygon2D_F64 poly ) {
for (int i = 0; i < poly.size(); i++) {
int j = (i + 1) % poly.size();
if( null == Intersection2D_F64.intersection(lines[i], lines[j], poly.get(j)) )
return false;
}
return true;
} | java |
public static void process(GrayU8 orig, GrayF32 deriv) {
deriv.reshape(orig.width,orig.height);
if( BoofConcurrency.USE_CONCURRENT ) {
DerivativeLaplacian_Inner_MT.process(orig,deriv);
} else {
DerivativeLaplacian_Inner.process(orig,deriv);
}
// if( border != null ) {
// border.setImage(orig);
// C... | java |
public void process( List<List<SquareNode>> clusters ) {
grids.reset();
for (int i = 0; i < clusters.size(); i++) {
if( checkPreconditions(clusters.get(i)))
processCluster(clusters.get(i));
}
} | java |
protected boolean checkPreconditions(List<SquareNode> cluster) {
for( int i = 0; i < cluster.size(); i++ ) {
SquareNode n = cluster.get(i);
for (int j = 0; j < n.square.size(); j++) {
SquareEdge e0 = n.edges[j];
if( e0 == null)
continue;
for (int k = j+1; k < n.square.size(); k++) {
Square... | java |
protected void processCluster( List<SquareNode> cluster ) {
invalid = false;
// handle a special case
if( cluster.size() == 1 ) {
SquareNode n = cluster.get(0);
if( n.getNumberOfConnections() == 0 ) {
SquareGrid grid = grids.grow();
grid.reset();
grid.columns = grid.rows = 1;
grid.nodes.add(... | java |
private SquareGrid assembleGrid( List<List<SquareNode>> listRows) {
SquareGrid grid = grids.grow();
grid.reset();
List<SquareNode> row0 = listRows.get(0);
List<SquareNode> row1 = listRows.get(1);
int offset = row0.get(0).getNumberOfConnections() == 1 ? 0 : 1;
grid.columns = row0.size() + row1.size();
g... | java |
private boolean checkEdgeCount( SquareGrid grid ) {
int left = 0, right = grid.columns-1;
int top = 0, bottom = grid.rows-1;
for (int row = 0; row < grid.rows; row++) {
boolean skip = grid.get(row,0) == null;
for (int col = 0; col < grid.columns; col++) {
SquareNode n = grid.get(row,col);
if( ski... | java |
List<SquareNode> firstRow1( SquareNode seed ) {
for (int i = 0; i < seed.square.size(); i++) {
if( isOpenEdge(seed,i) ) {
List<SquareNode> list = new ArrayList<>();
seed.graph = 0;
// Doesn't know which direction it can traverse along. See figure that out
// by looking at the node its linked to
... | java |
List<SquareNode> firstRow2(SquareNode seed ) {
int indexLower = lowerEdgeIndex(seed);
int indexUpper = addOffset(indexLower,1,seed.square.size());
List<SquareNode> listDown = new ArrayList<>();
List<SquareNode> list = new ArrayList<>();
if( !addToRow(seed,indexUpper,1,true,listDown) ) return null;
flipAdd... | java |
static int lowerEdgeIndex( SquareNode node ) {
for (int i = 0; i < node.square.size(); i++) {
if( isOpenEdge(node,i) ) {
int next = addOffset(i,1,node.square.size());
if( isOpenEdge(node,next)) {
return i;
}
if( i == 0 ) {
int previous = node.square.size()-1;
if( isOpenEdge(node,prev... | java |
static boolean isOpenEdge( SquareNode node , int index ) {
if( node.edges[index] == null )
return false;
int marker = node.edges[index].destination(node).graph;
return marker == SquareNode.RESET_GRAPH;
} | java |
boolean addToRow( SquareNode n , int corner , int sign , boolean skip ,
List<SquareNode> row ) {
SquareEdge e;
while( (e = n.edges[corner]) != null ) {
if( e.a == n ) {
n = e.b;
corner = e.sideB;
} else {
n = e.a;
corner = e.sideA;
}
if( !skip ) {
if( n.graph != SquareNode.R... | java |
static SquareNode findSeedNode(List<SquareNode> cluster) {
SquareNode seed = null;
for (int i = 0; i < cluster.size(); i++) {
SquareNode n = cluster.get(i);
int numConnections = n.getNumberOfConnections();
if( numConnections == 0 || numConnections > 2 )
continue;
seed = n;
break;
}
return se... | java |
public void process( GrayF32 input ) {
// System.out.println("ENTER CHESSBOARD CORNER "+input.width+" x "+input.height);
borderImg.setImage(input);
gradient.process(input,derivX,derivY);
interpX.setImage(derivX);
interpY.setImage(derivY);
cornerIntensity.process(derivX,derivY,intensity);
intensityInterp.... | java |
public void meanShiftLocation( ChessboardCorner c ) {
float meanX = (float)c.x;
float meanY = (float)c.y;
// The peak in intensity will be in -r to r region, but smaller values will be -2*r to 2*r
int radius = this.shiRadius*2;
for (int iteration = 0; iteration < 5; iteration++) {
float adjX = 0;
float... | java |
public void setThreadPoolSize( int threads ) {
if( threads <= 0 )
throw new IllegalArgumentException("Number of threads must be greater than 0");
if( verbose )
Log.i(TAG,"setThreadPoolSize("+threads+")");
threadPool.setCorePoolSize(threads);
threadPool.setMaximumPoolSize(threads);
} | java |
@Override
protected int selectResolution( int widthTexture, int heightTexture, Size[] resolutions ) {
// just wanted to make sure this has been cleaned up
timeOfLastUpdated = 0;
// select the resolution here
int bestIndex = -1;
double bestAspect = Double.MAX_VALUE;
double bestArea = 0;
for( int i = 0;... | java |
protected void setImageType( ImageType type , ColorFormat colorFormat ) {
synchronized (boofImage.imageLock){
boofImage.colorFormat = colorFormat;
if( !boofImage.imageType.isSameType( type ) ) {
boofImage.imageType = type;
boofImage.stackImages.clear();
}
synchronized (lockTiming) {
totalConv... | java |
protected void renderBitmapImage( BitmapMode mode , ImageBase image ) {
switch( mode ) {
case UNSAFE: {
if (image.getWidth() == bitmap.getWidth() && image.getHeight() == bitmap.getHeight())
ConvertBitmap.boofToBitmap(image, bitmap, bitmapTmp);
} break;
case DOUBLE_BUFFER: {
// TODO if there are... | java |
protected void onDrawFrame( SurfaceView view , Canvas canvas ) {
// Code below is usefull when debugging display issues
// Paint paintFill = new Paint();
// paintFill.setColor(Color.RED);
// paintFill.setStyle(Paint.Style.FILL);
// Paint paintBorder = new Paint();
// paintBorder.setColor(Color.BLUE);
// paintB... | java |
public static <I extends ImageGray<I>, D extends ImageGray<D>>
GeneralFeatureIntensity<I,D> median( int radius , Class<I> imageType ) {
BlurStorageFilter<I> filter = FactoryBlurFilter.median(ImageType.single(imageType),radius);
return new WrapperMedianCornerIntensity<>(filter);
} | java |
public static <I extends ImageGray<I>, D extends ImageGray<D>>
GeneralFeatureIntensity<I,D> hessian(HessianBlobIntensity.Type type, Class<D> derivType) {
return new WrapperHessianBlobIntensity<>(type, derivType);
} | java |
@Override
public List<PointTrack> getInactiveTracks(List<PointTrack> list) {
if( list == null )
list = new ArrayList<>();
return list;
} | java |
@Override
protected void horizontal() {
float[] dataX = derivX.data;
float[] dataY = derivY.data;
float[] hXX = horizXX.data;
float[] hXY = horizXY.data;
float[] hYY = horizYY.data;
final int imgHeight = derivX.getHeight();
final int imgWidth = derivX.getWidth();
int windowWidth = radius * 2 + 1;
... | java |
@Override
protected void vertical( GrayF32 intensity ) {
float[] hXX = horizXX.data;
float[] hXY = horizXY.data;
float[] hYY = horizYY.data;
final float[] inten = intensity.data;
final int imgHeight = horizXX.getHeight();
final int imgWidth = horizXX.getWidth();
final int kernelWidth = radius * 2 + 1;
... | java |
public static <Input extends ImageGray<Input>,Output extends ImageGray<Output>>
void distortSingle(Input input, Output output,
PixelTransform<Point2D_F32> transform,
InterpolationType interpType, BorderType borderType)
{
boolean skip = borderType == BorderType.SKIP;
if( skip )
borderType = Bord... | java |
public static <Input extends ImageGray<Input>,Output extends ImageGray<Output>>
void distortSingle(Input input, Output output,
boolean renderAll, PixelTransform<Point2D_F32> transform,
InterpolatePixelS<Input> interp)
{
Class<Output> inputType = (Class<Output>)input.getClass();
ImageDistort<Input,... | java |
@Deprecated
public static <T extends ImageBase<T>>
void scale(T input, T output, BorderType borderType, InterpolationType interpType) {
PixelTransformAffine_F32 model = DistortSupport.transformScale(output, input, null);
if( input instanceof ImageGray) {
distortSingle((ImageGray) input, (ImageGray) output, m... | java |
public static RectangleLength2D_I32 boundBox( int srcWidth , int srcHeight ,
int dstWidth , int dstHeight ,
Point2D_F32 work,
PixelTransform<Point2D_F32> transform )
{
RectangleLength2D_I32 ret = boundBox(srcWidth,srcHeight,work,transform);
int x0 = ret.x0;
int y0 = ret... | java |
public boolean update( Image input , RectangleRotate_F64 output ) {
if( trackLost )
return false;
trackFeatures(input, region);
// See if there are enough points remaining. use of config.numberOfSamples is some what arbitrary
if( pairs.size() < config.numberOfSamples ) {
System.out.println("Lack of sa... | java |
private void trackFeatures(Image input, RectangleRotate_F64 region) {
pairs.reset();
currentImage.process(input);
for( int i = 0; i < currentImage.getNumLayers(); i++ ) {
Image layer = currentImage.getLayer(i);
gradient.process(layer,currentDerivX[i],currentDerivY[i]);
}
// convert to float to avoid e... | java |
private void declarePyramid( int imageWidth , int imageHeight ) {
int minSize = (config.trackerFeatureRadius*2+1)*5;
int scales[] = TldTracker.selectPyramidScale(imageWidth, imageHeight, minSize);
currentImage = FactoryPyramid.discreteGaussian(scales,-1,1,false, ImageType.single(imageType));
currentImage.initia... | java |
private void swapImages() {
ImagePyramid<Image> tempP;
tempP = currentImage;
currentImage = previousImage;
previousImage = tempP;
Derivative[] tempD;
tempD = previousDerivX;
previousDerivX = currentDerivX;
currentDerivX = tempD;
tempD = previousDerivY;
previousDerivY = currentDerivY;
currentDe... | java |
public void invalidateAll() {
int N = width*height;
for( int i = 0; i < N; i++ )
data[i].x = Float.NaN;
} | java |
public boolean process(EllipseRotated_F64 ellipse ) {
// see if it's disabled
if( numContourPoints <= 0 ) {
score = 0;
return true;
}
double cphi = Math.cos(ellipse.phi);
double sphi = Math.sin(ellipse.phi);
averageInside = 0;
averageOutside = 0;
int total = 0;
for (int contourIndex = 0; con... | java |
public void setImage(GrayF32 image) {
scaleSpace.initialize(image);
usedScales.clear();
do {
for (int i = 0; i < scaleSpace.getNumScales(); i++) {
GrayF32 scaleImage = scaleSpace.getImageScale(i);
double sigma = scaleSpace.computeSigmaScale(i);
double pixelCurrentToInput = scaleSpace.pixelScaleCu... | java |
public ImageScale lookup( double sigma ) {
ImageScale best = null;
double bestValue = Double.MAX_VALUE;
for (int i = 0; i < usedScales.size(); i++) {
ImageScale image = usedScales.get(i);
double difference = Math.abs(sigma-image.sigma);
if( difference < bestValue ) {
bestValue = difference;
best... | java |
public void setModel( BundleAdjustmentCamera model ) {
this.model = model;
numIntrinsic = model.getIntrinsicCount();
if( numIntrinsic > intrinsic.length ) {
intrinsic = new double[numIntrinsic];
}
model.getIntrinsic(intrinsic,0);
numericalPoint = createNumericalAlgorithm(funcPoint);
numericalIntrinsic... | java |
@Override
public void associate( FastQueue<D> src , FastQueue<D> dst )
{
fitQuality.reset();
pairs.reset();
workBuffer.reset();
pairs.resize(src.size);
fitQuality.resize(src.size);
workBuffer.resize(src.size*dst.size);
//CONCURRENT_BELOW BoofConcurrency.loopFor(0, src.size, i -> {
for( int i = 0; i ... | java |
public boolean process(T image , QrCode qr ) {
this.qr = qr;
// this must be cleared before calling setMarker or else the distortion will be messed up
qr.alignment.reset();
reader.setImage(image);
reader.setMarker(qr);
threshold = (float)qr.threshCorner;
initializePatterns(qr);
// version 1 has no a... | java |
void initializePatterns(QrCode qr) {
int where[] = QrCode.VERSION_INFO[qr.version].alignment;
qr.alignment.reset();
lookup.reset();
for (int row = 0; row < where.length; row++ ) {
for (int col = 0; col < where.length; col++) {
boolean skip = false;
if( row == 0 && col == 0 )
skip = true;
els... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.