idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
26,900 | protected static double change ( EllipseRotated_F64 a , EllipseRotated_F64 b ) { double total = 0 ; total += Math . abs ( a . center . x - b . center . x ) ; total += Math . abs ( a . center . y - b . center . y ) ; total += Math . abs ( a . a - b . a ) ; total += Math . abs ( a . b - b . b ) ; double weight = Math . min ( 4 , 2.0 * ( a . a / a . b - 1.0 ) ) ; total += weight * UtilAngle . distHalf ( a . phi , b . phi ) ; return total ; } | Computes a numerical value for the difference in parameters between the two ellipses |
26,901 | public static < T extends ImageGray < T > > MonocularPlaneVisualOdometry < T > monoPlaneInfinity ( int thresholdAdd , int thresholdRetire , double inlierPixelTol , int ransacIterations , PointTracker < T > tracker , ImageType < T > imageType ) { double ransacTOL = inlierPixelTol * inlierPixelTol ; ModelManagerSe2_F64 manager = new ModelManagerSe2_F64 ( ) ; DistancePlane2DToPixelSq distance = new DistancePlane2DToPixelSq ( ) ; GenerateSe2_PlanePtPixel generator = new GenerateSe2_PlanePtPixel ( ) ; ModelMatcher < Se2_F64 , PlanePtPixel > motion = new Ransac < > ( 2323 , manager , generator , distance , ransacIterations , ransacTOL ) ; VisOdomMonoPlaneInfinity < T > alg = new VisOdomMonoPlaneInfinity < > ( thresholdAdd , thresholdRetire , inlierPixelTol , motion , tracker ) ; return new MonoPlaneInfinity_to_MonocularPlaneVisualOdometry < > ( alg , distance , generator , imageType ) ; } | Monocular plane based visual odometry algorithm which uses both points on the plane and off plane for motion estimation . |
26,902 | public static < T extends ImageGray < T > > MonocularPlaneVisualOdometry < T > monoPlaneOverhead ( double cellSize , double maxCellsPerPixel , double mapHeightFraction , double inlierGroundTol , int ransacIterations , int thresholdRetire , int absoluteMinimumTracks , double respawnTrackFraction , double respawnCoverageFraction , PointTracker < T > tracker , ImageType < T > imageType ) { ImageMotion2D < T , Se2_F64 > motion2D = FactoryMotion2D . createMotion2D ( ransacIterations , inlierGroundTol * inlierGroundTol , thresholdRetire , absoluteMinimumTracks , respawnTrackFraction , respawnCoverageFraction , false , tracker , new Se2_F64 ( ) ) ; VisOdomMonoOverheadMotion2D < T > alg = new VisOdomMonoOverheadMotion2D < > ( cellSize , maxCellsPerPixel , mapHeightFraction , motion2D , imageType ) ; return new MonoOverhead_to_MonocularPlaneVisualOdometry < > ( alg , imageType ) ; } | Monocular plane based visual odometry algorithm which creates a synthetic overhead view and tracks image features inside this synthetic view . |
26,903 | public static < T extends ImageGray < T > > StereoVisualOdometry < T > stereoDepth ( double inlierPixelTol , int thresholdAdd , int thresholdRetire , int ransacIterations , int refineIterations , boolean doublePass , StereoDisparitySparse < T > sparseDisparity , PointTrackerTwoPass < T > tracker , Class < T > imageType ) { StereoSparse3D < T > pixelTo3D = new StereoSparse3D < > ( sparseDisparity , imageType ) ; Estimate1ofPnP estimator = FactoryMultiView . pnp_1 ( EnumPNP . P3P_FINSTERWALDER , - 1 , 2 ) ; final DistanceFromModelMultiView < Se3_F64 , Point2D3D > distance = new PnPDistanceReprojectionSq ( ) ; ModelManagerSe3_F64 manager = new ModelManagerSe3_F64 ( ) ; EstimatorToGenerator < Se3_F64 , Point2D3D > generator = new EstimatorToGenerator < > ( estimator ) ; double ransacTOL = inlierPixelTol * inlierPixelTol ; ModelMatcher < Se3_F64 , Point2D3D > motion = new Ransac < > ( 2323 , manager , generator , distance , ransacIterations , ransacTOL ) ; RefinePnP refine = null ; if ( refineIterations > 0 ) { refine = FactoryMultiView . pnpRefine ( 1e-12 , refineIterations ) ; } VisOdomPixelDepthPnP < T > alg = new VisOdomPixelDepthPnP < > ( thresholdAdd , thresholdRetire , doublePass , motion , pixelTo3D , refine , tracker , null , null ) ; return new WrapVisOdomPixelDepthPnP < > ( alg , pixelTo3D , distance , imageType ) ; } | Stereo vision based visual odometry algorithm which runs a sparse feature tracker in the left camera and estimates the range of tracks once when first detected using disparity between left and right cameras . |
26,904 | public static < Vis extends ImageGray < Vis > , Depth extends ImageGray < Depth > > DepthVisualOdometry < Vis , Depth > depthDepthPnP ( double inlierPixelTol , int thresholdAdd , int thresholdRetire , int ransacIterations , int refineIterations , boolean doublePass , DepthSparse3D < Depth > sparseDepth , PointTrackerTwoPass < Vis > tracker , Class < Vis > visualType , Class < Depth > depthType ) { ImagePixelTo3D pixelTo3D = new DepthSparse3D_to_PixelTo3D < > ( sparseDepth ) ; Estimate1ofPnP estimator = FactoryMultiView . pnp_1 ( EnumPNP . P3P_FINSTERWALDER , - 1 , 2 ) ; final DistanceFromModelMultiView < Se3_F64 , Point2D3D > distance = new PnPDistanceReprojectionSq ( ) ; ModelManagerSe3_F64 manager = new ModelManagerSe3_F64 ( ) ; EstimatorToGenerator < Se3_F64 , Point2D3D > generator = new EstimatorToGenerator < > ( estimator ) ; double ransacTOL = inlierPixelTol * inlierPixelTol ; ModelMatcher < Se3_F64 , Point2D3D > motion = new Ransac < > ( 2323 , manager , generator , distance , ransacIterations , ransacTOL ) ; RefinePnP refine = null ; if ( refineIterations > 0 ) { refine = FactoryMultiView . pnpRefine ( 1e-12 , refineIterations ) ; } VisOdomPixelDepthPnP < Vis > alg = new VisOdomPixelDepthPnP < > ( thresholdAdd , thresholdRetire , doublePass , motion , pixelTo3D , refine , tracker , null , null ) ; return new VisOdomPixelDepthPnP_to_DepthVisualOdometry < > ( sparseDepth , alg , distance , ImageType . single ( visualType ) , depthType ) ; } | Depth sensor based visual odometry algorithm which runs a sparse feature tracker in the visual camera and estimates the range of tracks once when first detected using the depth sensor . |
26,905 | public static < T extends ImageGray < T > , Desc extends TupleDesc > StereoVisualOdometry < T > stereoDualTrackerPnP ( int thresholdAdd , int thresholdRetire , double inlierPixelTol , double epipolarPixelTol , int ransacIterations , int refineIterations , PointTracker < T > trackerLeft , PointTracker < T > trackerRight , DescribeRegionPoint < T , Desc > descriptor , Class < T > imageType ) { EstimateNofPnP pnp = FactoryMultiView . pnp_N ( EnumPNP . P3P_FINSTERWALDER , - 1 ) ; DistanceFromModelMultiView < Se3_F64 , Point2D3D > distanceMono = new PnPDistanceReprojectionSq ( ) ; PnPStereoDistanceReprojectionSq distanceStereo = new PnPStereoDistanceReprojectionSq ( ) ; PnPStereoEstimator pnpStereo = new PnPStereoEstimator ( pnp , distanceMono , 0 ) ; ModelManagerSe3_F64 manager = new ModelManagerSe3_F64 ( ) ; EstimatorToGenerator < Se3_F64 , Stereo2D3D > generator = new EstimatorToGenerator < > ( pnpStereo ) ; double ransacTOL = 2 * inlierPixelTol * inlierPixelTol ; ModelMatcher < Se3_F64 , Stereo2D3D > motion = new Ransac < > ( 2323 , manager , generator , distanceStereo , ransacIterations , ransacTOL ) ; RefinePnPStereo refinePnP = null ; Class < Desc > descType = descriptor . getDescriptionType ( ) ; ScoreAssociation < Desc > scorer = FactoryAssociation . defaultScore ( descType ) ; AssociateStereo2D < Desc > associateStereo = new AssociateStereo2D < > ( scorer , epipolarPixelTol , descType ) ; AssociateDescription2D < Desc > associateUnique = associateStereo ; if ( ! associateStereo . uniqueDestination ( ) || ! associateStereo . uniqueSource ( ) ) { associateUnique = new EnforceUniqueByScore . Describe2D < > ( associateStereo , true , true ) ; } if ( refineIterations > 0 ) { refinePnP = new PnPStereoRefineRodrigues ( 1e-12 , refineIterations ) ; } Triangulate2ViewsMetric triangulate = FactoryMultiView . triangulate2ViewMetric ( new ConfigTriangulation ( ConfigTriangulation . Type . GEOMETRIC ) ) ; VisOdomDualTrackPnP < T , Desc > alg = new VisOdomDualTrackPnP < > ( thresholdAdd , thresholdRetire , epipolarPixelTol , trackerLeft , trackerRight , descriptor , associateUnique , triangulate , motion , refinePnP ) ; return new WrapVisOdomDualTrackPnP < > ( pnpStereo , distanceMono , distanceStereo , associateStereo , alg , refinePnP , imageType ) ; } | Creates a stereo visual odometry algorithm that independently tracks features in left and right camera . |
26,906 | public static void computeCameraControl ( double beta [ ] , List < Point3D_F64 > nullPts [ ] , FastQueue < Point3D_F64 > cameraPts , int numControl ) { cameraPts . reset ( ) ; for ( int i = 0 ; i < numControl ; i ++ ) { cameraPts . grow ( ) . set ( 0 , 0 , 0 ) ; } for ( int i = 0 ; i < numControl ; i ++ ) { double b = beta [ i ] ; for ( int j = 0 ; j < numControl ; j ++ ) { Point3D_F64 s = cameraPts . get ( j ) ; Point3D_F64 p = nullPts [ i ] . get ( j ) ; s . x += b * p . x ; s . y += b * p . y ; s . z += b * p . z ; } } } | Computes the camera control points as weighted sum of null points . |
26,907 | public static void constraintMatrix6x3 ( DMatrixRMaj L_6x10 , DMatrixRMaj L_6x3 ) { int index = 0 ; for ( int i = 0 ; i < 6 ; i ++ ) { L_6x3 . data [ index ++ ] = L_6x10 . get ( i , 0 ) ; L_6x3 . data [ index ++ ] = L_6x10 . get ( i , 1 ) ; L_6x3 . data [ index ++ ] = L_6x10 . get ( i , 4 ) ; } } | Extracts the linear constraint matrix for case 2 from the full 6x10 constraint matrix . |
26,908 | public static void constraintMatrix6x6 ( DMatrixRMaj L_6x10 , DMatrixRMaj L_6x6 ) { int index = 0 ; for ( int i = 0 ; i < 6 ; i ++ ) { L_6x6 . data [ index ++ ] = L_6x10 . get ( i , 0 ) ; L_6x6 . data [ index ++ ] = L_6x10 . get ( i , 1 ) ; L_6x6 . data [ index ++ ] = L_6x10 . get ( i , 2 ) ; L_6x6 . data [ index ++ ] = L_6x10 . get ( i , 4 ) ; L_6x6 . data [ index ++ ] = L_6x10 . get ( i , 5 ) ; L_6x6 . data [ index ++ ] = L_6x10 . get ( i , 7 ) ; } } | Extracts the linear constraint matrix for case 3 from the full 6x10 constraint matrix . |
26,909 | public static void constraintMatrix3x3 ( DMatrixRMaj L_3x6 , DMatrixRMaj L_6x3 ) { int index = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { L_6x3 . data [ index ++ ] = L_3x6 . get ( i , 0 ) ; L_6x3 . data [ index ++ ] = L_3x6 . get ( i , 1 ) ; L_6x3 . data [ index ++ ] = L_3x6 . get ( i , 3 ) ; } } | Extracts the linear constraint matrix for planar case 2 from the full 4x6 constraint matrix . |
26,910 | public static void constraintMatrix3x6 ( DMatrixRMaj L , DMatrixRMaj y , FastQueue < Point3D_F64 > controlWorldPts , List < Point3D_F64 > nullPts [ ] ) { int row = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { Point3D_F64 ci = controlWorldPts . get ( i ) ; Point3D_F64 vai = nullPts [ 0 ] . get ( i ) ; Point3D_F64 vbi = nullPts [ 1 ] . get ( i ) ; Point3D_F64 vci = nullPts [ 2 ] . get ( i ) ; for ( int j = i + 1 ; j < 3 ; j ++ , row ++ ) { Point3D_F64 cj = controlWorldPts . get ( j ) ; Point3D_F64 vaj = nullPts [ 0 ] . get ( j ) ; Point3D_F64 vbj = nullPts [ 1 ] . get ( j ) ; Point3D_F64 vcj = nullPts [ 2 ] . get ( j ) ; y . set ( row , 0 , ci . distance2 ( cj ) ) ; double xa = vai . x - vaj . x ; double ya = vai . y - vaj . y ; double za = vai . z - vaj . z ; double xb = vbi . x - vbj . x ; double yb = vbi . y - vbj . y ; double zb = vbi . z - vbj . z ; double xc = vci . x - vcj . x ; double yc = vci . y - vcj . y ; double zc = vci . z - vcj . z ; double da = xa * xa + ya * ya + za * za ; double db = xb * xb + yb * yb + zb * zb ; double dc = xc * xc + yc * yc + zc * zc ; double dab = xa * xb + ya * yb + za * zb ; double dac = xa * xc + ya * yc + za * zc ; double dbc = xb * xc + yb * yc + zb * zc ; L . set ( row , 0 , da ) ; L . set ( row , 1 , 2 * dab ) ; L . set ( row , 2 , 2 * dac ) ; L . set ( row , 3 , db ) ; L . set ( row , 4 , 2 * dbc ) ; L . set ( row , 5 , dc ) ; } } } | Linear constraint matrix for case 4 in the planar case |
26,911 | public static void jacobian_Control4 ( DMatrixRMaj L_full , double beta [ ] , DMatrixRMaj A ) { int indexA = 0 ; double b0 = beta [ 0 ] ; double b1 = beta [ 1 ] ; double b2 = beta [ 2 ] ; double b3 = beta [ 3 ] ; final double ld [ ] = L_full . data ; for ( int i = 0 ; i < 6 ; i ++ ) { int li = L_full . numCols * i ; A . data [ indexA ++ ] = 2 * ld [ li + 0 ] * b0 + ld [ li + 1 ] * b1 + ld [ li + 2 ] * b2 + ld [ li + 3 ] * b3 ; A . data [ indexA ++ ] = ld [ li + 1 ] * b0 + 2 * ld [ li + 4 ] * b1 + ld [ li + 5 ] * b2 + ld [ li + 6 ] * b3 ; A . data [ indexA ++ ] = ld [ li + 2 ] * b0 + ld [ li + 5 ] * b1 + 2 * ld [ li + 7 ] * b2 + ld [ li + 8 ] * b3 ; A . data [ indexA ++ ] = ld [ li + 3 ] * b0 + ld [ li + 6 ] * b1 + ld [ li + 8 ] * b2 + 2 * ld [ li + 9 ] * b3 ; } } | Computes the Jacobian given 4 control points . |
26,912 | public static void jacobian_Control3 ( DMatrixRMaj L_full , double beta [ ] , DMatrixRMaj A ) { int indexA = 0 ; double b0 = beta [ 0 ] ; double b1 = beta [ 1 ] ; double b2 = beta [ 2 ] ; final double ld [ ] = L_full . data ; for ( int i = 0 ; i < 3 ; i ++ ) { int li = L_full . numCols * i ; A . data [ indexA ++ ] = 2 * ld [ li + 0 ] * b0 + ld [ li + 1 ] * b1 + ld [ li + 2 ] * b2 ; A . data [ indexA ++ ] = ld [ li + 1 ] * b0 + 2 * ld [ li + 3 ] * b1 + ld [ li + 4 ] * b2 ; A . data [ indexA ++ ] = ld [ li + 2 ] * b0 + ld [ li + 4 ] * b1 + 2 * ld [ li + 5 ] * b2 ; } } | Computes the Jacobian given 3 control points . |
26,913 | public void process ( ImagePyramid < T > pyramidPrev , ImagePyramid < T > pyramidCurr ) { InputSanityCheck . checkSameShape ( pyramidPrev , pyramidCurr ) ; int numLayers = pyramidPrev . getNumLayers ( ) ; for ( int i = numLayers - 1 ; i >= 0 ; i -- ) { T prev = pyramidPrev . getLayer ( i ) ; T curr = pyramidCurr . getLayer ( i ) ; flowCurrLayer . reshape ( prev . width , prev . height ) ; int N = prev . width * prev . height ; if ( scores . length < N ) scores = new float [ N ] ; Arrays . fill ( scores , 0 , N , Float . MAX_VALUE ) ; int x1 = prev . width - regionRadius ; int y1 = prev . height - regionRadius ; if ( i == numLayers - 1 ) { for ( int y = regionRadius ; y < y1 ; y ++ ) { for ( int x = regionRadius ; x < x1 ; x ++ ) { extractTemplate ( x , y , prev ) ; float score = findFlow ( x , y , curr , tmp ) ; if ( tmp . isValid ( ) ) checkNeighbors ( x , y , tmp , flowCurrLayer , score ) ; else flowCurrLayer . unsafe_get ( x , y ) . markInvalid ( ) ; } } } else { double scale = pyramidPrev . getScale ( i + 1 ) / pyramidPrev . getScale ( i ) ; for ( int y = regionRadius ; y < y1 ; y ++ ) { for ( int x = regionRadius ; x < x1 ; x ++ ) { ImageFlow . D p = flowPrevLayer . get ( ( int ) ( x / scale ) , ( int ) ( y / scale ) ) ; if ( ! p . isValid ( ) ) continue ; extractTemplate ( x , y , prev ) ; int deltaX = ( int ) ( p . x * scale + 0.5 ) ; int deltaY = ( int ) ( p . y * scale + 0.5 ) ; int startX = x + deltaX ; int startY = y + deltaY ; float score = findFlow ( startX , startY , curr , tmp ) ; tmp . x += deltaX ; tmp . y += deltaY ; if ( tmp . isValid ( ) ) checkNeighbors ( x , y , tmp , flowCurrLayer , score ) ; else flowCurrLayer . unsafe_get ( x , y ) . markInvalid ( ) ; } } } ImageFlow tmp = flowPrevLayer ; flowPrevLayer = flowCurrLayer ; flowCurrLayer = tmp ; } } | Computes the optical flow form prev to curr and stores the output into output |
26,914 | public void setDirection ( double yaw , double pitch , double roll ) { ConvertRotation3D_F64 . eulerToMatrix ( EulerType . YZX , pitch , yaw , roll , R ) ; } | Specifies the rotation offset from the canonical location using yaw and pitch . |
26,915 | protected void declareVectors ( int width , int height ) { this . outWidth = width ; if ( vectors . length < width * height ) { Point3D_F64 [ ] tmp = new Point3D_F64 [ width * height ] ; System . arraycopy ( vectors , 0 , tmp , 0 , vectors . length ) ; for ( int i = vectors . length ; i < tmp . length ; i ++ ) { tmp [ i ] = new Point3D_F64 ( ) ; } vectors = tmp ; } } | Declares storage for precomputed pointing vectors to output image |
26,916 | public void polyScale ( GrowQueue_I8 input , int scale , GrowQueue_I8 output ) { output . resize ( input . size ) ; for ( int i = 0 ; i < input . size ; i ++ ) { output . data [ i ] = ( byte ) multiply ( input . data [ i ] & 0xFF , scale ) ; } } | Scales the polynomial . |
26,917 | public void polyAdd ( GrowQueue_I8 polyA , GrowQueue_I8 polyB , GrowQueue_I8 output ) { output . resize ( Math . max ( polyA . size , polyB . size ) ) ; int offsetA = Math . max ( 0 , polyB . size - polyA . size ) ; int offsetB = Math . max ( 0 , polyA . size - polyB . size ) ; int N = output . size ; for ( int i = 0 ; i < offsetB ; i ++ ) { output . data [ i ] = polyA . data [ i ] ; } for ( int i = 0 ; i < offsetA ; i ++ ) { output . data [ i ] = polyB . data [ i ] ; } for ( int i = Math . max ( offsetA , offsetB ) ; i < N ; i ++ ) { output . data [ i ] = ( byte ) ( ( polyA . data [ i - offsetA ] & 0xFF ) ^ ( polyB . data [ i - offsetB ] & 0xFF ) ) ; } } | Adds two polynomials together . output = polyA + polyB |
26,918 | public void polyAdd_S ( GrowQueue_I8 polyA , GrowQueue_I8 polyB , GrowQueue_I8 output ) { output . resize ( Math . max ( polyA . size , polyB . size ) ) ; int M = Math . min ( polyA . size , polyB . size ) ; for ( int i = M ; i < polyA . size ; i ++ ) { output . data [ i ] = polyA . data [ i ] ; } for ( int i = M ; i < polyB . size ; i ++ ) { output . data [ i ] = polyB . data [ i ] ; } for ( int i = 0 ; i < M ; i ++ ) { output . data [ i ] = ( byte ) ( ( polyA . data [ i ] & 0xFF ) ^ ( polyB . data [ i ] & 0xFF ) ) ; } } | Adds two polynomials together . |
26,919 | public void polyAddScaleB ( GrowQueue_I8 polyA , GrowQueue_I8 polyB , int scaleB , GrowQueue_I8 output ) { output . resize ( Math . max ( polyA . size , polyB . size ) ) ; int offsetA = Math . max ( 0 , polyB . size - polyA . size ) ; int offsetB = Math . max ( 0 , polyA . size - polyB . size ) ; int N = output . size ; for ( int i = 0 ; i < offsetB ; i ++ ) { output . data [ i ] = polyA . data [ i ] ; } for ( int i = 0 ; i < offsetA ; i ++ ) { output . data [ i ] = ( byte ) multiply ( polyB . data [ i ] & 0xFF , scaleB ) ; } for ( int i = Math . max ( offsetA , offsetB ) ; i < N ; i ++ ) { output . data [ i ] = ( byte ) ( ( polyA . data [ i - offsetA ] & 0xFF ) ^ multiply ( polyB . data [ i - offsetB ] & 0xFF , scaleB ) ) ; } } | Adds two polynomials together while scaling the second . |
26,920 | public int polyEval ( GrowQueue_I8 input , int x ) { int y = input . data [ 0 ] & 0xFF ; for ( int i = 1 ; i < input . size ; i ++ ) { y = multiply ( y , x ) ^ ( input . data [ i ] & 0xFF ) ; } return y ; } | Evaluate the polynomial using Horner s method . Avoids explicit calculating the powers of x . |
26,921 | public int polyEvalContinue ( int previousOutput , GrowQueue_I8 part , int x ) { int y = previousOutput ; for ( int i = 0 ; i < part . size ; i ++ ) { y = multiply ( y , x ) ^ ( part . data [ i ] & 0xFF ) ; } return y ; } | Continue evaluating a polynomial which has been broken up into multiple arrays . |
26,922 | public void polyDivide ( GrowQueue_I8 dividend , GrowQueue_I8 divisor , GrowQueue_I8 quotient , GrowQueue_I8 remainder ) { if ( divisor . size > dividend . size ) { remainder . setTo ( dividend ) ; quotient . resize ( 0 ) ; return ; } else { remainder . resize ( divisor . size - 1 ) ; quotient . setTo ( dividend ) ; } int normalizer = divisor . data [ 0 ] & 0xFF ; int N = dividend . size - divisor . size + 1 ; for ( int i = 0 ; i < N ; i ++ ) { quotient . data [ i ] = ( byte ) divide ( quotient . data [ i ] & 0xFF , normalizer ) ; int coef = quotient . data [ i ] & 0xFF ; if ( coef != 0 ) { for ( int j = 1 ; j < divisor . size ; j ++ ) { int div_j = divisor . data [ j ] & 0xFF ; if ( div_j != 0 ) { quotient . data [ i + j ] ^= multiply ( div_j , coef ) ; } } } } System . arraycopy ( quotient . data , quotient . size - remainder . size , remainder . data , 0 , remainder . size ) ; quotient . size -= remainder . size ; } | Performs polynomial division using a synthetic division algorithm . |
26,923 | public static ConfigQrCode fast ( ) { ConfigQrCode config = new ConfigQrCode ( ) ; config . threshold = ConfigThreshold . global ( ThresholdType . GLOBAL_OTSU ) ; return config ; } | Default configuration for a QR Code detector which is optimized for speed |
26,924 | private void drawDistribution ( Graphics2D g2 , List < Point2D_F64 > candidates , int offX , int offY , double scale ) { findStatistics ( ) ; g2 . setColor ( Color . RED ) ; g2 . setStroke ( new BasicStroke ( 3 ) ) ; double normalizer ; if ( scorer . getScoreType ( ) . isZeroBest ( ) ) normalizer = best * containmentFraction ; else normalizer = Math . abs ( best ) * ( Math . exp ( - 1.0 / containmentFraction ) ) ; for ( int i = 0 ; i < candidates . size ( ) ; i ++ ) { Point2D_F64 p = candidates . get ( i ) ; double s = associationScore [ i ] ; double ratio = 1 - Math . abs ( s - best ) / normalizer ; if ( ratio < 0 ) continue ; int r = maxCircleRadius - ( int ) ( maxCircleRadius * ratio ) ; if ( r > 0 ) { int x = ( int ) ( p . x * scale + offX ) ; int y = ( int ) ( p . y * scale + offY ) ; g2 . drawOval ( x - r , y - r , r * 2 + 1 , r * 2 + 1 ) ; } } g2 . setColor ( Color . GREEN ) ; g2 . setStroke ( new BasicStroke ( 10 ) ) ; int w = maxCircleRadius * 2 + 1 ; Point2D_F64 p = candidates . get ( indexBest ) ; int x = ( int ) ( p . x * scale + offX ) ; int y = ( int ) ( p . y * scale + offY ) ; g2 . drawOval ( x - maxCircleRadius , y - maxCircleRadius , w , w ) ; } | Visualizes score distribution . Larger circles mean its closer to the best fit score . |
26,925 | public void process ( List < ChessboardCorner > corners ) { this . corners = corners ; vertexes . reset ( ) ; edges . reset ( ) ; clusters . reset ( ) ; for ( int idx = 0 ; idx < corners . size ( ) ; idx ++ ) { Vertex v = vertexes . grow ( ) ; v . reset ( ) ; v . index = idx ; } nn . setPoints ( corners , true ) ; for ( int i = 0 ; i < corners . size ( ) ; i ++ ) { findVertexNeighbors ( vertexes . get ( i ) , corners ) ; } handleAmbiguousVertexes ( corners ) ; for ( int i = 0 ; i < vertexes . size ; i ++ ) { Vertex v = vertexes . get ( i ) ; v . pruneNonMutal ( EdgeType . PARALLEL ) ; v . pruneNonMutal ( EdgeType . PERPENDICULAR ) ; } for ( int idx = 0 ; idx < vertexes . size ( ) ; idx ++ ) { selectConnections ( vertexes . get ( idx ) ) ; } dirtyVertexes . clear ( ) ; for ( int i = 0 ; i < vertexes . size ; i ++ ) { Vertex v = vertexes . get ( i ) ; int before = v . connections . size ( ) ; v . pruneNonMutal ( EdgeType . CONNECTION ) ; if ( before != v . connections . size ( ) ) { dirtyVertexes . add ( v ) ; v . marked = true ; } } repairVertexes ( ) ; for ( int i = 0 ; i < dirtyVertexes . size ( ) ; i ++ ) { dirtyVertexes . get ( i ) . pruneNonMutal ( EdgeType . CONNECTION ) ; dirtyVertexes . get ( i ) . marked = false ; } disconnectInvalidVertices ( ) ; convertToOutput ( corners ) ; } | Processes corners and finds clusters of chessboard patterns |
26,926 | public void printDualGraph ( ) { System . out . println ( "============= Dual" ) ; int l = BoofMiscOps . numDigits ( vertexes . size ) ; String format = "%" + l + "d" ; for ( Vertex n : vertexes . toList ( ) ) { ChessboardCorner c = corners . get ( n . index ) ; System . out . printf ( "[" + format + "] {%3.0f, %3.0f} -> 90[ " , n . index , c . x , c . y ) ; for ( int i = 0 ; i < n . perpendicular . size ( ) ; i ++ ) { Edge e = n . perpendicular . get ( i ) ; System . out . printf ( format + " " , e . dst . index ) ; } System . out . println ( "]" ) ; System . out . print ( " -> 180[ " ) ; for ( int i = 0 ; i < n . parallel . size ( ) ; i ++ ) { Edge e = n . parallel . get ( i ) ; System . out . printf ( format + " " , e . dst . index ) ; } System . out . println ( "]" ) ; } } | Prints the graph . Used for debugging the code . |
26,927 | void findVertexNeighbors ( Vertex target , List < ChessboardCorner > corners ) { ChessboardCorner targetCorner = corners . get ( target . index ) ; double maxDist = Double . MAX_VALUE == maxNeighborDistance ? maxNeighborDistance : maxNeighborDistance * maxNeighborDistance ; nnSearch . findNearest ( corners . get ( target . index ) , maxDist , maxNeighbors , nnResults ) ; distanceTmp . reset ( ) ; for ( int i = 0 ; i < nnResults . size ; i ++ ) { NnData < ChessboardCorner > r = nnResults . get ( i ) ; if ( r . index == target . index ) continue ; distanceTmp . add ( r . distance ) ; double oriDiff = UtilAngle . distHalf ( targetCorner . orientation , r . point . orientation ) ; Edge edge = edges . grow ( ) ; boolean parallel ; if ( oriDiff <= orientationTol ) { parallel = true ; } else if ( Math . abs ( oriDiff - Math . PI / 2.0 ) <= orientationTol ) { parallel = false ; } else { edges . removeTail ( ) ; continue ; } double dx = r . point . x - targetCorner . x ; double dy = r . point . y - targetCorner . y ; edge . distance = Math . sqrt ( r . distance ) ; edge . dst = vertexes . get ( r . index ) ; edge . direction = Math . atan2 ( dy , dx ) ; double direction180 = UtilAngle . boundHalf ( edge . direction ) ; double directionDiff = UtilAngle . distHalf ( direction180 , r . point . orientation ) ; boolean remove ; EdgeSet edgeSet ; if ( parallel ) { remove = directionDiff > 2 * directionTol && Math . abs ( directionDiff - Math . PI / 2.0 ) > 2 * directionTol ; edgeSet = target . parallel ; } else { remove = Math . abs ( directionDiff - Math . PI / 4.0 ) > 2 * directionTol ; edgeSet = target . perpendicular ; } if ( remove ) { edges . removeTail ( ) ; continue ; } edgeSet . add ( edge ) ; } if ( distanceTmp . size == 0 ) { target . neighborDistance = 0 ; } else { sorter . sort ( distanceTmp . data , distanceTmp . size ) ; int idx = Math . min ( 3 , distanceTmp . size - 1 ) ; target . neighborDistance = Math . sqrt ( distanceTmp . data [ idx ] ) ; } } | Use nearest neighbor search to find closest corners . Split those into two groups parallel and perpendicular . |
26,928 | void handleAmbiguousVertexes ( List < ChessboardCorner > corners ) { List < Vertex > candidates = new ArrayList < > ( ) ; for ( int idx = 0 ; idx < vertexes . size ( ) ; idx ++ ) { Vertex target = vertexes . get ( idx ) ; double threshold = target . neighborDistance * ambiguousTol ; candidates . clear ( ) ; for ( int i = 0 ; i < target . parallel . size ( ) ; i ++ ) { Edge c = target . parallel . get ( i ) ; if ( c . distance <= threshold ) { candidates . add ( c . dst ) ; } } if ( candidates . size ( ) > 0 ) { candidates . add ( target ) ; int bestIndex = - 1 ; double bestScore = 0 ; for ( int i = 0 ; i < candidates . size ( ) ; i ++ ) { Vertex v = candidates . get ( i ) ; double intensity = corners . get ( v . index ) . intensity ; if ( intensity > bestScore ) { bestScore = intensity ; bestIndex = i ; } } for ( int i = 0 ; i < candidates . size ( ) ; i ++ ) { if ( i == bestIndex ) continue ; removeReferences ( candidates . get ( i ) , EdgeType . PARALLEL ) ; removeReferences ( candidates . get ( i ) , EdgeType . PERPENDICULAR ) ; } } } } | Identify ambiguous vertexes which are too close to each other . Select the corner with the highest intensity score and remove the rest |
26,929 | void disconnectInvalidVertices ( ) { openVertexes . clear ( ) ; for ( int idxVert = 0 ; idxVert < vertexes . size ; idxVert ++ ) { Vertex n = vertexes . get ( idxVert ) ; if ( n . connections . size ( ) == 1 || n . connections . size ( ) == 2 ) { openVertexes . add ( n ) ; } } while ( ! openVertexes . isEmpty ( ) ) { dirtyVertexes . clear ( ) ; for ( int idxVert = 0 ; idxVert < openVertexes . size ( ) ; idxVert ++ ) { boolean remove = false ; Vertex n = openVertexes . get ( idxVert ) ; if ( n . connections . size ( ) == 1 ) { remove = true ; } else if ( n . connections . size ( ) == 2 ) { Edge ea = n . connections . get ( 0 ) ; Edge eb = n . connections . get ( 1 ) ; remove = true ; for ( int i = 0 ; i < ea . dst . connections . size ( ) ; i ++ ) { Vertex va = ea . dst . connections . get ( i ) . dst ; if ( va == n ) continue ; for ( int j = 0 ; j < eb . dst . connections . size ( ) ; j ++ ) { Vertex vb = ea . dst . connections . get ( j ) . dst ; if ( va == vb ) { remove = false ; break ; } } } } if ( remove ) { for ( int i = 0 ; i < n . connections . size ( ) ; i ++ ) { dirtyVertexes . add ( n . connections . get ( i ) . dst ) ; } removeReferences ( n , EdgeType . CONNECTION ) ; } } openVertexes . clear ( ) ; openVertexes . addAll ( dirtyVertexes ) ; } } | Disconnect the edges from invalid vertices . Invalid ones have only one edge or two edges which do not connect to a common vertex i . e . they are point 180 degrees away from each other . |
26,930 | void removeReferences ( Vertex remove , EdgeType type ) { EdgeSet removeSet = remove . getEdgeSet ( type ) ; for ( int i = removeSet . size ( ) - 1 ; i >= 0 ; i -- ) { Vertex v = removeSet . get ( i ) . dst ; EdgeSet setV = v . getEdgeSet ( type ) ; int ridx = setV . find ( remove ) ; if ( ridx != - 1 ) setV . edges . remove ( ridx ) ; } removeSet . reset ( ) ; } | Go through all the vertexes that remove is connected to and remove that link . if it is in the connected list swap it with replaceWith . |
26,931 | void selectConnections ( Vertex target ) { if ( target . perpendicular . size ( ) <= 1 ) return ; double bestError = Double . MAX_VALUE ; List < Edge > bestSolution = target . connections . edges ; for ( int i = 0 ; i < target . perpendicular . size ( ) ; i ++ ) { Edge e = target . perpendicular . get ( i ) ; solution . clear ( ) ; solution . add ( e ) ; double sumDistance = solution . get ( 0 ) . distance ; double minDistance = sumDistance ; if ( ! findNext ( i , target . parallel , target . perpendicular , Double . NaN , results ) ) { continue ; } solution . add ( target . perpendicular . get ( results . index ) ) ; sumDistance += solution . get ( 1 ) . distance ; minDistance = Math . min ( minDistance , solution . get ( 1 ) . distance ) ; if ( findNext ( results . index , target . parallel , target . perpendicular , solution . get ( 0 ) . direction , results ) ) { solution . add ( target . perpendicular . get ( results . index ) ) ; sumDistance += solution . get ( 2 ) . distance ; minDistance = Math . min ( minDistance , solution . get ( 2 ) . distance ) ; if ( findNext ( results . index , target . parallel , target . perpendicular , solution . get ( 1 ) . direction , results ) ) { solution . add ( target . perpendicular . get ( results . index ) ) ; sumDistance += solution . get ( 3 ) . distance ; minDistance = Math . min ( minDistance , solution . get ( 3 ) . distance ) ; } } double error = ( sumDistance + minDistance ) / ( solution . size ( ) * solution . size ( ) ) ; if ( error < bestError ) { bestError = error ; bestSolution . clear ( ) ; bestSolution . addAll ( solution ) ; } } } | Select the best 2 3 or 4 perpendicular vertexes to connect to . These are the output grid connections . |
26,932 | boolean findNext ( int firstIdx , EdgeSet splitterSet , EdgeSet candidateSet , double parallel , SearchResults results ) { Edge e0 = candidateSet . get ( firstIdx ) ; results . index = - 1 ; results . error = Double . MAX_VALUE ; boolean checkParallel = ! Double . isNaN ( parallel ) ; for ( int i = 0 ; i < candidateSet . size ( ) ; i ++ ) { if ( i == firstIdx ) continue ; Edge eI = candidateSet . get ( i ) ; double distanceCCW = UtilAngle . distanceCCW ( e0 . direction , eI . direction ) ; if ( distanceCCW >= Math . PI * 0.9 ) continue ; if ( checkParallel ) { double a = UtilAngle . boundHalf ( eI . direction ) ; double b = UtilAngle . boundHalf ( parallel ) ; double distanceParallel = UtilAngle . distHalf ( a , b ) ; if ( distanceParallel > parallelTol ) { continue ; } } if ( ! findSplitter ( e0 . direction , eI . direction , splitterSet , e0 . dst . perpendicular , eI . dst . perpendicular , tuple3 ) ) continue ; double acute0 = UtilAngle . dist ( candidateSet . get ( firstIdx ) . direction , e0 . dst . perpendicular . get ( tuple3 . b ) . direction ) ; double error0 = UtilAngle . dist ( acute0 , Math . PI / 2.0 ) ; if ( error0 > Math . PI * 0.3 ) continue ; double acute1 = UtilAngle . dist ( candidateSet . get ( i ) . direction , eI . dst . perpendicular . get ( tuple3 . c ) . direction ) ; double error1 = UtilAngle . dist ( acute1 , Math . PI / 2.0 ) ; if ( error1 > Math . PI * 0.3 ) continue ; int e0_to_eI = e0 . dst . parallel . find ( eI . dst ) ; if ( e0_to_eI < 0 ) continue ; double error = e0 . dst . perpendicular . get ( tuple3 . b ) . distance ; error += eI . dst . perpendicular . get ( tuple3 . c ) . distance ; error += eI . distance ; if ( error < results . error ) { results . error = error ; results . index = i ; } } return results . index != - 1 ; } | Greedily select the next edge that will belong to the final graph . |
26,933 | boolean findSplitter ( double ccw0 , double ccw1 , EdgeSet master , EdgeSet other1 , EdgeSet other2 , TupleI32 output ) { double bestDistance = Double . MAX_VALUE ; for ( int i = 0 ; i < master . size ( ) ; i ++ ) { Edge me = master . get ( i ) ; if ( UtilAngle . distanceCCW ( ccw0 , me . direction ) > Math . PI * 0.9 || UtilAngle . distanceCW ( ccw1 , me . direction ) > Math . PI * 0.9 ) continue ; int idxB = other1 . find ( me . dst ) ; if ( idxB == - 1 ) continue ; double thetaB = UtilAngle . distanceCCW ( ccw0 , other1 . get ( idxB ) . direction ) ; if ( thetaB < 0.05 ) continue ; int idxC = other2 . find ( me . dst ) ; if ( idxC == - 1 ) continue ; double thetaC = UtilAngle . distanceCW ( ccw1 , other2 . get ( idxC ) . direction ) ; if ( thetaC < 0.05 ) continue ; double error = me . distance / ( 0.5 + Math . min ( thetaB , thetaC ) ) ; if ( error < bestDistance ) { bestDistance = error ; output . a = i ; output . b = idxB ; output . c = idxC ; } } if ( bestDistance < Double . MAX_VALUE ) { double pointingB = other1 . edges . get ( output . b ) . direction ; double pointingC = other2 . edges . get ( output . c ) . direction ; return UtilAngle . distanceCW ( pointingB , pointingC ) < Math . PI ; } else { return false ; } } | Splitter is a vertex that has an angle between two edges being considered . |
26,934 | private void repairVertexes ( ) { for ( int idxV = 0 ; idxV < dirtyVertexes . size ( ) ; idxV ++ ) { final Vertex v = dirtyVertexes . get ( idxV ) ; bestSolution . clear ( ) ; for ( int idxE = 0 ; idxE < v . perpendicular . size ( ) ; idxE ++ ) { Edge e = v . perpendicular . get ( idxE ) ; if ( ! ( e . dst . marked || - 1 != v . connections . find ( e . dst ) ) ) { continue ; } solution . clear ( ) ; solution . add ( e ) ; for ( int count = 0 ; count < 3 ; count ++ ) { Vertex va = null ; double dir90 = UtilAngle . bound ( e . direction + Math . PI / 2.0 ) ; for ( int i = 0 ; i < e . dst . connections . size ( ) ; i ++ ) { Edge ei = e . dst . connections . get ( i ) ; if ( UtilAngle . dist ( ei . direction , dir90 ) < Math . PI / 3 ) { va = ei . dst ; break ; } } boolean matched = false ; for ( int i = 0 ; i < v . perpendicular . size ( ) ; i ++ ) { Edge ei = v . perpendicular . get ( i ) ; if ( e == ei ) continue ; double ccw = UtilAngle . distanceCCW ( e . direction , ei . direction ) ; if ( ccw > Math . PI * 0.9 ) continue ; if ( ! ( ei . dst . marked || - 1 != v . connections . find ( ei . dst ) ) ) { continue ; } if ( ei . dst . connections . find ( va ) != - 1 ) { e = ei ; solution . add ( ei ) ; matched = true ; break ; } } if ( ! matched ) break ; } if ( solution . size ( ) > bestSolution . size ( ) ) { bestSolution . clear ( ) ; bestSolution . addAll ( solution ) ; } } if ( bestSolution . size ( ) > 1 ) { for ( int i = 0 ; i < v . connections . edges . size ( ) ; i ++ ) { if ( ! bestSolution . contains ( v . connections . edges . get ( i ) ) ) { v . connections . edges . get ( i ) . dst . marked = true ; break ; } } v . connections . edges . clear ( ) ; v . connections . edges . addAll ( bestSolution ) ; } } } | Given the current graph attempt to replace edges from vertexes which lost them in an apparent bad decision . This is a very simple algorithm and gives up if the graph around the current node is less than perfect . |
26,935 | private void convertToOutput ( List < ChessboardCorner > corners ) { c2n . resize ( corners . size ( ) ) ; n2c . resize ( vertexes . size ( ) ) ; open . reset ( ) ; n2c . fill ( - 1 ) ; c2n . fill ( - 1 ) ; for ( int seedIdx = 0 ; seedIdx < vertexes . size ; seedIdx ++ ) { Vertex seedN = vertexes . get ( seedIdx ) ; if ( seedN . marked ) continue ; ChessboardCornerGraph graph = clusters . grow ( ) ; graph . reset ( ) ; growCluster ( corners , seedIdx , graph ) ; for ( int i = 0 ; i < graph . corners . size ; i ++ ) { ChessboardCornerGraph . Node gn = graph . corners . get ( i ) ; Vertex n = vertexes . get ( n2c . get ( i ) ) ; for ( int j = 0 ; j < n . connections . size ( ) ; j ++ ) { int edgeCornerIdx = n . connections . get ( j ) . dst . index ; int outputIdx = c2n . get ( edgeCornerIdx ) ; if ( outputIdx == - 1 ) { throw new IllegalArgumentException ( "Edge to node not in the graph. n.idx=" + n . index + " conn.idx=" + edgeCornerIdx ) ; } gn . edges [ j ] = graph . corners . get ( outputIdx ) ; } } for ( int i = 0 ; i < graph . corners . size ; i ++ ) { ChessboardCornerGraph . Node gn = graph . corners . get ( i ) ; int indexCorner = n2c . get ( gn . index ) ; c2n . data [ indexCorner ] = - 1 ; n2c . data [ gn . index ] = - 1 ; } if ( graph . corners . size <= 1 ) clusters . removeTail ( ) ; } } | Converts the internal graphs into unordered chessboard grids . |
26,936 | private void growCluster ( List < ChessboardCorner > corners , int seedIdx , ChessboardCornerGraph graph ) { open . add ( seedIdx ) ; while ( open . size > 0 ) { int cornerIdx = open . pop ( ) ; Vertex v = vertexes . get ( cornerIdx ) ; if ( v . marked ) continue ; v . marked = true ; ChessboardCornerGraph . Node gn = graph . growCorner ( ) ; c2n . data [ cornerIdx ] = gn . index ; n2c . data [ gn . index ] = cornerIdx ; gn . set ( corners . get ( cornerIdx ) ) ; for ( int i = 0 ; i < v . connections . size ( ) ; i ++ ) { Vertex dst = v . connections . get ( i ) . dst ; if ( dst . marked ) continue ; open . add ( dst . index ) ; } } } | Given the initial seed add all connected nodes to the output cluster while keeping track of how to convert one node index into another one between the two graphs |
26,937 | public void setTransform ( PixelTransform < Point2D_F32 > undistToDist ) { if ( undistToDist != null ) { InterpolatePixelS < T > interpolate = FactoryInterpolation . bilinearPixelS ( imageType , BorderType . EXTENDED ) ; integralImage = new GImageGrayDistorted < > ( undistToDist , interpolate ) ; } else { integralImage = FactoryGImageGray . create ( imageType ) ; } } | Used to specify a transform that is applied to pixel coordinates to bring them back into original input image coordinates . For example if the input image has lens distortion but the edge were found in undistorted coordinates this code needs to know how to go from undistorted back into distorted image coordinates in order to read the pixel s value . |
26,938 | public void process ( Point3D_F64 e2 , Point3D_F64 e3 , DMatrixRMaj A ) { constructE ( e2 , e3 ) ; svdU . decompose ( E ) ; svdU . getU ( U , false ) ; SingularOps_DDRM . descendingOrder ( U , false , svdU . getSingularValues ( ) , svdU . numberOfSingularValues ( ) , null , false ) ; int rank = SingularOps_DDRM . rank ( svdU , 1e-13 ) ; Up . reshape ( U . numRows , rank ) ; CommonOps_DDRM . extract ( U , 0 , U . numRows , 0 , Up . numCols , Up , 0 , 0 ) ; AU . reshape ( A . numRows , Up . numCols ) ; CommonOps_DDRM . mult ( A , Up , AU ) ; svdV . decompose ( AU ) ; xp . reshape ( rank , 1 ) ; SingularOps_DDRM . nullVector ( svdV , true , xp ) ; CommonOps_DDRM . mult ( Up , xp , vectorT ) ; if ( vectorT . data [ 0 ] > 0 ) CommonOps_DDRM . changeSign ( vectorT ) ; } | Computes a trifocal tensor which minimizes the algebraic error given the two epipoles and the linear constraint matrix . The epipoles are from a previously computed trifocal tensor . |
26,939 | protected void constructE ( Point3D_F64 e2 , Point3D_F64 e3 ) { E . zero ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k < 3 ; k ++ ) { int row = 9 * i + 3 * j + k ; int col1 = j * 3 + i ; int col2 = k * 3 + i + 9 ; E . data [ row * 18 + col1 ] = e3 . getIdx ( k ) ; E . data [ row * 18 + col2 ] = - e2 . getIdx ( j ) ; } } } } | The matrix E is a linear system for computing the trifocal tensor . The columns are the unknown square matrices from view 2 and 3 . The right most column in both projection matrices are the provided epipoles whose values are inserted into E |
26,940 | public TrifocalTensor copy ( ) { TrifocalTensor ret = new TrifocalTensor ( ) ; ret . T1 . set ( T1 ) ; ret . T2 . set ( T2 ) ; ret . T3 . set ( T3 ) ; return ret ; } | Returns a new copy of the TrifocalTensor |
26,941 | public void setImages ( Input left , Input right ) { InputSanityCheck . checkSameShape ( left , right ) ; this . left = left ; this . right = right ; } | Specify inputs for left and right camera images . |
26,942 | protected < T extends ImageBase > ImageType < T > getImageType ( int which ) { synchronized ( inputStreams ) { return inputStreams . get ( which ) . imageType ; } } | Get input input type for a stream safely |
26,943 | private void updateRecentItems ( ) { if ( menuRecent == null ) return ; menuRecent . removeAll ( ) ; List < String > recentFiles = BoofSwingUtil . getListOfRecentFiles ( this ) ; for ( String filePath : recentFiles ) { final File f = new File ( filePath ) ; JMenuItem recentItem = new JMenuItem ( f . getName ( ) ) ; recentItem . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent e ) { openFile ( f ) ; } } ) ; menuRecent . add ( recentItem ) ; } } | Updates the list in recent menu |
26,944 | public void openExample ( Object o ) { if ( o instanceof PathLabel ) { PathLabel p = ( PathLabel ) o ; if ( p . path . length == 1 ) openFile ( new File ( p . path [ 0 ] ) ) ; else { openImageSet ( p . path ) ; } } else if ( o instanceof String ) { openFile ( new File ( ( String ) o ) ) ; } else { throw new IllegalArgumentException ( "Unknown example object type. Please override openExample()" ) ; } } | Function that is invoked when an example has been selected |
26,945 | public void stopAllInputProcessing ( ) { ProcessThread threadProcess ; synchronized ( inputStreams ) { threadProcess = this . threadProcess ; if ( threadProcess != null ) { if ( threadProcess . running ) { threadProcess . requestStop = true ; } else { threadProcess = this . threadProcess = null ; } } } inputSizeKnown = false ; if ( threadProcess == null ) { return ; } long timeout = System . currentTimeMillis ( ) + 5000 ; while ( threadProcess . running && timeout >= System . currentTimeMillis ( ) ) { synchronized ( inputStreams ) { if ( threadProcess != this . threadProcess ) { throw new RuntimeException ( "BUG! the thread got modified by anotehr process" ) ; } } BoofMiscOps . sleep ( 100 ) ; } if ( timeout < System . currentTimeMillis ( ) ) throw new RuntimeException ( "Took too long to stop input processing thread" ) ; this . threadProcess = null ; } | Blocks until it kills all input streams from running |
26,946 | public void openFile ( File file ) { final String path = massageFilePath ( file ) ; if ( path == null ) return ; inputFilePath = path ; BoofSwingUtil . invokeNowOrLater ( ( ) -> { BoofSwingUtil . addToRecentFiles ( DemonstrationBase . this , path ) ; updateRecentItems ( ) ; } ) ; BufferedImage buffered = inputFilePath . endsWith ( "mjpeg" ) ? null : UtilImageIO . loadImage ( inputFilePath ) ; if ( buffered == null ) { if ( allowVideos ) openVideo ( false , inputFilePath ) ; } else if ( allowImages ) { openImage ( false , file . getName ( ) , buffered ) ; } } | Opens a file . First it will attempt to open it as an image . If that fails it will try opening it as a video . If all else fails tell the user it has failed . If a streaming source was running before it will be stopped . |
26,947 | public void openImageSet ( String ... files ) { synchronized ( lockStartingProcess ) { if ( startingProcess ) { System . out . println ( "Ignoring open image set request. Detected spamming" ) ; return ; } startingProcess = true ; } stopAllInputProcessing ( ) ; synchronized ( inputStreams ) { inputMethod = InputMethod . IMAGE_SET ; inputFileSet = files ; if ( threadProcess != null ) throw new RuntimeException ( "There is still an active stream thread!" ) ; threadProcess = new ProcessImageSetThread ( files ) ; imageSetSize = files . length ; } threadPool . execute ( threadProcess ) ; } | Opens a set of images |
26,948 | public void openNextFile ( ) { if ( inputFilePath == null || inputMethod != InputMethod . IMAGE ) return ; String path ; try { path = URLDecoder . decode ( inputFilePath , "utf-8" ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; return ; } File current = new File ( UtilIO . ensureURL ( path ) . getFile ( ) ) ; File parent = current . getParentFile ( ) ; if ( parent == null ) return ; File [ ] files = parent . listFiles ( ) ; if ( files == null || files . length <= 1 ) return ; File closest = null ; for ( int i = 0 ; i < files . length ; i ++ ) { File f = files [ i ] ; String name = f . getName ( ) . toLowerCase ( ) ; if ( name . endsWith ( ".txt" ) || name . endsWith ( ".yaml" ) || name . endsWith ( ".xml" ) ) continue ; if ( current . compareTo ( f ) < 0 ) { if ( closest == null || closest . compareTo ( f ) > 0 ) { closest = f ; } } } if ( closest != null && closest . isFile ( ) ) { openFile ( closest ) ; } else { if ( closest != null ) { System . err . println ( "Next file isn't a file. name=" + closest . getName ( ) ) ; } else { System . err . println ( "No valid closest file found." ) ; } } } | Opens the next file in the directory by lexicographical order . |
26,949 | protected void openVideo ( boolean reopen , String ... filePaths ) { synchronized ( lockStartingProcess ) { if ( startingProcess ) { System . out . println ( "Ignoring video request. Detected spamming" ) ; return ; } startingProcess = true ; } synchronized ( inputStreams ) { if ( inputStreams . size ( ) != filePaths . length ) throw new IllegalArgumentException ( "Input streams not equal to " + filePaths . length + ". Override openVideo()" ) ; } stopAllInputProcessing ( ) ; streamPaused = false ; boolean failed = false ; for ( int which = 0 ; which < filePaths . length ; which ++ ) { CacheSequenceStream cache = inputStreams . get ( which ) ; SimpleImageSequence sequence = media . openVideo ( filePaths [ which ] , cache . getImageType ( ) ) ; if ( sequence == null ) { failed = true ; System . out . println ( "Can't find file. " + filePaths [ which ] ) ; break ; } configureVideo ( which , sequence ) ; synchronized ( inputStreams ) { cache . reset ( ) ; cache . setSequence ( sequence ) ; } } if ( ! failed ) { setInputName ( new File ( filePaths [ 0 ] ) . getName ( ) ) ; synchronized ( inputStreams ) { inputMethod = InputMethod . VIDEO ; streamPeriod = 33 ; if ( threadProcess != null ) throw new RuntimeException ( "There was still an active stream thread!" ) ; threadProcess = new SynchronizedStreamsThread ( ) ; } if ( ! reopen ) { for ( int i = 0 ; i < inputStreams . size ( ) ; i ++ ) { CacheSequenceStream stream = inputStreams . get ( i ) ; handleInputChange ( i , inputMethod , stream . getWidth ( ) , stream . getHeight ( ) ) ; } } threadPool . execute ( threadProcess ) ; } else { synchronized ( inputStreams ) { inputMethod = InputMethod . NONE ; inputFilePath = null ; } synchronized ( lockStartingProcess ) { startingProcess = false ; } showRejectDiaglog ( "Can't open file" ) ; } } | Before invoking this function make sure waitingToOpenImage is false AND that the previous input has been stopped |
26,950 | public void display ( String appName ) { waitUntilInputSizeIsKnown ( ) ; this . appName = appName ; window = ShowImages . showWindow ( this , appName , true ) ; window . setJMenuBar ( menuBar ) ; } | Opens a window with this application inside of it |
26,951 | protected void openFileMenuBar ( ) { List < BoofSwingUtil . FileTypes > types = new ArrayList < > ( ) ; if ( allowImages ) types . add ( BoofSwingUtil . FileTypes . IMAGES ) ; if ( allowVideos ) types . add ( BoofSwingUtil . FileTypes . VIDEOS ) ; BoofSwingUtil . FileTypes array [ ] = types . toArray ( new BoofSwingUtil . FileTypes [ 0 ] ) ; File file = BoofSwingUtil . openFileChooser ( DemonstrationBase . this , array ) ; if ( file != null ) { openFile ( file ) ; } } | Open file in the menu bar was invoked by the user |
26,952 | public void reprocessInput ( ) { if ( inputMethod == InputMethod . VIDEO ) { openVideo ( true , inputFilePath ) ; } else if ( inputMethod == InputMethod . IMAGE ) { BufferedImage buff = inputStreams . get ( 0 ) . getBufferedImage ( ) ; openImage ( true , new File ( inputFilePath ) . getName ( ) , buff ) ; } else if ( inputMethod == InputMethod . IMAGE_SET ) { openImageSet ( inputFileSet ) ; } } | If just a single image was processed it will process it again . If it s a stream there is no need to reprocess the next image will be handled soon enough . |
26,953 | public void process ( I image , D derivX , D derivY , D derivXX , D derivYY , D derivXY ) { intensity . process ( image , derivX , derivY , derivXX , derivYY , derivXY ) ; GrayF32 intensityImage = intensity . getIntensity ( ) ; int numSelectMin = - 1 ; int numSelectMax = - 1 ; if ( maxFeatures > 0 ) { if ( intensity . localMinimums ( ) ) numSelectMin = excludeMinimum == null ? maxFeatures : maxFeatures - excludeMinimum . size ; if ( intensity . localMaximums ( ) ) numSelectMax = excludeMaximum == null ? maxFeatures : maxFeatures - excludeMaximum . size ; if ( numSelectMin <= 0 && numSelectMax <= 0 ) return ; } if ( excludeMinimum != null ) { for ( int i = 0 ; i < excludeMinimum . size ; i ++ ) { Point2D_I16 p = excludeMinimum . get ( i ) ; intensityImage . set ( p . x , p . y , - Float . MAX_VALUE ) ; } } if ( excludeMaximum != null ) { for ( int i = 0 ; i < excludeMaximum . size ; i ++ ) { Point2D_I16 p = excludeMaximum . get ( i ) ; intensityImage . set ( p . x , p . y , Float . MAX_VALUE ) ; } } foundMinimum . reset ( ) ; foundMaximum . reset ( ) ; if ( intensity . hasCandidates ( ) ) { extractor . process ( intensityImage , intensity . getCandidatesMin ( ) , intensity . getCandidatesMax ( ) , foundMinimum , foundMaximum ) ; } else { extractor . process ( intensityImage , null , null , foundMinimum , foundMaximum ) ; } selectBest ( intensityImage , foundMinimum , numSelectMin , false ) ; selectBest ( intensityImage , foundMaximum , numSelectMax , true ) ; } | Computes point features from image gradients . |
26,954 | public static < T extends ImageBase < T > , II extends ImageGray < II > > DescribeRegionPoint < T , BrightFeature > surfColorStable ( ConfigSurfDescribe . Stability config , ImageType < T > imageType ) { Class bandType = imageType . getImageClass ( ) ; Class < II > integralType = GIntegralImageOps . getIntegralType ( bandType ) ; DescribePointSurf < II > alg = FactoryDescribePointAlgs . surfStability ( config , integralType ) ; if ( imageType . getFamily ( ) == ImageType . Family . PLANAR ) { DescribePointSurfPlanar < II > color = FactoryDescribePointAlgs . surfColor ( alg , imageType . getNumBands ( ) ) ; return new SurfPlanar_to_DescribeRegionPoint ( color , bandType , integralType ) ; } else { throw new IllegalArgumentException ( "Unknown image type" ) ; } } | Color variant of the SURF descriptor which has been designed for stability . |
26,955 | @ SuppressWarnings ( { "unchecked" } ) public static < T extends ImageGray < T > , D extends TupleDesc > DescribeRegionPoint < T , D > pixel ( int regionWidth , int regionHeight , Class < T > imageType ) { return new WrapDescribePixelRegion ( FactoryDescribePointAlgs . pixelRegion ( regionWidth , regionHeight , imageType ) , imageType ) ; } | Creates a region descriptor based on pixel intensity values alone . A classic and fast to compute descriptor but much less stable than more modern ones . |
26,956 | @ SuppressWarnings ( { "unchecked" } ) public static < T extends ImageGray < T > > DescribeRegionPoint < T , NccFeature > pixelNCC ( int regionWidth , int regionHeight , Class < T > imageType ) { return new WrapDescribePixelRegionNCC ( FactoryDescribePointAlgs . pixelRegionNCC ( regionWidth , regionHeight , imageType ) , imageType ) ; } | Creates a region descriptor based on normalized pixel intensity values alone . This descriptor is designed to be light invariance but is still less stable than more modern ones . |
26,957 | public static < T extends CameraPinhole > void save ( T parameters , Writer outputWriter ) { PrintWriter out = new PrintWriter ( outputWriter ) ; Yaml yaml = createYmlObject ( ) ; Map < String , Object > data = new HashMap < > ( ) ; if ( parameters instanceof CameraPinholeBrown ) { out . println ( "# Pinhole camera model with radial and tangential distortion" ) ; out . println ( "# (fx,fy) = focal length, (cx,cy) = principle point, (width,height) = image shape" ) ; out . println ( "# radial = radial distortion, (t1,t2) = tangential distortion" ) ; out . println ( ) ; putModelRadial ( ( CameraPinholeBrown ) parameters , data ) ; } else if ( parameters instanceof CameraUniversalOmni ) { out . println ( "# Omnidirectional camera model with radial and tangential distortion" ) ; out . println ( "# C. Mei, and P. Rives. \"Single view point omnidirectional camera calibration" + " from planar grids.\" ICRA 2007" ) ; out . println ( "# (fx,fy) = focal length, (cx,cy) = principle point, (width,height) = image shape" ) ; out . println ( "# mirror_offset = offset mirror along z-axis in unit circle" ) ; out . println ( "# radial = radial distortion, (t1,t2) = tangential distortion" ) ; out . println ( ) ; putModelUniversalOmni ( ( CameraUniversalOmni ) parameters , data ) ; } else { out . println ( "# Pinhole camera model" ) ; out . println ( "# (fx,fy) = focal length, (cx,cy) = principle point, (width,height) = image shape" ) ; out . println ( ) ; putModelPinhole ( parameters , data ) ; } yaml . dump ( data , out ) ; out . close ( ) ; } | Saves intrinsic camera model to disk |
26,958 | public static void save ( StereoParameters parameters , Writer outputWriter ) { Map < String , Object > map = new HashMap < > ( ) ; map . put ( "model" , MODEL_STEREO ) ; map . put ( VERSION , 0 ) ; map . put ( "left" , putModelRadial ( parameters . left , null ) ) ; map . put ( "right" , putModelRadial ( parameters . right , null ) ) ; map . put ( "rightToLeft" , putSe3 ( parameters . rightToLeft ) ) ; PrintWriter out = new PrintWriter ( outputWriter ) ; out . println ( "# Intrinsic and extrinsic parameters for a stereo camera pair" ) ; Yaml yaml = createYmlObject ( ) ; yaml . dump ( map , out ) ; out . close ( ) ; } | Saves stereo camera model to disk |
26,959 | public static < T > T load ( Reader reader ) { Yaml yaml = createYmlObject ( ) ; Map < String , Object > data = ( Map < String , Object > ) yaml . load ( reader ) ; try { reader . close ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return load ( data ) ; } | Loads intrinsic parameters from disk |
26,960 | public boolean process ( List < CalibrationObservation > observations ) { if ( ! linearEstimate ( observations ) ) return false ; status ( "Non-linear refinement" ) ; if ( ! performBundleAdjustment ( ) ) return false ; return true ; } | Processes observed calibration point coordinates and computes camera intrinsic and extrinsic parameters . |
26,961 | protected boolean linearEstimate ( List < CalibrationObservation > observations ) { status ( "Estimating Homographies" ) ; List < DMatrixRMaj > homographies = new ArrayList < > ( ) ; List < Se3_F64 > motions = new ArrayList < > ( ) ; for ( CalibrationObservation obs : observations ) { if ( ! computeHomography . computeHomography ( obs ) ) return false ; DMatrixRMaj H = computeHomography . getHomography ( ) ; homographies . add ( H ) ; } status ( "Estimating Calibration Matrix" ) ; computeK . process ( homographies ) ; DMatrixRMaj K = computeK . getCalibrationMatrix ( ) ; decomposeH . setCalibrationMatrix ( K ) ; for ( DMatrixRMaj H : homographies ) { motions . add ( decomposeH . decompose ( H ) ) ; } status ( "Estimating Radial Distortion" ) ; computeRadial . process ( K , homographies , observations ) ; double distort [ ] = computeRadial . getParameters ( ) ; convertIntoBundleStructure ( motions , K , distort , observations ) ; return true ; } | Find an initial estimate for calibration parameters using linear techniques . |
26,962 | public boolean performBundleAdjustment ( ) { ConfigLevenbergMarquardt configLM = new ConfigLevenbergMarquardt ( ) ; configLM . hessianScaling = false ; ConfigBundleAdjustment configSBA = new ConfigBundleAdjustment ( ) ; configSBA . configOptimizer = configLM ; BundleAdjustment < SceneStructureMetric > bundleAdjustment ; if ( robust ) { configLM . mixture = 0 ; bundleAdjustment = FactoryMultiView . bundleDenseMetric ( true , configSBA ) ; } else { bundleAdjustment = FactoryMultiView . bundleSparseMetric ( configSBA ) ; } bundleAdjustment . setVerbose ( verbose , 0 ) ; bundleAdjustment . configure ( 1e-20 , 1e-20 , 200 ) ; bundleAdjustment . setParameters ( structure , observations ) ; return bundleAdjustment . optimize ( structure ) ; } | Use non - linear optimization to improve the parameter estimates |
26,963 | public static void applyDistortion ( Point2D_F64 normPt , double [ ] radial , double t1 , double t2 ) { final double x = normPt . x ; final double y = normPt . y ; double a = 0 ; double r2 = x * x + y * y ; double r2i = r2 ; for ( int i = 0 ; i < radial . length ; i ++ ) { a += radial [ i ] * r2i ; r2i *= r2 ; } normPt . x = x + x * a + 2 * t1 * x * y + t2 * ( r2 + 2 * x * x ) ; normPt . y = y + y * a + t1 * ( r2 + 2 * y * y ) + 2 * t2 * x * y ; } | Applies radial and tangential distortion to the normalized image coordinate . |
26,964 | public double computeDistance ( AssociatedPair obs ) { triangulate . triangulate ( obs . p1 , obs . p2 , keyToCurr , p ) ; if ( p . z < 0 ) return Double . MAX_VALUE ; double error = errorCam1 . errorSq ( obs . p1 . x , obs . p1 . y , p . x / p . z , p . y / p . z ) ; SePointOps_F64 . transform ( keyToCurr , p , p ) ; if ( p . z < 0 ) return Double . MAX_VALUE ; error += errorCam2 . errorSq ( obs . p2 . x , obs . p2 . y , p . x / p . z , p . y / p . z ) ; return error ; } | Computes the error given the motion model |
26,965 | public static < I extends ImageGray < I > , D extends ImageGray < D > > Class < D > getDerivativeType ( Class < I > imageType ) { if ( imageType == GrayF32 . class ) { return ( Class < D > ) GrayF32 . class ; } else if ( imageType == GrayU8 . class ) { return ( Class < D > ) GrayS16 . class ; } else if ( imageType == GrayU16 . class ) { return ( Class < D > ) GrayS32 . class ; } else { throw new IllegalArgumentException ( "Unknown input image type: " + imageType . getSimpleName ( ) ) ; } } | Returns the type of image the derivative should be for the specified input type . |
26,966 | public static < I extends ImageGray < I > , D extends ImageGray < D > > void hessian ( DerivativeType type , I input , D derivXX , D derivYY , D derivXY , BorderType borderType ) { ImageBorder < I > border = BorderType . SKIP == borderType ? null : FactoryImageBorder . wrap ( borderType , input ) ; switch ( type ) { case SOBEL : if ( input instanceof GrayF32 ) { HessianSobel . process ( ( GrayF32 ) input , ( GrayF32 ) derivXX , ( GrayF32 ) derivYY , ( GrayF32 ) derivXY , ( ImageBorder_F32 ) border ) ; } else if ( input instanceof GrayU8 ) { HessianSobel . process ( ( GrayU8 ) input , ( GrayS16 ) derivXX , ( GrayS16 ) derivYY , ( GrayS16 ) derivXY , ( ImageBorder_S32 ) border ) ; } else { throw new IllegalArgumentException ( "Unknown input image type: " + input . getClass ( ) . getSimpleName ( ) ) ; } break ; case THREE : if ( input instanceof GrayF32 ) { HessianThree . process ( ( GrayF32 ) input , ( GrayF32 ) derivXX , ( GrayF32 ) derivYY , ( GrayF32 ) derivXY , ( ImageBorder_F32 ) border ) ; } else if ( input instanceof GrayU8 ) { HessianThree . process ( ( GrayU8 ) input , ( GrayS16 ) derivXX , ( GrayS16 ) derivYY , ( GrayS16 ) derivXY , ( ImageBorder_S32 ) border ) ; } else { throw new IllegalArgumentException ( "Unknown input image type: " + input . getClass ( ) . getSimpleName ( ) ) ; } break ; default : throw new IllegalArgumentException ( "Unsupported derivative type " + type ) ; } } | Computes the hessian from the original input image . Only Sobel and Three supported . |
26,967 | public static < D extends ImageGray < D > > void hessian ( DerivativeType type , D derivX , D derivY , D derivXX , D derivYY , D derivXY , BorderType borderType ) { ImageBorder < D > border = BorderType . SKIP == borderType ? null : FactoryImageBorder . wrap ( borderType , derivX ) ; switch ( type ) { case PREWITT : if ( derivX instanceof GrayF32 ) { HessianFromGradient . hessianPrewitt ( ( GrayF32 ) derivX , ( GrayF32 ) derivY , ( GrayF32 ) derivXX , ( GrayF32 ) derivYY , ( GrayF32 ) derivXY , ( ImageBorder_F32 ) border ) ; } else if ( derivX instanceof GrayS16 ) { HessianFromGradient . hessianPrewitt ( ( GrayS16 ) derivX , ( GrayS16 ) derivY , ( GrayS16 ) derivXX , ( GrayS16 ) derivYY , ( GrayS16 ) derivXY , ( ImageBorder_S32 ) border ) ; } else { throw new IllegalArgumentException ( "Unknown input image type: " + derivX . getClass ( ) . getSimpleName ( ) ) ; } break ; case SOBEL : if ( derivX instanceof GrayF32 ) { HessianFromGradient . hessianSobel ( ( GrayF32 ) derivX , ( GrayF32 ) derivY , ( GrayF32 ) derivXX , ( GrayF32 ) derivYY , ( GrayF32 ) derivXY , ( ImageBorder_F32 ) border ) ; } else if ( derivX instanceof GrayS16 ) { HessianFromGradient . hessianSobel ( ( GrayS16 ) derivX , ( GrayS16 ) derivY , ( GrayS16 ) derivXX , ( GrayS16 ) derivYY , ( GrayS16 ) derivXY , ( ImageBorder_S32 ) border ) ; } else { throw new IllegalArgumentException ( "Unknown input image type: " + derivX . getClass ( ) . getSimpleName ( ) ) ; } break ; case THREE : if ( derivX instanceof GrayF32 ) { HessianFromGradient . hessianThree ( ( GrayF32 ) derivX , ( GrayF32 ) derivY , ( GrayF32 ) derivXX , ( GrayF32 ) derivYY , ( GrayF32 ) derivXY , ( ImageBorder_F32 ) border ) ; } else if ( derivX instanceof GrayS16 ) { HessianFromGradient . hessianThree ( ( GrayS16 ) derivX , ( GrayS16 ) derivY , ( GrayS16 ) derivXX , ( GrayS16 ) derivYY , ( GrayS16 ) derivXY , ( ImageBorder_S32 ) border ) ; } else { throw new IllegalArgumentException ( "Unknown input image type: " + derivX . getClass ( ) . getSimpleName ( ) ) ; } break ; default : throw new IllegalArgumentException ( "Unsupported derivative type " + type ) ; } } | Computes the hessian from the gradient . Only Prewitt Sobel and Three supported . |
26,968 | public static KernelBase lookupKernelX ( DerivativeType type , boolean isInteger ) { switch ( type ) { case PREWITT : return GradientPrewitt . getKernelX ( isInteger ) ; case SOBEL : return GradientSobel . getKernelX ( isInteger ) ; case THREE : return GradientThree . getKernelX ( isInteger ) ; case TWO_0 : return GradientTwo0 . getKernelX ( isInteger ) ; case TWO_1 : return GradientTwo1 . getKernelX ( isInteger ) ; } throw new IllegalArgumentException ( "Unknown kernel type: " + type ) ; } | Returns the kernel for finding the X derivative . |
26,969 | boolean computeEllipseCenters ( ) { keypoints . reset ( ) ; for ( int tangentIdx = 0 ; tangentIdx < tangents . size ( ) ; tangentIdx ++ ) { Tangents t = tangents . get ( tangentIdx ) ; Point2D_F64 center = keypoints . grow ( ) ; center . set ( 0 , 0 ) ; double totalWeight = 0 ; for ( int i = 0 ; i < t . size ( ) ; i += 2 ) { UtilLine2D_F64 . convert ( t . get ( i ) , t . get ( i + 1 ) , lineA ) ; for ( int j = i + 2 ; j < t . size ( ) ; j += 2 ) { UtilLine2D_F64 . convert ( t . get ( j ) , t . get ( j + 1 ) , lineB ) ; double w = UtilVector2D_F64 . acute ( lineA . A , lineA . B , lineB . A , lineB . B ) ; if ( w > Math . PI / 2.0 ) w = Math . PI - w ; if ( w <= 0.02 ) continue ; if ( null == Intersection2D_F64 . intersection ( lineA , lineB , location ) ) { return false ; } center . x += location . x * w ; center . y += location . y * w ; totalWeight += w ; } } if ( totalWeight == 0 ) return false ; center . x /= totalWeight ; center . y /= totalWeight ; } return true ; } | Finds the intersection of all the tangent lines with each other the computes the average of those points . That location is where the center is set to . Each intersection of lines is weighted by the acute angle . lines which are 90 degrees to each other are less sensitive to noise |
26,970 | public T getBand ( int band ) { if ( band >= bands . length || band < 0 ) throw new IllegalArgumentException ( "The specified band is out of bounds: " + band ) ; return bands [ band ] ; } | Returns a band in the multi - band image . |
26,971 | public void setTo ( Planar < T > orig ) { if ( orig . width != width || orig . height != height ) reshape ( orig . width , orig . height ) ; if ( orig . getBandType ( ) != getBandType ( ) ) throw new IllegalArgumentException ( "The band type must be the same" ) ; int N = orig . getNumBands ( ) ; if ( N != getNumBands ( ) ) { setNumberOfBands ( orig . getNumBands ( ) ) ; } for ( int i = 0 ; i < N ; i ++ ) { bands [ i ] . setTo ( orig . getBand ( i ) ) ; } } | Sets the values of each pixel equal to the pixels in the specified matrix . Automatically resized to match the input image . |
26,972 | public Planar < T > createNew ( int imgWidth , int imgHeight ) { return new Planar < > ( type , imgWidth , imgHeight , bands . length ) ; } | Creates a new image of the same type and number of bands |
26,973 | public void reorderBands ( int ... order ) { T [ ] bands = ( T [ ] ) Array . newInstance ( type , order . length ) ; for ( int i = 0 ; i < order . length ; i ++ ) { bands [ i ] = this . bands [ order [ i ] ] ; } this . bands = bands ; } | Changes the bands order |
26,974 | public void setNumberOfBands ( int numberOfBands ) { if ( numberOfBands == this . bands . length ) return ; T [ ] bands = ( T [ ] ) Array . newInstance ( type , numberOfBands ) ; int N = Math . min ( numberOfBands , this . bands . length ) ; for ( int i = 0 ; i < N ; i ++ ) { bands [ i ] = this . bands [ i ] ; } for ( int i = N ; i < bands . length ; i ++ ) { bands [ i ] = GeneralizedImageOps . createSingleBand ( type , width , height ) ; } this . bands = bands ; } | Changes the number of bands in the image . A new array is declared and individual bands are recycled if possible |
26,975 | public double computeAccuracy ( ) { double totalCorrect = 0 ; double totalIncorrect = 0 ; for ( int i = 0 ; i < actualCounts . length ; i ++ ) { for ( int j = 0 ; j < actualCounts . length ; j ++ ) { if ( i == j ) { totalCorrect += matrix . get ( i , j ) ; } else { totalIncorrect += matrix . get ( i , j ) ; } } } return totalCorrect / ( totalCorrect + totalIncorrect ) ; } | Computes accuracy from the confusion matrix . This is the sum of the fraction correct divide by total number of types . The number of each sample for each type is not taken in account . |
26,976 | public void addImage ( CalibrationObservation observation ) { if ( imageWidth == 0 ) { this . imageWidth = observation . getWidth ( ) ; this . imageHeight = observation . getHeight ( ) ; } else if ( observation . getWidth ( ) != this . imageWidth || observation . getHeight ( ) != this . imageHeight ) { throw new IllegalArgumentException ( "Image shape miss match" ) ; } observations . add ( observation ) ; } | Adds the observations from a calibration target detector |
26,977 | public < T extends CameraModel > T process ( ) { if ( zhang99 == null ) throw new IllegalArgumentException ( "Please call configure first." ) ; zhang99 . setVerbose ( verbose , 0 ) ; if ( ! zhang99 . process ( observations ) ) { throw new RuntimeException ( "Zhang99 algorithm failed!" ) ; } structure = zhang99 . getStructure ( ) ; errors = zhang99 . computeErrors ( ) ; foundIntrinsic = zhang99 . getCameraModel ( ) ; foundIntrinsic . width = imageWidth ; foundIntrinsic . height = imageHeight ; return ( T ) foundIntrinsic ; } | After calibration points have been found this invokes the Zhang99 algorithm to estimate calibration parameters . Error statistics are also computed . |
26,978 | public static void printErrors ( List < ImageResults > results ) { double totalError = 0 ; for ( int i = 0 ; i < results . size ( ) ; i ++ ) { ImageResults r = results . get ( i ) ; totalError += r . meanError ; System . out . printf ( "image %3d Euclidean ( mean = %7.1e max = %7.1e ) bias ( X = %8.1e Y %8.1e )\n" , i , r . meanError , r . maxError , r . biasX , r . biasY ) ; } System . out . println ( "Average Mean Error = " + ( totalError / results . size ( ) ) ) ; } | Prints out error information to standard out |
26,979 | private void renderLabels ( Graphics2D g2 , double fontSize ) { int numCategories = confusion . getNumRows ( ) ; int longestLabel = 0 ; if ( renderLabels ) { for ( int i = 0 ; i < numCategories ; i ++ ) { longestLabel = Math . max ( longestLabel , labels . get ( i ) . length ( ) ) ; } } Font fontLabel = new Font ( "monospaced" , Font . BOLD , ( int ) ( 0.055 * longestLabel * fontSize + 0.5 ) ) ; g2 . setFont ( fontLabel ) ; FontMetrics metrics = g2 . getFontMetrics ( fontLabel ) ; g2 . setColor ( Color . WHITE ) ; g2 . fillRect ( gridWidth , 0 , viewWidth - gridWidth , viewHeight ) ; g2 . setColor ( Color . BLACK ) ; for ( int i = 0 ; i < numCategories ; i ++ ) { String label = labels . get ( i ) ; int y0 = i * gridHeight / numCategories ; int y1 = ( i + 1 ) * gridHeight / numCategories ; Rectangle2D r = metrics . getStringBounds ( label , null ) ; float adjX = ( float ) ( r . getX ( ) * 2 + r . getWidth ( ) ) / 2.0f ; float adjY = ( float ) ( r . getY ( ) * 2 + r . getHeight ( ) ) / 2.0f ; float x = ( ( viewWidth + gridWidth ) / 2f - adjX ) ; float y = ( ( y1 + y0 ) / 2f - adjY ) ; g2 . drawString ( label , x , y ) ; } } | Renders the names on each category to the side of the confusion matrix |
26,980 | private void renderMatrix ( Graphics2D g2 , double fontSize ) { int numCategories = confusion . getNumRows ( ) ; Font fontNumber = new Font ( "Serif" , Font . BOLD , ( int ) ( 0.6 * fontSize + 0.5 ) ) ; g2 . setFont ( fontNumber ) ; FontMetrics metrics = g2 . getFontMetrics ( fontNumber ) ; for ( int i = 0 ; i < numCategories ; i ++ ) { int y0 = i * gridHeight / numCategories ; int y1 = ( i + 1 ) * gridHeight / numCategories ; for ( int j = 0 ; j < numCategories ; j ++ ) { int x0 = j * gridWidth / numCategories ; int x1 = ( j + 1 ) * gridWidth / numCategories ; double value = confusion . unsafe_get ( i , j ) ; int red , green , blue ; if ( gray ) { red = green = blue = ( int ) ( 255 * ( 1.0 - value ) ) ; } else { green = 0 ; red = ( int ) ( 255 * value ) ; blue = ( int ) ( 255 * ( 1.0 - value ) ) ; } g2 . setColor ( new Color ( red , green , blue ) ) ; g2 . fillRect ( x0 , y0 , x1 - x0 , y1 - y0 ) ; if ( showNumbers && ( showZeros || value != 0 ) ) { int a = ( red + green + blue ) / 3 ; String text = "" + ( int ) ( value * 100.0 + 0.5 ) ; Rectangle2D r = metrics . getStringBounds ( text , null ) ; float adjX = ( float ) ( r . getX ( ) * 2 + r . getWidth ( ) ) / 2.0f ; float adjY = ( float ) ( r . getY ( ) * 2 + r . getHeight ( ) ) / 2.0f ; float x = ( ( x1 + x0 ) / 2f - adjX ) ; float y = ( ( y1 + y0 ) / 2f - adjY ) ; int gray = a > 127 ? 0 : 255 ; g2 . setColor ( new Color ( gray , gray , gray ) ) ; g2 . drawString ( text , x , y ) ; } } } } | Renders the confusion matrix and visualizes the value in each cell with a color and optionally a color . |
26,981 | public LocationInfo whatIsAtPoint ( int pixelX , int pixelY , LocationInfo output ) { if ( output == null ) output = new LocationInfo ( ) ; int numCategories = confusion . getNumRows ( ) ; synchronized ( this ) { if ( pixelX >= gridWidth ) { output . insideMatrix = false ; output . col = output . row = pixelY * numCategories / gridHeight ; } else { output . insideMatrix = true ; output . row = pixelY * numCategories / gridHeight ; output . col = pixelX * numCategories / gridWidth ; } } return output ; } | Use to sample the panel to see what is being displayed at the location clicked . All coordinates are in panel coordinates . |
26,982 | public void configure ( int widthStitch , int heightStitch , IT worldToInit ) { this . worldToInit = ( IT ) worldToCurr . createInstance ( ) ; if ( worldToInit != null ) this . worldToInit . set ( worldToInit ) ; this . widthStitch = widthStitch ; this . heightStitch = heightStitch ; } | Specifies size of stitch image and the location of the initial coordinate system . |
26,983 | public void reset ( ) { if ( stitchedImage != null ) GImageMiscOps . fill ( stitchedImage , 0 ) ; motion . reset ( ) ; worldToCurr . reset ( ) ; first = true ; } | Throws away current results and starts over again |
26,984 | private boolean checkLargeMotion ( int width , int height ) { if ( first ) { getImageCorners ( width , height , corners ) ; previousArea = computeArea ( corners ) ; first = false ; } else { getImageCorners ( width , height , corners ) ; double area = computeArea ( corners ) ; double change = Math . max ( area / previousArea , previousArea / area ) - 1 ; if ( change > maxJumpFraction ) { return true ; } previousArea = area ; } return false ; } | Looks for sudden large changes in corner location to detect motion estimation faults . |
26,985 | private void update ( I image ) { computeCurrToInit_PixelTran ( ) ; RectangleLength2D_I32 box = DistortImageOps . boundBox ( image . width , image . height , stitchedImage . width , stitchedImage . height , work , tranCurrToWorld ) ; int x0 = box . x0 ; int y0 = box . y0 ; int x1 = box . x0 + box . width ; int y1 = box . y0 + box . height ; distorter . setModel ( tranWorldToCurr ) ; distorter . apply ( image , stitchedImage , x0 , y0 , x1 , y1 ) ; } | Adds the latest image into the stitched image |
26,986 | public void resizeStitchImage ( int widthStitch , int heightStitch , IT newToOldStitch ) { workImage . reshape ( widthStitch , heightStitch ) ; GImageMiscOps . fill ( workImage , 0 ) ; if ( newToOldStitch != null ) { PixelTransform < Point2D_F32 > newToOld = converter . convertPixel ( newToOldStitch , null ) ; distorter . setModel ( newToOld ) ; distorter . apply ( stitchedImage , workImage ) ; IT tmp = ( IT ) worldToCurr . createInstance ( ) ; newToOldStitch . concat ( worldToInit , tmp ) ; worldToInit . set ( tmp ) ; computeCurrToInit_PixelTran ( ) ; } else { int overlapWidth = Math . min ( widthStitch , stitchedImage . width ) ; int overlapHeight = Math . min ( heightStitch , stitchedImage . height ) ; GImageMiscOps . copy ( 0 , 0 , 0 , 0 , overlapWidth , overlapHeight , stitchedImage , workImage ) ; } stitchedImage . reshape ( widthStitch , heightStitch ) ; I tmp = stitchedImage ; stitchedImage = workImage ; workImage = tmp ; this . widthStitch = widthStitch ; this . heightStitch = heightStitch ; } | Resizes the stitch image . If no transform is provided then the old stitch region is simply places on top of the new one and copied . Pixels which do not exist in the old image are filled with zero . |
26,987 | public Corners getImageCorners ( int width , int height , Corners corners ) { if ( corners == null ) corners = new Corners ( ) ; int w = width ; int h = height ; tranCurrToWorld . compute ( 0 , 0 , work ) ; corners . p0 . set ( work . x , work . y ) ; tranCurrToWorld . compute ( w , 0 , work ) ; corners . p1 . set ( work . x , work . y ) ; tranCurrToWorld . compute ( w , h , work ) ; corners . p2 . set ( work . x , work . y ) ; tranCurrToWorld . compute ( 0 , h , work ) ; corners . p3 . set ( work . x , work . y ) ; return corners ; } | Returns the location of the input image s corners inside the stitch image . |
26,988 | private void minimizeWithGeometricConstraints ( ) { extractEpipoles . setTensor ( solutionN ) ; extractEpipoles . extractEpipoles ( e2 , e3 ) ; param [ 0 ] = e2 . x ; param [ 1 ] = e2 . y ; param [ 2 ] = e2 . z ; param [ 3 ] = e3 . x ; param [ 4 ] = e3 . y ; param [ 5 ] = e3 . z ; errorFunction . init ( ) ; optimizer . setFunction ( errorFunction , null ) ; optimizer . initialize ( param , gtol , ftol ) ; UtilOptimize . process ( optimizer , maxIterations ) ; double found [ ] = optimizer . getParameters ( ) ; paramToEpipoles ( found , e2 , e3 ) ; enforce . process ( e2 , e3 , A ) ; enforce . extractSolution ( solutionN ) ; } | Minimize the algebraic error using LM . The two epipoles are the parameters being optimized . |
26,989 | public boolean checkConstraint ( Point2D_F64 viewA , Point2D_F64 viewB , Se3_F64 fromAtoB ) { triangulate . triangulate ( viewA , viewB , fromAtoB , P ) ; if ( P . z > 0 ) { SePointOps_F64 . transform ( fromAtoB , P , P ) ; return P . z > 0 ; } return false ; } | Checks to see if a single point meets the constraint . |
26,990 | public static < I extends ImageBase < I > , IT extends InvertibleTransform > ImageMotion2D < I , IT > createMotion2D ( int ransacIterations , double inlierThreshold , int outlierPrune , int absoluteMinimumTracks , double respawnTrackFraction , double respawnCoverageFraction , boolean refineEstimate , PointTracker < I > tracker , IT motionModel ) { ModelManager < IT > manager ; ModelGenerator < IT , AssociatedPair > fitter ; DistanceFromModel < IT , AssociatedPair > distance ; ModelFitter < IT , AssociatedPair > modelRefiner = null ; if ( motionModel instanceof Homography2D_F64 ) { GenerateHomographyLinear mf = new GenerateHomographyLinear ( true ) ; manager = ( ModelManager ) new ModelManagerHomography2D_F64 ( ) ; fitter = ( ModelGenerator ) mf ; if ( refineEstimate ) modelRefiner = ( ModelFitter ) mf ; distance = ( DistanceFromModel ) new DistanceHomographySq ( ) ; } else if ( motionModel instanceof Affine2D_F64 ) { manager = ( ModelManager ) new ModelManagerAffine2D_F64 ( ) ; GenerateAffine2D mf = new GenerateAffine2D ( ) ; fitter = ( ModelGenerator ) mf ; if ( refineEstimate ) modelRefiner = ( ModelFitter ) mf ; distance = ( DistanceFromModel ) new DistanceAffine2DSq ( ) ; } else if ( motionModel instanceof Se2_F64 ) { manager = ( ModelManager ) new ModelManagerSe2_F64 ( ) ; MotionTransformPoint < Se2_F64 , Point2D_F64 > alg = new MotionSe2PointSVD_F64 ( ) ; GenerateSe2_AssociatedPair mf = new GenerateSe2_AssociatedPair ( alg ) ; fitter = ( ModelGenerator ) mf ; distance = ( DistanceFromModel ) new DistanceSe2Sq ( ) ; } else { throw new RuntimeException ( "Unknown model type: " + motionModel . getClass ( ) . getSimpleName ( ) ) ; } ModelMatcher < IT , AssociatedPair > modelMatcher = new Ransac ( 123123 , manager , fitter , distance , ransacIterations , inlierThreshold ) ; ImageMotionPointTrackerKey < I , IT > lowlevel = new ImageMotionPointTrackerKey < > ( tracker , modelMatcher , modelRefiner , motionModel , outlierPrune ) ; ImageMotionPtkSmartRespawn < I , IT > smartRespawn = new ImageMotionPtkSmartRespawn < > ( lowlevel , absoluteMinimumTracks , respawnTrackFraction , respawnCoverageFraction ) ; return new WrapImageMotionPtkSmartRespawn < > ( smartRespawn ) ; } | Estimates the 2D motion of an image using different models . |
26,991 | @ SuppressWarnings ( "unchecked" ) public static < I extends ImageBase < I > , IT extends InvertibleTransform > StitchingFromMotion2D < I , IT > createVideoStitch ( double maxJumpFraction , ImageMotion2D < I , IT > motion2D , ImageType < I > imageType ) { StitchingTransform < IT > transform ; if ( motion2D . getTransformType ( ) == Affine2D_F64 . class ) { transform = ( StitchingTransform ) FactoryStitchingTransform . createAffine_F64 ( ) ; } else { transform = ( StitchingTransform ) FactoryStitchingTransform . createHomography_F64 ( ) ; } InterpolatePixel < I > interp ; if ( imageType . getFamily ( ) == ImageType . Family . GRAY || imageType . getFamily ( ) == ImageType . Family . PLANAR ) { interp = FactoryInterpolation . createPixelS ( 0 , 255 , InterpolationType . BILINEAR , BorderType . EXTENDED , imageType . getImageClass ( ) ) ; } else { throw new IllegalArgumentException ( "Unsupported image type" ) ; } ImageDistort < I , I > distorter = FactoryDistort . distort ( false , interp , imageType ) ; distorter . setRenderAll ( false ) ; return new StitchingFromMotion2D < > ( motion2D , distorter , transform , maxJumpFraction ) ; } | Estimates the image motion then combines images together . Typically used for mosaics and stabilization . |
26,992 | public static int min ( GrayS32 input ) { if ( BoofConcurrency . USE_CONCURRENT ) { return ImplImageStatistics_MT . min ( input . data , input . startIndex , input . height , input . width , input . stride ) ; } else { return ImplImageStatistics . min ( input . data , input . startIndex , input . height , input . width , input . stride ) ; } } | Returns the minimum element value . |
26,993 | public static float maxAbs ( InterleavedF32 input ) { if ( BoofConcurrency . USE_CONCURRENT ) { return ImplImageStatistics_MT . maxAbs ( input . data , input . startIndex , input . height , input . width * input . numBands , input . stride ) ; } else { return ImplImageStatistics . maxAbs ( input . data , input . startIndex , input . height , input . width * input . numBands , input . stride ) ; } } | Returns the maximum element value . |
26,994 | private void connectToNeighbors ( int x , int y ) { List < LineSegment2D_F32 > lines = grid . get ( x , y ) ; Iterator < LineSegment2D_F32 > iter = lines . iterator ( ) ; while ( iter . hasNext ( ) ) { LineSegment2D_F32 l = iter . next ( ) ; boolean connected = false ; if ( connectTry ( l , x + 1 , y ) ) connected = true ; if ( ! connected && connectTry ( l , x + 1 , y + 1 ) ) connected = true ; if ( ! connected && connectTry ( l , x , y + 1 ) ) connected = true ; if ( ! connected && connectTry ( l , x - 1 , y + 1 ) ) connected = true ; if ( connected ) iter . remove ( ) ; } } | Connect lines in the target region to lines in neighboring regions . Regions are selected such that no two regions are compared against each other more than once . |
26,995 | private boolean connectTry ( LineSegment2D_F32 target , int x , int y ) { if ( ! grid . isInBounds ( x , y ) ) return false ; List < LineSegment2D_F32 > lines = grid . get ( x , y ) ; int index = findBestCompatible ( target , lines , 0 ) ; if ( index == - 1 ) return false ; LineSegment2D_F32 b = lines . remove ( index ) ; Point2D_F32 pt0 = farthestIndex < 2 ? target . a : target . b ; Point2D_F32 pt1 = ( farthestIndex % 2 ) == 0 ? b . a : b . b ; target . a . set ( pt0 ) ; target . b . set ( pt1 ) ; lines . add ( target ) ; return true ; } | See if there is a line that matches in this adjacent region . |
26,996 | private void connectInSameElement ( List < LineSegment2D_F32 > lines ) { for ( int i = 0 ; i < lines . size ( ) ; i ++ ) { LineSegment2D_F32 a = lines . get ( i ) ; int index = findBestCompatible ( a , lines , i + 1 ) ; if ( index == - 1 ) continue ; LineSegment2D_F32 b = lines . remove ( index ) ; Point2D_F32 pt0 = farthestIndex < 2 ? a . a : a . b ; Point2D_F32 pt1 = ( farthestIndex % 2 ) == 0 ? b . a : b . b ; a . a . set ( pt0 ) ; a . b . set ( pt1 ) ; } } | Search for lines in the same region for it to be connected to . |
26,997 | private int findBestCompatible ( LineSegment2D_F32 target , List < LineSegment2D_F32 > candidates , int start ) { int bestIndex = - 1 ; double bestDistance = Double . MAX_VALUE ; int bestFarthest = 0 ; float targetAngle = UtilAngle . atanSafe ( target . slopeY ( ) , target . slopeX ( ) ) ; float cos = ( float ) Math . cos ( targetAngle ) ; float sin = ( float ) Math . sin ( targetAngle ) ; for ( int i = start ; i < candidates . size ( ) ; i ++ ) { LineSegment2D_F32 c = candidates . get ( i ) ; float angle = UtilAngle . atanSafe ( c . slopeY ( ) , c . slopeX ( ) ) ; if ( UtilAngle . distHalf ( targetAngle , angle ) > lineSlopeAngleTol ) continue ; closestFarthestPoints ( target , c ) ; Point2D_F32 pt0 = closestIndex < 2 ? target . a : target . b ; Point2D_F32 pt1 = ( closestIndex % 2 ) == 0 ? c . a : c . b ; float xx = pt1 . x - pt0 . x ; float yy = pt1 . y - pt0 . y ; float distX = Math . abs ( cos * xx - sin * yy ) ; float distY = Math . abs ( cos * yy + sin * xx ) ; if ( distX >= bestDistance || distX > parallelTol || distY > tangentTol ) continue ; pt0 = farthestIndex < 2 ? target . a : target . b ; pt1 = ( farthestIndex % 2 ) == 0 ? c . a : c . b ; float angleCombined = UtilAngle . atanSafe ( pt1 . y - pt0 . y , pt1 . x - pt0 . x ) ; if ( UtilAngle . distHalf ( targetAngle , angleCombined ) <= lineSlopeAngleTol ) { bestDistance = distX ; bestIndex = i ; bestFarthest = farthestIndex ; } } if ( bestDistance < parallelTol ) { farthestIndex = bestFarthest ; return bestIndex ; } return - 1 ; } | Searches for a line in the list which the target is compatible with and can be connected to . |
26,998 | private void closestFarthestPoints ( LineSegment2D_F32 a , LineSegment2D_F32 b ) { dist [ 0 ] = a . a . distance2 ( b . a ) ; dist [ 1 ] = a . a . distance2 ( b . b ) ; dist [ 2 ] = a . b . distance2 ( b . a ) ; dist [ 3 ] = a . b . distance2 ( b . b ) ; farthestIndex = 0 ; float closest = dist [ 0 ] ; float farthest = dist [ 0 ] ; for ( int i = 1 ; i < 4 ; i ++ ) { float d = dist [ i ] ; if ( d < closest ) { closest = d ; closestIndex = i ; } if ( d > farthest ) { farthest = d ; farthestIndex = i ; } } } | Finds the points on each line which are closest and farthest away from each other . |
26,999 | protected void selectBoundaryCorners ( ) { List < Point2D_F64 > layout = detector . getLayout ( ) ; Polygon2D_F64 hull = new Polygon2D_F64 ( ) ; UtilPolygons2D_F64 . convexHull ( layout , hull ) ; UtilPolygons2D_F64 . removeAlmostParallel ( hull , 0.02 ) ; boundaryIndexes = new int [ hull . size ( ) ] ; for ( int i = 0 ; i < hull . size ( ) ; i ++ ) { Point2D_F64 h = hull . get ( i ) ; boolean matched = false ; for ( int j = 0 ; j < layout . size ( ) ; j ++ ) { if ( h . isIdentical ( layout . get ( j ) , 1e-6 ) ) { matched = true ; boundaryIndexes [ i ] = j ; break ; } } if ( ! matched ) throw new RuntimeException ( "Bug!" ) ; } } | Selects points which will be the corners in the boundary . Finds the convex hull . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.