code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
protected void applyThreshold( T input, GrayU8 output ) {
for (int blockY = 0; blockY < stats.height; blockY++) {
for (int blockX = 0; blockX < stats.width; blockX++) {
original.thresholdBlock(blockX,blockY,input,stats,output);
}
}
} | java |
public void addImage(T image , String cameraName ) {
PairwiseImageGraph.View view = new PairwiseImageGraph.View(graph.nodes.size(),
new FastQueue<TupleDesc>(TupleDesc.class,true) {
@Override
protected TupleDesc createInstance() {
return detDesc.createDescription();
}
});
view.camera =... | java |
protected boolean connectViews(PairwiseImageGraph.View viewA , PairwiseImageGraph.View viewB ,
FastQueue<AssociatedIndex> matches) {
// Estimate fundamental/essential with RANSAC
PairwiseImageGraph.Motion edge = new PairwiseImageGraph.Motion();
int inliersEpipolar;
CameraPinhole pinhole0 = viewA.ca... | java |
boolean fitEpipolar(FastQueue<AssociatedIndex> matches ,
List<Point2D_F64> pointsA , List<Point2D_F64> pointsB ,
ModelMatcher<?,AssociatedPair> ransac ,
PairwiseImageGraph.Motion edge )
{
pairs.resize(matches.size);
for (int i = 0; i < matches.size; i++) {
AssociatedIndex a = matches.get(i);
... | java |
public void process(T gray, GrayU8 binary) {
if( verbose ) System.out.println("ENTER DetectPolygonFromContour.process()");
if( contourPadded != null && !contourPadded.isCreatePaddedCopy() ) {
int padding = 2;
if( gray.width+padding != binary.width || gray.height+padding != binary.height ) {
throw new Il... | java |
void determineCornersOnBorder( Polygon2D_F64 polygon , GrowQueue_B onImageBorder ) {
onImageBorder.reset();
for (int i = 0; i < polygon.size(); i++) {
Point2D_F64 p = polygon.get(i);
onImageBorder.add( p.x <= 1 || p.y <= 1 || p.x >= imageWidth-2 || p.y >= imageHeight-2);
}
} | java |
public List<Point2D_I32> getContour( Info info ) {
contourTmp.reset();
contourFinder.loadContour(info.contour.externalIndex,contourTmp);
return contourTmp.toList();
} | java |
private void removeDistortionFromContour(List<Point2D_I32> distorted , FastQueue<Point2D_I32> undistorted ) {
undistorted.reset();
for (int j = 0; j < distorted.size(); j++) {
// remove distortion
Point2D_I32 p = distorted.get(j);
Point2D_I32 q = undistorted.grow();
distToUndist.compute(p.x,p.y,disto... | java |
protected final boolean touchesBorder( List<Point2D_I32> contour ) {
int endX = imageWidth-1;
int endY = imageHeight-1;
for (int j = 0; j < contour.size(); j++) {
Point2D_I32 p = contour.get(j);
if( p.x == 0 || p.y == 0 || p.x == endX || p.y == endY )
{
return true;
}
}
return false;
} | java |
public void set(double fx, double fy, double skew) {
this.fx = fx;
this.fy = fy;
this.skew = skew;
} | java |
public static<T extends ImageGray<T>, FD extends TupleDesc> Homography2D_F64
computeTransform( T imageA , T imageB ,
DetectDescribePoint<T,FD> detDesc ,
AssociateDescription<FD> associate ,
ModelMatcher<Homography2D_F64,AssociatedPair> modelMatcher )
{
// get the length of the description
Lis... | java |
public static <T extends ImageGray<T>>
void stitch( BufferedImage imageA , BufferedImage imageB , Class<T> imageType )
{
T inputA = ConvertBufferedImage.convertFromSingle(imageA, null, imageType);
T inputB = ConvertBufferedImage.convertFromSingle(imageB, null, imageType);
// Detect using the standard SURF feat... | java |
public void configure(double baseline,
DMatrixRMaj K, DMatrixRMaj rectifiedR,
Point2Transform2_F64 rectifiedToColor,
int minDisparity, int maxDisparity) {
this.K = K;
ConvertMatrixData.convert(rectifiedR,this.rectifiedR);
this.rectifiedToColor = rectifiedToColor;
this.baseline = (float)b... | java |
public void process(ImageGray disparity , BufferedImage color ) {
cloudRgb.setMaxSize(disparity.width*disparity.height);
cloudXyz.setMaxSize(disparity.width*disparity.height*3);
cloudRgb.reset();
cloudXyz.reset();
if( disparity instanceof GrayU8)
process((GrayU8)disparity,color);
else
process((GrayF3... | java |
public <T extends ImageGray<T>> void corruptImage(T original , T corrupted )
{
GGrayImageOps.stretch(original, valueScale, valueOffset, 255.0, corrupted);
GImageMiscOps.addGaussian(corrupted, rand, valueNoise, 0, 255);
GPixelMath.boundImage(corrupted,0,255);
} | java |
protected boolean findScaleH( DMatrixRMaj H ) {
if( !svd.decompose(H) )
return false;
Arrays.sort(svd.getSingularValues(), 0, 3);
double scale = svd.getSingularValues()[1];
CommonOps_DDRM.divide(H,scale);
return true;
} | java |
public static void vertical(BorderIndex1D border , WlCoef_I32 coefficients ,
GrayI input , GrayI output ) {
UtilWavelet.checkShape(input,output);
final int offsetA = coefficients.offsetScaling;
final int offsetB = coefficients.offsetWavelet;
final int[] alpha = coefficients.scaling;
final int[] beta... | java |
public static <Input extends ImageBase<Input>, Output extends ImageBase<Output>>
ConvolveInterface<Input,Output>
convolve(Kernel1D kernel, ImageType<Input> inputType, ImageType<Output> outputType , BorderType border , boolean isHorizontal )
{
if( inputType.getFamily() != ImageType.Family.GRAY )
throw new Illega... | java |
public static <T extends ImageBase<T>,O extends CameraPinhole, D extends CameraPinhole>
ImageDistort<T,T> changeCameraModel(AdjustmentType type, BorderType borderType,
O original,
D desired,
D modified,
ImageType<T> imageType)
{
Class bandType = imageType.getImageClass();
b... | java |
public static boolean getT(GrayU8 image, int x, int y) {
if (image.isInBounds(x, y)) {
return image.get(x, y) != 0;
} else {
return true;
}
} | java |
public static boolean getF(GrayU8 image, int x, int y) {
if (image.isInBounds(x, y)) {
return image.get(x, y) != 0;
} else {
return false;
}
} | java |
public boolean convert( ChessboardCornerGraph cluster , GridInfo info ) {
// default to an invalid value to ensure a failure doesn't go unnoticed.
info.reset();
// Get the edges in a consistent order
if( !orderEdges(cluster) )
return false;
// Now we need to order the nodes into a proper grid which follo... | java |
int selectCorner( GridInfo info ) {
info.lookupGridCorners(cornerList);
int bestCorner = -1;
double bestScore = Double.MAX_VALUE;
boolean bestIsCornerSquare = false;
for (int i = 0; i < cornerList.size(); i++) {
Node n = cornerList.get(i);
boolean corner = isCornerValidOrigin(n);
// If there are... | java |
boolean orderNodes( FastQueue<Node> corners , GridInfo info ) {
// Find a node with just two edges. This is a corner and will be the arbitrary origin in our graph
Node seed = null;
for (int i = 0; i < corners.size; i++) {
Node n = corners.get(i);
if( n.countEdges() == 2 ) {
seed = n;
break;
}
... | java |
static boolean isRightHanded( Node seed , int idxRow , int idxCol ) {
Node r = seed.edges[idxRow];
Node c = seed.edges[idxCol];
double dirRow = Math.atan2(r.y-seed.y,r.x-seed.x);
double dirCol = Math.atan2(c.y-seed.y,c.x-seed.x);
return UtilAngle.distanceCW(dirRow,dirCol) < Math.PI;
} | java |
void sortEdgesCCW(FastQueue<Node> corners) {
for (int nodeIdx = 0; nodeIdx < corners.size; nodeIdx++) {
Node na = corners.get(nodeIdx);
// reference node to do angles relative to.
double ref = Double.NaN;
int count = 0;
for (int i = 0; i < 4; i++) {
order[i] = i;
tmpEdges[i] = na.edges[i];
... | java |
public void rotateCCW(GridInfo grid ) {
cornerList.clear();
for (int col = 0; col < grid.cols; col++) {
for (int row = 0; row < grid.rows; row++) {
cornerList.add(grid.get(row,grid.cols - col - 1));
}
}
int tmp = grid.rows;
grid.rows = grid.cols;
grid.cols = tmp;
grid.nodes.clear();
grid.node... | java |
public void setCalibration(StereoParameters stereoParam) {
CameraPinholeBrown left = stereoParam.getLeft();
CameraPinholeBrown right = stereoParam.getRight();
// adjust image size
imageLeftRect.reshape(left.getWidth(), left.getHeight());
imageRightRect.reshape(right.getWidth(), right.getHeight());
// comp... | java |
public void computeHomo3D(double x, double y, Point3D_F64 pointLeft) {
// Coordinate in rectified camera frame
pointRect.z = baseline*fx;
pointRect.x = pointRect.z*(x - cx)/fx;
pointRect.y = pointRect.z*(y - cy)/fy;
// rotate into the original left camera frame
GeometryMath_F64.multTran(rectR,pointRect,poi... | java |
public static <I extends ImageGray<I>, II extends ImageGray<II>>
Class<II> getIntegralType( Class<I> inputType ) {
if( inputType == GrayF32.class ) {
return (Class<II>)GrayF32.class;
} else if( inputType == GrayU8.class ){
return (Class<II>)GrayS32.class;
} else if( inputType == GrayS32.class ){
return ... | java |
@Override
public boolean computeStability(int which, double disturbance, FiducialStability results) {
if( !getFiducialToCamera(which, targetToCamera))
return false;
stability.setShape(getSideWidth(which), getSideHeight(which));
stability.computeStability(targetToCamera,disturbance,results);
return true;
... | java |
private void createDetectedList(int which, List<PointIndex2D_F64> pixels) {
detected2D3D.clear();
List<Point2D3D> all = getControl3D(which);
for (int i = 0; i < pixels.size(); i++) {
PointIndex2D_F64 a = pixels.get(i);
Point2D3D b = all.get(i);
pixelToNorm.compute(a.x,a.y, b.observation);
detected2D3... | java |
protected boolean estimatePose( int which ,List<Point2D3D> points , Se3_F64 fiducialToCamera ) {
if( !estimatePnP.process(points, initialEstimate) ) {
return false;
}
filtered.clear();
// Don't bother if there are hardly any points to work with
if( points.size() > 6 ) {
w2p.configure(lensDistortion, ini... | java |
public <D extends ImageGray<D>> void transform(D derivX , D derivY , GrayU8 binary )
{
InputSanityCheck.checkSameShape(derivX,derivY,binary);
transform.reshape(derivX.width,derivY.height);
ImageMiscOps.fill(transform,0);
originX = derivX.width/2;
originY = derivX.height/2;
candidates.reset();
if( deri... | java |
public void parameterize( int x , int y , float derivX , float derivY )
{
// put the point in a new coordinate system centered at the image's origin
// this minimizes error, which is a function of distance from origin
x -= originX;
y -= originY;
float v = (x*derivX + y*derivY)/(derivX*derivX + derivY*derivY... | java |
public static void HighLevel( GrayF32 input) {
System.out.println("\n------------------- Dense High Level");
DescribeImageDense<GrayF32,TupleDesc_F64> describer = FactoryDescribeImageDense.
hog(new ConfigDenseHoG(),input.getImageType());
// sift(new ConfigDenseSift(),GrayF32.class);
// surfFast(new Config... | java |
public void process( I left , I right , GrayF32 imageDisparity ) {
// check inputs and initialize data structures
InputSanityCheck.checkSameShape(left,right,imageDisparity);
this.imageLeft = left;
this.imageRight = right;
w = left.width; h = left.height;
// Compute disparity for each pixel
for( int y = ... | java |
private void processPixel( int c_x , int c_y , int maxDisparity ) {
for( int i = minDisparity; i < maxDisparity; i++ ) {
score[i] = computeScore( c_x , c_x-i,c_y);
}
} | java |
protected double selectBest( int length ) {
double best = Double.MAX_VALUE;
int index = -1;
for( int i = minDisparity; i < length; i++ ) {
if( score[i] < best ) {
best = score[i];
index = i;
}
}
return index-minDisparity;
} | java |
protected double computeScore( int leftX , int rightX , int centerY ) {
double center = computeScoreRect(leftX,rightX,centerY);
four[0] = computeScoreRect(leftX-radiusX,rightX-radiusX,centerY-radiusY);
four[1] = computeScoreRect(leftX+radiusX,rightX+radiusX,centerY-radiusY);
four[2] = computeScoreRect(leftX... | java |
public void render( QrCode qr ) {
initialize(qr);
render.init();
positionPattern(0,0, qr.ppCorner);
positionPattern((numModules-7)*moduleWidth,0, qr.ppRight);
positionPattern(0,(numModules-7)*moduleWidth, qr.ppDown);
timingPattern(7*moduleWidth,6*moduleWidth,moduleWidth,0);
timingPattern(6*moduleWidth,7... | java |
private void renderData() {
QrCodeMaskPattern mask = qr.mask;
int count = 0;
int length = bitLocations.size() - bitLocations.size()%8;
while( count < length ) {
int bits = qr.rawbits[count/8]&0xFF;
int N = Math.min(8,bitLocations.size()-count);
for (int i = 0; i < N; i++) {
Point2D_I32 coor = bi... | java |
public static CameraPinholeBrown loadPinholeRadial(String fileName ) {
FileStorage fs = new FileStorage(
new File(fileName).getAbsolutePath(), FileStorage.READ);
IntPointer width = new IntPointer(1);
IntPointer height = new IntPointer(1);
read(fs.get("image_width"),width,-1);
read(fs.get("image_height")... | java |
public double distanceSqCorner( Point2D_F64 p ) {
double best = Double.MAX_VALUE;
for (int i = 0; i < 4; i++) {
double d = square.get(i).distance2(p);
if( d < best ) {
best = d;
}
}
return best;
} | java |
public void reset() {
square = null;
touch = null;
center.set(-1,-1);
largestSide = 0;
smallestSide = Double.MAX_VALUE;
graph = RESET_GRAPH;
for (int i = 0; i < edges.length; i++) {
if ( edges[i] != null )
throw new RuntimeException("BUG!");
sideLengths[i] = 0;
}
} | java |
public void updateArrayLength() {
if( edges.length != square.size() ) {
edges = new SquareEdge[square.size()];
sideLengths = new double[square.size()];
}
} | java |
public int getNumberOfConnections() {
int ret = 0;
for (int i = 0; i < square.size(); i++) {
if( edges[i] != null )
ret++;
}
return ret;
} | java |
public static <T extends ImageGray<T>> InterpolatePixelS<T>
createPixelS(double min, double max, InterpolationType type, BorderType borderType, Class<T> imageType)
{
InterpolatePixelS<T> alg;
switch( type ) {
case NEAREST_NEIGHBOR:
alg = nearestNeighborPixelS(imageType);
break;
case BILINEAR:
... | java |
public static <T extends ImageBase<T>> InterpolatePixelMB<T>
createPixelMB(double min, double max, InterpolationType type, BorderType borderType, ImageType<T> imageType )
{
switch (imageType.getFamily()) {
case PLANAR:
return (InterpolatePixelMB<T>) createPixelPL((InterpolatePixelS)createPixelS(min, max, ty... | java |
public static void yu12ToBoof(byte[] data, int width, int height, ImageBase output) {
if( output instanceof Planar) {
Planar ms = (Planar) output;
ms.reshape(width,height,3);
if( BoofConcurrency.USE_CONCURRENT ) {
if (ms.getBandType() == GrayU8.class) {
... | java |
public static GrayU8 yu12ToGray(byte[] data , int width , int height , GrayU8 output ) {
if( output != null ) {
if( output.width != width || output.height != height )
throw new IllegalArgumentException("output width and height must be "+width+" "+height);
} else {
... | java |
public static <D>
ScoreAssociation<D> scoreEuclidean( Class<D> tupleType , boolean squared ) {
if( TupleDesc_F64.class.isAssignableFrom(tupleType) ) {
if( squared )
return (ScoreAssociation)new ScoreAssociateEuclideanSq_F64();
else
return (ScoreAssociation)new ScoreAssociateEuclidean_F64();
} else if... | java |
public static <D>
ScoreAssociation<D> scoreHamming( Class<D> tupleType ) {
if( tupleType == TupleDesc_B.class ) {
return (ScoreAssociation)new ScoreAssociateHamming_B();
}
throw new IllegalArgumentException("Hamming distance not yet supported for type "+tupleType.getSimpleName());
} | java |
public void process(GrayF32 intensity, QueueCorner corners ) {
corners.reset();
float data[] = intensity.data;
for( int y = 0; y < intensity.height; y++ ) {
int startIndex = intensity.startIndex + y*intensity.stride;
int endIndex = startIndex + intensity.width;
for( int index = startIndex; index < end... | java |
public void swapLists() {
FastQueue<Helper> tmp = srcPositive;
srcPositive = dstPositive;
dstPositive = tmp;
tmp = srcNegative;
srcNegative = dstNegative;
dstNegative = tmp;
} | java |
public void associate()
{
// initialize data structures
matches.reset();
unassociatedSrc.reset();
if( srcPositive.size == 0 && srcNegative.size == 0 )
return;
if( dstPositive.size == 0 && dstNegative.size == 0 )
return;
// find and add the matches
assoc.setSource((FastQueue)srcPositive);
assoc.... | java |
private void sort(FastQueue<BrightFeature> input ,
FastQueue<Helper> pos , FastQueue<Helper> neg ) {
pos.reset();
neg.reset();
for( int i = 0; i < input.size; i++ ) {
BrightFeature f = input.get(i);
if( f.white) {
pos.grow().wrap(f,i);
} else {
neg.grow().wrap(f,i);
}
}
} | java |
public static <I extends ImageMultiBand<I>, M extends ImageMultiBand<M>, D extends ImageGray<D>>
ImageGradient<I,D> gradientReduce( ImageGradient<I,M> gradient ,
DerivativeReduceType type,
Class<D> outputType )
{
String name;
switch( type ) {
case MAX_F: name = "maxf"; break;
defau... | java |
public static <I extends ImageGray<I>, D extends ImageGray<D>>
ImageGradient<I,D> gradientSB( DerivativeType type , Class<I> inputType , Class<D> derivType )
{
if( derivType == null )
derivType = GImageDerivativeOps.getDerivativeType(inputType);
Class which;
switch( type ) {
case PREWITT:
which = Gr... | java |
public int addPattern(GrayU8 inputBinary, double lengthSide) {
if( inputBinary == null ) {
throw new IllegalArgumentException("Input image is null.");
} else if( lengthSide <= 0 ) {
throw new IllegalArgumentException("Parameter lengthSide must be more than zero");
} else if(ImageStatistics.max(inputBinary) ... | java |
protected static void binaryToDef(GrayU8 binary , short[] desc ) {
for (int i = 0; i < binary.data.length; i+=16) {
int value = 0;
for (int j = 0; j < 16; j++) {
value |= binary.data[i+j] << j;
}
desc[i/16] = (short)value;
}
} | java |
protected int hamming(short[] a, short[] b) {
int distance = 0;
for (int i = 0; i < a.length; i++) {
distance += DescriptorDistance.hamming((a[i]&0xFFFF) ^ (b[i]&0xFFFF));
}
return distance;
} | java |
public static TupleDesc_F64 combine( List<TupleDesc_F64> inputs , TupleDesc_F64 combined ) {
int N = 0;
for (int i = 0; i < inputs.size(); i++) {
N += inputs.get(i).size();
}
if( combined == null ) {
combined = new TupleDesc_F64(N);
} else {
if (N != combined.size())
throw new RuntimeException("T... | java |
public void setProcessing( VideoProcessing processing ) {
if( this.processing != null ) {
// kill the old process
this.processing.stopProcessing();
}
if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
throw new RuntimeException("Not called from a GUI thread. Bad stuff could happen");
... | java |
private void setUpAndConfigureCamera() {
// Open and configure the camera
mCamera = openConfigureCamera(mCameraInfo);
setCameraDisplayOrientation(mCameraInfo,mCamera);
// Create an instance of Camera
mPreview.setCamera(mCamera);
if( processing != null ) {
processing.init(mDraw,mCamera,mCameraInfo,previ... | java |
protected void setProgressMessage(final String message) {
runOnUiThread(new Runnable() {
public void run() {
synchronized ( lockProgress ) {
if( progressDialog != null ) {
// a dialog is already open, change the message
progressDialog.setMessage(message);
return;
}
progressDial... | java |
protected void hideProgressDialog() {
// do nothing if the dialog is already being displayed
synchronized ( lockProgress ) {
if( progressDialog == null )
return;
}
if (Looper.getMainLooper().getThread() == Thread.currentThread()) {
// if inside the UI thread just dismiss the dialog and avoid a potent... | java |
public void set( CameraUniversalOmni original ) {
super.set(original);
this.mirrorOffset = original.mirrorOffset;
if( radial.length != original.radial.length )
radial = new double[ original.radial.length ];
System.arraycopy(original.radial,0,radial,0,radial.length);
this.t1 = original.t1;
this.t2 = or... | java |
public void process( T image1 , T image2 , ImageFlow output) {
InputSanityCheck.checkSameShape(image1,image2);
derivX.reshape(image1.width,image1.height);
derivY.reshape(image1.width,image1.height);
derivT.reshape(image1.width,image1.height);
averageFlow.reshape(output.width,output.height);
if( resetOut... | java |
protected static void innerAverageFlow( ImageFlow flow , ImageFlow averageFlow ) {
int endX = flow.width-1;
int endY = flow.height-1;
for( int y = 1; y < endY; y++ ) {
int index = flow.width*y + 1;
for( int x = 1; x < endX; x++ , index++) {
ImageFlow.D average = averageFlow.data[index];
ImageFlow... | java |
protected static void borderAverageFlow( ImageFlow flow , ImageFlow averageFlow) {
for( int y = 0; y < flow.height; y++ ) {
computeBorder(flow,averageFlow, 0, y);
computeBorder(flow,averageFlow, flow.width-1, y);
}
for( int x = 1; x < flow.width-1; x++ ) {
computeBorder(flow,averageFlow, x, 0);
comp... | java |
void computeProjectionTable( int width , int height ) {
output.reshape(width,height);
depthMap.reshape(width,height);
ImageMiscOps.fill(depthMap,-1);
pointing = new float[width*height*3];
for (int y = 0; y < output.height; y++) {
for (int x = 0; x < output.width; x++) {
// Should this add 0.5 so tha... | java |
public GrayF32 render()
{
ImageMiscOps.fill(output,background);
ImageMiscOps.fill(depthMap,Float.MAX_VALUE);
for (int i = 0; i < scene.size(); i++) {
SurfaceRect r = scene.get(i);
r.rectInCamera();
}
if( BoofConcurrency.USE_CONCURRENT ) {
renderMultiThread();
} else {
renderSingleThread();
... | java |
public void computePixel(int which, double x, double y, Point2D_F64 output) {
SurfaceRect r = scene.get(which);
Point3D_F64 p3 = new Point3D_F64(-x,-y,0);
SePointOps_F64.transform(r.rectToCamera, p3, p3);
// unit sphere
p3.scale(1.0/p3.norm());
sphereToPixel.compute(p3.x,p3.y,p3.z,output);
} | java |
public void configure(LensDistortionNarrowFOV model , PixelTransform<Point2D_F32> visualToDepth ) {
this.visualToDepth = visualToDepth;
this.p2n = model.undistort_F64(true,false);
} | java |
public boolean process( int x , int y ) {
visualToDepth.compute(x, y,distorted);
int depthX = (int)distorted.x;
int depthY = (int)distorted.y;
if( depthImage.isInBounds(depthX,depthY) ) {
// get the depth at the specified location
double value = lookupDepth(depthX, depthY);
// see if its an invalid ... | java |
private void captureFiducialPoints() {
Polygon2D_F64 p = regions.grow();
p.vertexes.resize(sidesCollision.size());
for (int i = 0; i < sidesCollision.size(); i++) {
p.get(i).set( sidesCollision.get(i) );
}
quality.addObservations(detector.getDetectedPoints());
gui.getInfoPanel().updateGeometry(quality.ge... | java |
private boolean checkMagnetCapturePicture() {
boolean captured = false;
Iterator<Magnet> iter = magnets.iterator();
while( iter.hasNext() ) {
Magnet i = iter.next();
if( i.handlePictureTaken() ) {
iter.remove();
captured = true;
}
}
return captured;
} | java |
public boolean fit( List<Point2D_I32> contour , GrowQueue_I32 corners )
{
if( corners.size() < 3 ) {
return false;
}
searchRadius = Math.min(6,Math.max(contour.size()/12,3));
int startCorner,endCorner;
if( looping ) {
startCorner = 0;
endCorner = corners.size;
} else {
// the end point positio... | java |
protected int optimize( List<Point2D_I32> contour , int c0,int c1,int c2 ) {
double bestDistance = computeCost(contour,c0,c1,c2,0);
int bestIndex = 0;
for( int i = -searchRadius; i <= searchRadius; i++ ) {
if( i == 0 ) {
// if it found a better point in the first half stop the search since that's probably... | java |
protected double computeCost(List<Point2D_I32> contour, int c0, int c1, int c2,
int offset)
{
c1 = CircularIndex.addOffset(c1, offset, contour.size());
createLine(c0,c1,contour,line0);
createLine(c1,c2,contour,line1);
return distanceSum(line0,c0,c1,contour)+distanceSum(line1,c1,c2,contour);
} | java |
protected double distanceSum( LineGeneral2D_F64 line , int c0 , int c1 , List<Point2D_I32> contour ) {
double total = 0;
if( c0 < c1 ) {
int length = c1-c0+1;
int samples = Math.min(maxLineSamples,length);
for (int i = 0; i < samples; i++) {
int index = c0 + i*(length-1)/(samples-1);
total += dis... | java |
private void createLine( int index0 , int index1 , List<Point2D_I32> contour , LineGeneral2D_F64 line )
{
if( index1 < 0 )
System.out.println("SHIT");
Point2D_I32 p0 = contour.get(index0);
Point2D_I32 p1 = contour.get(index1);
// System.out.println("createLine "+p0+" "+p1);
work.a.set(p0.x, p0.y);
work... | java |
public <B extends ImageGray<B>> B createSameShape( Class<B> type )
{
return GeneralizedImageOps.createSingleBand(type,width,height);
} | java |
private synchronized void changeImageView() {
JComponent comp;
if( control.selectedView < 3 ) {
BufferedImage img;
switch (control.selectedView) {
case 0:
img = disparityOut;
break;
case 1:
img = colorLeft;
break;
case 2:
img = colorRight;
break;
default:
... | java |
private void rectifyInputImages() {
// get intrinsic camera calibration matrices
DMatrixRMaj K1 = PerspectiveOps.pinholeToMatrix(calib.left, (DMatrixRMaj)null);
DMatrixRMaj K2 = PerspectiveOps.pinholeToMatrix(calib.right, (DMatrixRMaj)null);
// compute rectification matrices
rectifyAlg.process(K1,new Se3_F64... | java |
private void changeGuiActive( final boolean error , final boolean reverse ) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
control.setActiveGui(error,reverse);
}
});
} | java |
public static String guessEncoding( byte[] message ) {
// this function is inspired by a similarly named function in ZXing, but was written from scratch
// using specifications for each encoding since I didn't understand what they were doing
boolean isUtf8 = true;
boolean isJis = true;
boolean isIso = true;
... | java |
public static <T extends ImageGray<T>> T convert(ImageGray<?> src , T dst , Class<T> typeDst )
{
if (dst == null) {
dst =(T) GeneralizedImageOps.createSingleBand(typeDst, src.width, src.height);
} else {
InputSanityCheck.checkSameShape(src, dst);
}
convert(src,dst);
return dst;
} | java |
public void setTensor( TrifocalTensor tensor ) {
this.tensor = tensor;
if( !svd.decompose(tensor.T1) )
throw new RuntimeException("SVD failed?!");
SingularOps_DDRM.nullVector(svd, true, v1);
SingularOps_DDRM.nullVector(svd, false,u1);
// DMatrixRMaj zero = new DMatrixRMaj(3,1);
// CommonOps_DDRM.mult(ten... | java |
public void extractEpipoles( Point3D_F64 e2 , Point3D_F64 e3 ) {
e2.set(this.e2);
e3.set(this.e3);
} | java |
public static <T extends ImageGray<T>>
void histogram( T image , double minPixelValue , double maxPixelValue , TupleDesc_F64 histogram ) {
if( image.getClass() == GrayU8.class ) {
HistogramFeatureOps.histogram((GrayU8) image, (int) maxPixelValue, histogram);
} else if( image.getClass() == GrayU16.class ) {
... | java |
public static void histogram( double[] colors, int length , Histogram_F64 histogram )
{
if( length % histogram.getDimensions() != 0 )
throw new IllegalArgumentException("Length does not match dimensions");
int coordinate[] = new int[ histogram.getDimensions() ];
histogram.fill(0);
for (int i = 0; i < len... | java |
void computePointStatistics(Point[] points ) {
final int length = points.length;
double v[] = new double[length];
for (int axis = 0; axis < 3; axis++) {
double maxAbs = 0;
for (int i = 0; i < length; i++) {
v[i] = points[i].coordinate[axis];
maxAbs = Math.max( maxAbs , Math.abs(v[i]));
}
dou... | java |
public void undoScale( SceneStructureMetric structure ,
SceneObservations observations ) {
if( structure.homogenous )
return;
double scale = desiredDistancePoint / medianDistancePoint;
undoNormPoints3D(structure, scale);
Point3D_F64 c = new Point3D_F64();
for (int i = 0; i < structure.views.le... | java |
public boolean apply( T input ,
Point2D_F64 corner0 , Point2D_F64 corner1 ,
Point2D_F64 corner2 , Point2D_F64 corner3 )
{
if( createTransform(corner0, corner1, corner2, corner3)) {
distort.input(input).apply();
return true;
} else {
return false;
}
} | java |
public boolean createTransform( Point2D_F64 tl , Point2D_F64 tr ,
Point2D_F64 br , Point2D_F64 bl )
{
associatedPairs.get(0).p2.set(tl);
associatedPairs.get(1).p2.set(tr);
associatedPairs.get(2).p2.set(br);
associatedPairs.get(3).p2.set(bl);
if( !computeHomography.process(associatedPairs, H) )
r... | java |
public static void vertical(Kernel1D_F32 kernel, GrayF32 image, GrayF32 dest , int skip ) {
checkParameters(image, dest, skip);
if( kernel.width >= image.width ) {
ConvolveDownNormalizedNaive.vertical(kernel,image,dest,skip);
} else {
ConvolveImageDownNoBorder.vertical(kernel,image,dest,skip);
ConvolveD... | java |
public static void removeRadial(float x, float y, float[] radial, float t1, float t2,
Point2D_F32 out, float tol ) {
float origX = x;
float origY = y;
float prevSum = 0;
for( int iter = 0; iter < 500; iter++ ) {
// estimate the radial distance
float r2 = x*x + y*y;
float ri2 = r2;
float... | java |
public boolean process(EllipseRotated_F64 input, EllipseRotated_F64 refined) {
refined.set(input);
previous.set(input);
for (int iteration = 0; iteration < maxIterations; iteration++) {
refined.set(previous);
computePointsAndWeights(refined);
if( fitter.process(samplePts.toList(),weights.data) ) {
... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.