code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Override
public void getCenter(int which, Point2D_F64 location) {
CalibrationObservation view = detector.getDetectedPoints();
location.set(0,0);
for (int i = 0; i < view.size(); i++) {
PointIndex2D_F64 p = view.get(i);
location.x += p.x;
location.y += p.y;
}
location.x /= view.size();
location.... | java |
public void setConstraints( boolean zeroSkew ,
boolean principlePointOrigin ,
boolean knownAspect,
double aspect )
{
if( knownAspect && !zeroSkew )
throw new IllegalArgumentException("If aspect is known then skew must be zero");
this.zeroSkew = zeroSkew;
this.principlePointOrigin = pr... | java |
void extractReferenceW(DMatrixRMaj nv ) {
W0.a11 = nv.data[0];
W0.a12 = W0.a21 = nv.data[1];
W0.a13 = W0.a31 = nv.data[2];
W0.a22 = nv.data[3];
W0.a23 = W0.a32 = nv.data[4];
W0.a33 = nv.data[5];
} | java |
void convertW( Homography2D_F64 w , CameraPinhole c ) {
// inv(w) = K*K'
tmp.set(w);
CommonOps_DDF3.divide(tmp,tmp.a33);
CommonOps_DDF3.cholU(tmp);
CommonOps_DDF3.invert(tmp,K);
CommonOps_DDF3.divide(K,K.a33);
c.fx = K.a11;
c.fy = knownAspectRatio ? (K.a22 + c.fx*aspectRatio)/2.0 : K.a22;
c.skew = ze... | java |
void extractCalibration( Homography2D_F64 Hinv , CameraPinhole c ) {
CommonOps_DDF3.multTransA(Hinv,W0,tmp);
CommonOps_DDF3.mult(tmp,Hinv,Wi);
convertW(Wi,c);
} | java |
public boolean computeInverseH(List<Homography2D_F64> homography0toI) {
listHInv.reset();
int N = homography0toI.size();
for (int i = 0; i < N; i++) {
Homography2D_F64 H = homography0toI.get(i);
Homography2D_F64 Hinv = listHInv.grow();
// Ensure the determinant is one
double d = CommonOps_DDF3.det(H)... | java |
protected void startCameraTexture( TextureView view ) {
if( verbose )
Log.i(TAG,"startCamera(TextureView="+(view!=null)+")");
this.mTextureView = view;
this.mView = null;
this.mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
} | java |
protected void configureCamera( CameraDevice device ,
CameraCharacteristics characteristics,
CaptureRequest.Builder captureRequestBuilder ) {
if( verbose )
Log.i(TAG,"configureCamera() default function");
captureRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_C... | java |
protected boolean selectCamera( String id , CameraCharacteristics characteristics ) {
if( verbose )
Log.i(TAG,"selectCamera() default function");
Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING);
return facing == null || facing != CameraCharacteristics.LENS_FACING_FRONT;
} | java |
protected void reopenCameraAtResolution(int cameraWidth, int cameraHeight) {
if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
throw new RuntimeException("Attempted to reopenCameraAtResolution main looper thread!");
}
boolean releaseLock = true;
open.mLock.lock();
try {
if (verbose)
... | java |
protected boolean closeCamera() {
if( verbose )
Log.i(TAG,"closeCamera() activity="+getClass().getSimpleName());
if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
throw new RuntimeException("Attempted to close camera not on the main looper thread!");
}
boolean closed = false;
// if( v... | java |
private void startPreview() {
// Sanity check. Parts of this code assume it's on this thread. If it has been put into a handle
// that's fine just be careful nothing assumes it's on the main looper
if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
throw new RuntimeException("Not on main loope... | java |
public void cameraIntrinsicNominal(CameraPinhole intrinsic ) {
open.mLock.lock();
try {
// This might be called before the camera is open
if (open.mCameraCharacterstics != null) {
SizeF physicalSize = open.mCameraCharacterstics.get(CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE);
Rect activeSize = op... | java |
private float displayDensityAdjusted() {
open.mLock.lock();
try {
if (open.mCameraSize == null)
return displayMetrics.density;
int rotation = getWindowManager().getDefaultDisplay().getRotation();
int screenWidth = (rotation == 0 || rotation == 2) ? displayMetrics.widthPixels : displayMetrics.heightPix... | java |
public static <T extends ImageGray<T>> StereoDisparitySparse<T>
regionSparseWta( int minDisparity , int maxDisparity,
int regionRadiusX, int regionRadiusY ,
double maxPerPixelError ,
double texture ,
boolean subpixelInterpolation ,
Class<T> imageType ) {
double maxError = (regionRadius... | java |
public void addPoint( float x , float y , float z ) {
norm.grow().set(x/z, y/z);
} | java |
public void process() {
computeCovarince();
float eigenvalue = smallestEigenvalue();
// eigenvalue is the variance, convert to standard deviation
double stdev = Math.sqrt(eigenvalue);
// System.out.println("stdev "+stdev+" total "+norm.size()+" mean "+meanX+" "+meanY);
// approximate the spread in by d... | java |
public static ClassifierAndSource vgg_cifar10() {
List<String> sources = new ArrayList<>();
sources.add( "http://boofcv.org/notwiki/largefiles/likevgg_cifar10.zip" );
ClassifierAndSource ret = new ClassifierAndSource();
ret.data0 = new ImageClassifierVggCifar10();
ret.data1 = sources;
return ret;
} | java |
public static ClassifierAndSource nin_imagenet() {
List<String> sources = new ArrayList<>();
sources.add( "http://boofcv.org/notwiki/largefiles/nin_imagenet.zip" );
ClassifierAndSource ret = new ClassifierAndSource();
ret.data0 = new ImageClassifierNiNImageNet();
ret.data1 = sources;
return ret;
} | java |
public Exit launch( Class mainClass , String ...args ) {
jvmArgs = configureArguments(mainClass,args);
try {
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(jvmArgs);
// If it exits too quickly it might not get any error messages if it crashes right away
... | java |
private boolean monitorSlave(Process pr,
BufferedReader input, BufferedReader error)
throws IOException, InterruptedException {
// flush the input buffer
System.in.skip(System.in.available());
// If the total amount of time allocated to the slave ex... | java |
protected void computeWeightBlockPixels() {
int rows = cellsPerBlockY*pixelsPerCell;
int cols = cellsPerBlockX*pixelsPerCell;
weights = new double[ rows*cols ];
double offsetRow=0,offsetCol=0;
int radiusRow=rows/2,radiusCol=cols/2;
if( rows%2 == 0 ) {
offsetRow = 0.5;
}
if( cols%2 == 0 ) {
offs... | java |
private void computePixelFeatures() {
for (int y = 0; y < derivX.height; y++) {
int pixelIndex = y*derivX.width;
int endIndex = pixelIndex+derivX.width;
for (; pixelIndex < endIndex; pixelIndex++ ) {
float dx = derivX.data[pixelIndex];
float dy = derivY.data[pixelIndex];
// angle from 0 to pi ra... | java |
void addToHistogram(int cellX, int cellY, int orientationIndex, double magnitude) {
// see if it's being applied to a valid cell in the histogram
if( cellX < 0 || cellX >= cellsPerBlockX)
return;
if( cellY < 0 || cellY >= cellsPerBlockY)
return;
int index = (cellY*cellsPerBlockX + cellX)*orientationBins ... | java |
public void setInput(float x[], float y[], int size) {
if (x.length < size || y.length < size) {
throw new IllegalArgumentException("Arrays too small for size.");
}
if (size < M) {
throw new IllegalArgumentException("Not enough data points for M");
}
this.x = x;
this.y = y;
this.size = size;
this... | java |
public float process(float testX) {
if (doHunt) {
hunt(testX);
} else {
bisectionSearch(testX, 0, size - 1);
}
return compute(testX);
} | java |
protected void hunt(float val) {
int lowerLimit = center;
int upperLimit;
int inc = 1;
if (val >= x[lowerLimit] && ascend) {
// hunt up
for (; ; ) {
upperLimit = lowerLimit + inc;
// see if it is outside the table
if (upperLimit >= size - 1) {
upperLimit = size - 1;
break;
} els... | java |
public static void process( GrayI orig,
GrayI derivX,
GrayI derivY) {
final int width = orig.getWidth();
final int height = orig.getHeight();
for (int y = 1; y < height - 1; y++) {
for (int x = 1; x < width - 1; x++) {
int dy = -(orig.get(x - 1, y - 1) + 2 * orig.get(x, y - 1) + orig.get... | java |
public static <T extends ImageBase<T>>
void performSegmentation( ImageSuperpixels<T> alg , T color )
{
// Segmentation often works better after blurring the image. Reduces high frequency image components which
// can cause over segmentation
GBlurImageOps.gaussian(color, color, 0.5, -1, null);
// Storage for... | java |
public static <T extends ImageBase<T>>
void visualize(GrayS32 pixelToRegion , T color , int numSegments )
{
// Computes the mean color inside each region
ImageType<T> type = color.getImageType();
ComputeRegionMeanColor<T> colorize = FactorySegmentationAlg.regionMeanColor(type);
FastQueue<float[]> segmentCol... | java |
public static GrayU8 denseDisparity(GrayU8 rectLeft , GrayU8 rectRight ,
int regionSize,
int minDisparity , int maxDisparity )
{
// A slower but more accuracy algorithm is selected
// All of these parameters should be turned
StereoDisparity<GrayU8,GrayU8> disparityAlg =
FactoryStereoDispa... | java |
public static GrayF32 denseDisparitySubpixel(GrayU8 rectLeft , GrayU8 rectRight ,
int regionSize ,
int minDisparity , int maxDisparity )
{
// A slower but more accuracy algorithm is selected
// All of these parameters should be turned
StereoDisparity<GrayU8,GrayF32> disparityAlg =
F... | java |
public static RectifyCalibrated rectify(GrayU8 origLeft , GrayU8 origRight ,
StereoParameters param ,
GrayU8 rectLeft , GrayU8 rectRight )
{
// Compute rectification
RectifyCalibrated rectifyAlg = RectifyImageOps.createCalibrated();
Se3_F64 leftToRight = param.getRightToLeft().invert(null);... | java |
public boolean isRangeSet() {
for (int i = 0; i < getDimensions(); i++) {
if( valueMin[i] == 0 && valueMax[i] == 0 ) {
return false;
}
}
return true;
} | java |
public void setRange( int dimension , double min , double max ) {
valueMin[dimension] = min;
valueMax[dimension] = max;
} | java |
public int getDimensionIndex( int dimension , int value ) {
double min = valueMin[dimension];
double max = valueMax[dimension];
double fraction = ((value-min)/(max-min+1.0));
return (int)(fraction*length[dimension]);
} | java |
public final int getIndex( int coordinate[] ) {
int index = coordinate[0]*strides[0];
for (int i = 1; i < coordinate.length; i++) {
index += strides[i]*coordinate[i];
}
return index;
} | java |
public Histogram_F64 copy() {
Histogram_F64 out = newInstance();
System.arraycopy(value,0,out.value,0,length.length);
return out;
} | java |
@Override
public boolean refine(Polygon2D_F64 input, Polygon2D_F64 output)
{
if( input.size() != output.size())
throw new IllegalArgumentException("Input and output sides do not match. "+input.size()+" "+output.size());
// sanity check input. If it's too small this algorithm won't work
if( checkShapeTooSma... | java |
private boolean checkShapeTooSmall(Polygon2D_F64 input) {
// must be longer than the border plus some small fudge factor
double minLength = cornerOffset*2 + 2;
for (int i = 0; i < input.size(); i++) {
int j = (i+1)%input.size();
Point2D_F64 a = input.get(i);
Point2D_F64 b = input.get(j);
if( a.distanc... | java |
protected boolean optimize(Polygon2D_F64 seed , Polygon2D_F64 current ) {
previous.set(seed);
// pixels squares is faster to compute
double convergeTol = convergeTolPixels*convergeTolPixels;
// initialize the lines since they are used to check for corner divergence
for (int i = 0; i < seed.size(); i++) {
... | java |
protected boolean optimize( Point2D_F64 a , Point2D_F64 b , LineGeneral2D_F64 found ) {
computeAdjustedEndPoints(a, b);
return snapToEdge.refine(adjA, adjB, found);
} | java |
public static BufferedImage watersheds(GrayS32 segments , BufferedImage output , int radius ) {
if( output == null )
output = new BufferedImage(segments.width,segments.height,BufferedImage.TYPE_INT_RGB);
if( radius <= 0 ) {
for (int y = 0; y < segments.height; y++) {
for (int x = 0; x < segments.width; x... | java |
public static BufferedImage regions(GrayS32 pixelToRegion , int numRegions , BufferedImage output ) {
return VisualizeBinaryData.renderLabeled(pixelToRegion,numRegions,output);
} | java |
private static void randomGaussian( Random rand , double sigma , int radius , Point2D_I32 pt ) {
int x,y;
while( true ) {
x = (int)(rand.nextGaussian()*sigma);
y = (int)(rand.nextGaussian()*sigma);
if( Math.sqrt(x*x + y*y) < radius )
break;
}
pt.set(x,y);
} | java |
public static <T extends ImageBase<T>>
PyramidDiscrete<T> discreteGaussian( int[] scaleFactors , double sigma , int radius ,
boolean saveOriginalReference, ImageType<T> imageType )
{
Class<Kernel1D> kernelType = FactoryKernel.getKernelType(imageType.getDataType(),1);
Kernel1D kernel = FactoryKernelGau... | java |
public static <T extends ImageGray<T>>
PyramidFloat<T> floatGaussian( double scaleFactors[], double []sigmas , Class<T> imageType ) {
InterpolatePixelS<T> interp = FactoryInterpolation.bilinearPixelS(imageType, BorderType.EXTENDED);
return new PyramidFloatGaussianScale<>(interp, scaleFactors, sigmas, imageType);... | java |
public static double process_F64(double sample, double x[], double y[], int i0, int i1) {
double result = 0;
for (int i = i0; i <= i1; i++) {
double numerator = 1.0;
for (int j = i0; j <= i1; j++) {
if (i != j)
numerator *= sample - x[j];
}
double denominator = 1.0;
double a = x[i];
... | java |
public void add( Color color , Point3D_F64... polygon ) {
final Poly p = new Poly(polygon.length,color);
for( int i = 0; i < polygon.length; i++ )
p.pts[i] = polygon[i].copy();
synchronized (polygons) {
polygons.add( p );
}
} | java |
public static BufferedImage checkDeclare( int width , int height , BufferedImage image , int type ) {
if( image == null )
return new BufferedImage(width,height,type);
if( image.getType() != type )
return new BufferedImage(width,height,type);
if( image.getWidth() != width || image.getHeight() != height )
... | java |
public static BufferedImage checkCopy( BufferedImage original , BufferedImage output ) {
ColorModel cm = original.getColorModel();
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
if( output == null || original.getWidth() != output.getWidth() || original.getHeight() != output.getHeight() ||
original... | java |
public static BufferedImage stripAlphaChannel( BufferedImage image ) {
int numBands = image.getRaster().getNumBands();
if( numBands == 4 ) {
BufferedImage output = new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_INT_RGB);
output.createGraphics().drawImage(image,0,0,null);
return ou... | java |
public static InterleavedU8 extractInterleavedU8(BufferedImage img) {
DataBuffer buffer = img.getRaster().getDataBuffer();
if (buffer.getDataType() == DataBuffer.TYPE_BYTE && isKnownByteFormat(img) ) {
WritableRaster raster = img.getRaster();
InterleavedU8 ret = new InterleavedU8();
ret.width = img.getW... | java |
public static GrayU8 extractGrayU8(BufferedImage img) {
WritableRaster raster = img.getRaster();
DataBuffer buffer = raster.getDataBuffer();
if (buffer.getDataType() == DataBuffer.TYPE_BYTE && isKnownByteFormat(img) ) {
if (raster.getNumBands() != 1)
throw new IllegalArgumentException("Input image has mor... | java |
public static <T extends ImageGray<T>> T convertFromSingle(BufferedImage src, T dst, Class<T> type) {
if (type == GrayU8.class) {
return (T) convertFrom(src, (GrayU8) dst);
} else if( GrayI16.class.isAssignableFrom(type) ) {
return (T) convertFrom(src, (GrayI16) dst,(Class)type);
} else if (type == GrayF32.... | java |
public static BufferedImage convertTo(JComponent comp, BufferedImage storage) {
if (storage == null)
storage = new BufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = storage.createGraphics();
comp.paintComponents(g2);
return storage;
} | java |
public static Planar orderBandsIntoBuffered(Planar src, BufferedImage dst) {
// see if no change is required
if( dst.getType() == BufferedImage.TYPE_INT_RGB )
return src;
Planar tmp = new Planar(src.type, src.getNumBands());
tmp.width = src.width;
tmp.height = src.height;
tmp.stride = src.stride;
tmp.... | java |
public static double computeError(GrayF32 imgA, GrayF32 imgB ) {
final int h = imgA.getHeight();
final int w = imgA.getWidth();
double total = 0;
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
double difference = Math.abs(imgA.get(x,y)-imgB.get(x,y));
total += difference;
}
}
... | java |
public static double computeWeightedError(GrayF32 imgA, GrayF32 imgB ,
GrayF32 imgWeight ) {
final int h = imgA.getHeight();
final int w = imgA.getWidth();
double total = 0;
double totalWeight = 0;
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
float weight = imgWeight.get(x... | java |
private static boolean nearBorder( Point2D_F64 p , StitchingFromMotion2D<?,?> stitch ) {
int r = 10;
if( p.x < r || p.y < r )
return true;
if( p.x >= stitch.getStitchedImage().width-r )
return true;
if( p.y >= stitch.getStitchedImage().height-r )
return true;
return false;
} | java |
public void setShape(double width , double height ) {
points2D3D.get(0).location.set(-width/2,-height/2,0);
points2D3D.get(1).location.set(-width/2, height/2,0);
points2D3D.get(2).location.set( width/2, height/2,0);
points2D3D.get(3).location.set( width/2,-height/2,0);
} | java |
public void computeStability(Se3_F64 targetToCamera ,
double disturbance,
FiducialStability results) {
targetToCamera.invert(referenceCameraToTarget);
maxOrientation = 0;
maxLocation = 0;
Point3D_F64 cameraPt = new Point3D_F64();
for (int i = 0; i < points2D3D.size(); i++) {
Point2D3D ... | java |
private void perturb(double disturbance , Point2D_F64 pixel , Point2D3D p23 ) {
double x;
double y = pixel.y;
x = pixel.x + disturbance;
computeDisturbance( x,y, p23);
x = pixel.x - disturbance;
computeDisturbance( x,y, p23);
x = pixel.x;
y = pixel.y + disturbance;
computeDisturbance( x,y, p23);
y ... | java |
public static<T extends ImageGray<T>, D extends ImageGray<D>>
void detectLines( BufferedImage image ,
Class<T> imageType ,
Class<D> derivType )
{
// convert the line into a single band image
T input = ConvertBufferedImage.convertFromSingle(image, null, imageType );
// Comment/uncomment to ... | java |
public static<T extends ImageGray<T>, D extends ImageGray<D>>
void detectLineSegments( BufferedImage image ,
Class<T> imageType ,
Class<D> derivType )
{
// convert the line into a single band image
T input = ConvertBufferedImage.convertFromSingle(image, null, imageType );
// Comment/uncomment t... | java |
public static List<double[]> coupledHueSat( List<String> images ) {
List<double[]> points = new ArrayList<>();
Planar<GrayF32> rgb = new Planar<>(GrayF32.class,1,1,3);
Planar<GrayF32> hsv = new Planar<>(GrayF32.class,1,1,3);
for( String path : images ) {
BufferedImage buffered = UtilImageIO.loadImage(path... | java |
public static List<double[]> independentHueSat( List<File> images ) {
List<double[]> points = new ArrayList<>();
// The number of bins is an important parameter. Try adjusting it
TupleDesc_F64 histogramHue = new TupleDesc_F64(30);
TupleDesc_F64 histogramValue = new TupleDesc_F64(30);
List<TupleDesc_F64> h... | java |
public static List<double[]> coupledRGB( List<File> images ) {
List<double[]> points = new ArrayList<>();
Planar<GrayF32> rgb = new Planar<>(GrayF32.class,1,1,3);
for( File f : images ) {
BufferedImage buffered = UtilImageIO.loadImage(f.getPath());
if( buffered == null ) throw new RuntimeException("Can't ... | java |
public static List<double[]> histogramGray( List<File> images ) {
List<double[]> points = new ArrayList<>();
GrayU8 gray = new GrayU8(1,1);
for( File f : images ) {
BufferedImage buffered = UtilImageIO.loadImage(f.getPath());
if( buffered == null ) throw new RuntimeException("Can't load image!");
gray.... | java |
public static int[] imageOffsets(double radius, int imgWidth) {
double PI2 = Math.PI * 2.0;
double circumference = PI2 * radius;
int num = (int) Math.ceil(circumference);
num = num - num % 4;
double angleStep = PI2 / num;
int temp[] = new int[(int) Math.ceil(circumference)];
int i = 0;
int prev =... | java |
public static <T extends ImageGray<T>, TD extends TupleDesc>
DetectDescribePoint<T, TD> createFromPremade( Class<T> imageType ) {
return (DetectDescribePoint)FactoryDetectDescribe.surfStable(
new ConfigFastHessian(1, 2, 200, 1, 9, 4, 4), null,null, imageType);
// return (DetectDescribePoint)FactoryDetectDescrib... | java |
public static <T extends ImageGray<T>, TD extends TupleDesc>
DetectDescribePoint<T, TD> createFromComponents( Class<T> imageType ) {
// create a corner detector
Class derivType = GImageDerivativeOps.getDerivativeType(imageType);
GeneralFeatureDetector corner = FactoryDetectPoint.createShiTomasi(new ConfigGeneral... | java |
protected void computeWeights(int numSamples, double numSigmas) {
weights = new float[ numSamples*numSamples ];
float w[] = new float[ numSamples ];
for( int i = 0; i < numSamples; i++ ) {
float x = i/(float)(numSamples-1);
w[i] = (float) UtilGaussian.computePDF(0, 1, 2f*numSigmas * (x - 0.5f));
}
for... | java |
protected void createSamplePoints(int numSamples) {
for( int y = 0; y < numSamples; y++ ) {
float regionY = (y/(numSamples-1.0f) - 0.5f);
for( int x = 0; x < numSamples; x++ ) {
float regionX = (x/(numSamples-1.0f) - 0.5f);
samplePts.add( new Point2D_F32(regionX,regionY));
}
}
} | java |
protected void computeHistogramInside( RectangleRotate_F32 region) {
for( int i = 0; i < samplePts.size(); i++ ) {
Point2D_F32 p = samplePts.get(i);
squareToImageSample(p.x, p.y, region);
interpolate.get_fast(imageX,imageY,value);
int indexHistogram = computeHistogramBin(value);
sampleHistIndex[ i ... | java |
protected void computeHistogramBorder(T image, RectangleRotate_F32 region) {
for( int i = 0; i < samplePts.size(); i++ ) {
Point2D_F32 p = samplePts.get(i);
squareToImageSample(p.x, p.y, region);
// make sure its inside the image
if( !BoofMiscOps.checkInside(image, imageX, imageY)) {
sampleHistIndex... | java |
protected int computeHistogramBin( float value[] ) {
int indexHistogram = 0;
int binStride = 1;
for( int bandIndex = 0; bandIndex < value.length; bandIndex++ ) {
int bin = (int)(numBins*value[bandIndex]/maxPixelValue);
indexHistogram += bin*binStride;
binStride *= numBins;
}
return indexHistogram;
... | java |
protected boolean isInFastBounds(RectangleRotate_F32 region) {
squareToImageSample(-0.5f, -0.5f, region);
if( !interpolate.isInFastBounds(imageX, imageY))
return false;
squareToImageSample(-0.5f, 0.5f, region);
if( !interpolate.isInFastBounds(imageX, imageY))
return false;
squareToImageSample(0.5f, 0.5... | java |
protected void squareToImageSample(float x, float y, RectangleRotate_F32 region) {
// -1 because it starts counting at 0. otherwise width+1 samples are made
x *= region.width-1;
y *= region.height-1;
imageX = x*c - y*s + region.cx;
imageY = x*s + y*c + region.cy;
} | java |
private void createSparseDerivatives() {
Kernel1D_F32 kernelD = new Kernel1D_F32(new float[]{-1,0,1},3);
Kernel1D_F32 kernelDD = KernelMath.convolve1D_F32(kernelD, kernelD);
Kernel2D_F32 kernelXY = KernelMath.convolve2D(kernelD, kernelD);
derivXX = FactoryConvolveSparse.horizontal1D(GrayF32.class, kernelDD);
... | java |
public void process( GrayF32 input ) {
scaleSpace.initialize(input);
detections.reset();
do {
// scale from octave to input image
pixelScaleToInput = scaleSpace.pixelScaleCurrentToInput();
// detect features in the image
for (int j = 1; j < scaleSpace.getNumScales()+1; j++) {
// not really sur... | java |
protected void detectFeatures( int scaleIndex ) {
extractor.process(dogTarget);
FastQueue<NonMaxLimiter.LocalExtreme> found = extractor.getLocalExtreme();
derivXX.setImage(dogTarget);
derivXY.setImage(dogTarget);
derivYY.setImage(dogTarget);
for (int i = 0; i < found.size; i++) {
NonMaxLimiter.LocalExt... | java |
boolean isScaleSpaceExtremum(int c_x, int c_y, float value, float signAdj) {
if( c_x <= 1 || c_y <= 1 || c_x >= dogLower.width-1 || c_y >= dogLower.height-1)
return false;
float v;
value *= signAdj;
for( int y = -1; y <= 1; y++ ) {
for( int x = -1; x <= 1; x++ ) {
v = dogLower.unsafe_get(c_x+x,c... | java |
public static PixelTransformAffine_F32 transformScale(ImageBase from, ImageBase to,
PixelTransformAffine_F32 distort)
{
if( distort == null )
distort = new PixelTransformAffine_F32();
float scaleX = (float)(to.width)/(float)(from.width);
float scaleY = (float)(to.height)/(float)(from.height);... | java |
protected boolean projectOntoEssential( DMatrixRMaj E ) {
if( !svdConstraints.decompose(E) ) {
return false;
}
svdV = svdConstraints.getV(svdV,false);
svdU = svdConstraints.getU(svdU,false);
svdS = svdConstraints.getW(svdS);
SingularOps_DDRM.descendingOrder(svdU, false, svdS, svdV, false);
// project... | java |
protected boolean projectOntoFundamentalSpace( DMatrixRMaj F ) {
if( !svdConstraints.decompose(F) ) {
return false;
}
svdV = svdConstraints.getV(svdV,false);
svdU = svdConstraints.getU(svdU,false);
svdS = svdConstraints.getW(svdS);
SingularOps_DDRM.descendingOrder(svdU, false, svdS, svdV, false);
// ... | java |
public void learnFern(boolean positive, ImageRectangle r) {
float rectWidth = r.getWidth();
float rectHeight = r.getHeight();
float c_x = r.x0+(rectWidth-1)/2f;
float c_y = r.y0+(rectHeight-1)/2f;
for( int i = 0; i < ferns.length; i++ ) {
// first learn it with no noise
int value = computeFernValue(... | java |
public void learnFernNoise(boolean positive, ImageRectangle r) {
float rectWidth = r.getWidth();
float rectHeight = r.getHeight();
float c_x = r.x0+(rectWidth-1)/2.0f;
float c_y = r.y0+(rectHeight-1)/2.0f;
for( int i = 0; i < ferns.length; i++ ) {
// first learn it with no noise
int value = computeF... | java |
private void increment( TldFernFeature f , boolean positive ) {
if( positive ) {
f.incrementP();
if( f.numP > maxP )
maxP = f.numP;
} else {
f.incrementN();
if( f.numN > maxN )
maxN = f.numN;
}
} | java |
public boolean lookupFernPN( TldRegionFernInfo info ) {
ImageRectangle r = info.r;
float rectWidth = r.getWidth();
float rectHeight = r.getHeight();
float c_x = r.x0+(rectWidth-1)/2.0f;
float c_y = r.y0+(rectHeight-1)/2.0f;
int sumP = 0;
int sumN = 0;
for( int i = 0; i < ferns.length; i++ ) {
Tl... | java |
protected int computeFernValue(float c_x, float c_y, float rectWidth , float rectHeight , TldFernDescription fern ) {
rectWidth -= 1;
rectHeight -= 1;
int desc = 0;
for( int i = 0; i < fern.pairs.length; i++ ) {
Point2D_F32 p_a = fern.pairs[i].a;
Point2D_F32 p_b = fern.pairs[i].b;
float valA = inter... | java |
public void renormalizeP() {
int targetMax = maxP/20;
for( int i = 0; i < managers.length; i++ ) {
TldFernManager m = managers[i];
for( int j = 0; j < m.table.length; j++ ) {
TldFernFeature f = m.table[j];
if( f == null )
continue;
f.numP = targetMax*f.numP/maxP;
}
}
maxP = targetMax;... | java |
public void renormalizeN() {
int targetMax = maxN/20;
for( int i = 0; i < managers.length; i++ ) {
TldFernManager m = managers[i];
for( int j = 0; j < m.table.length; j++ ) {
TldFernFeature f = m.table[j];
if( f == null )
continue;
f.numN = targetMax*f.numN/maxN;
}
}
maxN = targetMax;... | java |
public void describe(double x, double y, double angle, double scale, TupleDesc_F64 ret)
{
double c = Math.cos(angle),s=Math.sin(angle);
// By assuming that the entire feature is inside the image faster algorithms can be used
// the results are also of dubious value when interacting with the image border.
bool... | java |
public boolean computeLaplaceSign(int x, int y, double scale) {
int s = (int)Math.ceil(scale);
kerXX = DerivativeIntegralImage.kernelDerivXX(9*s,kerXX);
kerYY = DerivativeIntegralImage.kernelDerivYY(9*s,kerYY);
double lap = GIntegralImageOps.convolveSparse(ii,kerXX,x,y);
lap += GIntegralImageOps.convolveSpars... | java |
public static <I extends ImageGray<I>, D extends ImageGray<D>>
DetectLineHoughPolar<I,D> houghPolar(ConfigHoughPolar config ,
Class<I> imageType ,
Class<D> derivType ) {
if( config == null )
throw new IllegalArgumentException("This is no default since minCounts must be specified");
Image... | java |
public static BufferedImage renderContours(List<Contour> contours , int colorExternal, int colorInternal ,
int width , int height , BufferedImage out) {
if( out == null ) {
out = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
} else {
Graphics2D g2 = out.createGraphics();
g2.set... | java |
public static void render(List<Contour> contours , int colors[] , BufferedImage out) {
colors = checkColors(colors,contours.size());
for( int i = 0; i < contours.size(); i++ ) {
Contour c = contours.get(i);
int color = colors[i];
for(Point2D_I32 p : c.external ) {
out.setRGB(p.x,p.y,color);
}
}... | java |
public static BufferedImage renderBinary(GrayU8 binaryImage, boolean invert, BufferedImage out) {
if( out == null || ( out.getWidth() != binaryImage.width || out.getHeight() != binaryImage.height) ) {
out = new BufferedImage(binaryImage.getWidth(),binaryImage.getHeight(),BufferedImage.TYPE_BYTE_GRAY);
}
try ... | java |
public void process(PairLineNorm line, AssociatedPair point) {
// t0 = (F*x) cross l'
GeometryMath_F64.mult(F,point.p1,Fx);
GeometryMath_F64.cross(Fx,line.getL2(),t0);
// t1 = x' cross ((f*x) cross l')
GeometryMath_F64.cross(point.p2, t0, t1);
// t0 = x' cross e'
GeometryMath_F64.cross(point.p2,e2,t0);
... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.