idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
26,700 | public void start ( Device device , Resolution resolution , Listener listener ) { if ( resolution != Resolution . MEDIUM ) { throw new IllegalArgumentException ( "Depth image is always at medium resolution. Possible bug in kinect driver" ) ; } this . device = device ; this . listener = listener ; device . setDepthForm... | Adds listeners to the device and sets its resolutions . |
26,701 | public void stop ( ) { thread . requestStop = true ; long start = System . currentTimeMillis ( ) + timeout ; while ( start > System . currentTimeMillis ( ) && thread . running ) Thread . yield ( ) ; device . stopDepth ( ) ; device . stopVideo ( ) ; device . close ( ) ; } | Stops all the threads from running and closes the video channels and video device |
26,702 | public boolean refine ( List < CameraPinhole > calibration , DMatrix4x4 Q ) { if ( calibration . size ( ) != cameras . size ) throw new RuntimeException ( "Calibration and cameras do not match" ) ; computeNumberOfCalibrationParameters ( ) ; func = new ResidualK ( ) ; if ( func . getNumOfInputsN ( ) > 6 * calibration . ... | Refine calibration matrix K given the dual absolute quadratic Q . |
26,703 | void recomputeQ ( DMatrixRMaj p , DMatrix4x4 Q ) { Equation eq = new Equation ( ) ; DMatrix3x3 K = new DMatrix3x3 ( ) ; encodeK ( K , 0 , 3 , param . data ) ; eq . alias ( p , "p" , K , "K" ) ; eq . process ( "w=K*K'" ) ; eq . process ( "Q=[w , -w*p;-p'*w , p'*w*p]" ) ; DMatrixRMaj _Q = eq . lookupDDRM ( "Q" ) ; Common... | Compuets the absolute dual quadratic from the first camera parameters and plane at infinity |
26,704 | public int encodeK ( DMatrix3x3 K , int which , int offset , double params [ ] ) { if ( fixedAspectRatio ) { K . a11 = params [ offset ++ ] ; K . a22 = aspect . data [ which ] * K . a11 ; } else { K . a11 = params [ offset ++ ] ; K . a22 = params [ offset ++ ] ; } if ( ! zeroSkew ) { K . a12 = params [ offset ++ ] ; } ... | Encode the calibration as a 3x3 matrix . K is assumed to zero initially or at least all non - zero elements will align with values that are written to . |
26,705 | public void initializeMerge ( int numRegions ) { mergeList . resize ( numRegions ) ; for ( int i = 0 ; i < numRegions ; i ++ ) mergeList . data [ i ] = i ; } | Must call before any other functions . |
26,706 | public void performMerge ( GrayS32 pixelToRegion , GrowQueue_I32 regionMemberCount ) { flowIntoRootNode ( regionMemberCount ) ; setToRootNodeNewID ( regionMemberCount ) ; BinaryImageOps . relabel ( pixelToRegion , mergeList . data ) ; } | Merges regions together and updates the provided data structures for said changes . |
26,707 | protected void flowIntoRootNode ( GrowQueue_I32 regionMemberCount ) { rootID . resize ( regionMemberCount . size ) ; int count = 0 ; for ( int i = 0 ; i < mergeList . size ; i ++ ) { int p = mergeList . data [ i ] ; if ( p == i ) { rootID . data [ i ] = count ++ ; continue ; } int gp = mergeList . data [ p ] ; while ( ... | For each region in the merge list which is not a root node find its root node and add to the root node its member count and set the index in mergeList to the root node . If a node is a root node just note what its new ID will be after all the other segments are removed . |
26,708 | protected void setToRootNodeNewID ( GrowQueue_I32 regionMemberCount ) { tmpMemberCount . reset ( ) ; for ( int i = 0 ; i < mergeList . size ; i ++ ) { int p = mergeList . data [ i ] ; if ( p == i ) { mergeList . data [ i ] = rootID . data [ i ] ; tmpMemberCount . add ( regionMemberCount . data [ i ] ) ; } else { mergeL... | Does much of the work needed to remove the redundant segments that are being merged into their root node . The list of member count is updated . mergeList is updated with the new segment IDs . |
26,709 | public static RefineEpipolar homographyRefine ( double tol , int maxIterations , EpipolarError type ) { ModelObservationResidualN residuals ; switch ( type ) { case SIMPLE : residuals = new HomographyResidualTransfer ( ) ; break ; case SAMPSON : residuals = new HomographyResidualSampson ( ) ; break ; default : throw ne... | Creates a non - linear optimizer for refining estimates of homography matrices . |
26,710 | public static RefineEpipolar fundamentalRefine ( double tol , int maxIterations , EpipolarError type ) { switch ( type ) { case SAMPSON : return new LeastSquaresFundamental ( tol , maxIterations , true ) ; case SIMPLE : return new LeastSquaresFundamental ( tol , maxIterations , false ) ; } throw new IllegalArgumentExce... | Creates a non - linear optimizer for refining estimates of fundamental or essential matrices . |
26,711 | public static EstimateNofPnP pnp_N ( EnumPNP which , int numIterations ) { MotionTransformPoint < Se3_F64 , Point3D_F64 > motionFit = FitSpecialEuclideanOps_F64 . fitPoints3D ( ) ; switch ( which ) { case P3P_GRUNERT : P3PGrunert grunert = new P3PGrunert ( PolynomialOps . createRootFinder ( 5 , RootFinderType . STURM )... | Creates an estimator for the PnP problem that uses only three observations which is the minimal case and known as P3P . |
26,712 | public static Estimate1ofPnP pnp_1 ( EnumPNP which , int numIterations , int numTest ) { if ( which == EnumPNP . EPNP ) { PnPLepetitEPnP alg = new PnPLepetitEPnP ( 0.1 ) ; alg . setNumIterations ( numIterations ) ; return new WrapPnPLepetitEPnP ( alg ) ; } else if ( which == EnumPNP . IPPE ) { Estimate1ofEpipolar H = F... | Created an estimator for the P3P problem that selects a single solution by considering additional observations . |
26,713 | public static Estimate1ofPnP computePnPwithEPnP ( int numIterations , double magicNumber ) { PnPLepetitEPnP alg = new PnPLepetitEPnP ( magicNumber ) ; alg . setNumIterations ( numIterations ) ; return new WrapPnPLepetitEPnP ( alg ) ; } | Returns a solution to the PnP problem for 4 or more points using EPnP . Fast and fairly accurate algorithm . Can handle general and planar scenario automatically . |
26,714 | public static < K extends Kernel2D > SteerableKernel < K > gaussian ( Class < K > kernelType , int orderX , int orderY , double sigma , int radius ) { if ( orderX < 0 || orderX > 4 ) throw new IllegalArgumentException ( "derivX must be from 0 to 4 inclusive." ) ; if ( orderY < 0 || orderY > 4 ) throw new IllegalArgumen... | Steerable filter for 2D Gaussian derivatives . The basis is composed of a set of rotated kernels . |
26,715 | public void process ( GrayU8 input ) { removedWatersheds = false ; output . reshape ( input . width + 2 , input . height + 2 ) ; distance . reshape ( input . width + 2 , input . height + 2 ) ; ImageMiscOps . fill ( output , INIT ) ; ImageMiscOps . fill ( distance , 0 ) ; fifo . reset ( ) ; sortPixels ( input ) ; curren... | Perform watershed segmentation on the provided input image . New basins are created at each local minima . |
26,716 | protected void sortPixels ( GrayU8 input ) { for ( int i = 0 ; i < histogram . length ; i ++ ) { histogram [ i ] . reset ( ) ; } for ( int y = 0 ; y < input . height ; y ++ ) { int index = input . startIndex + y * input . stride ; int indexOut = ( y + 1 ) * output . stride + 1 ; for ( int x = 0 ; x < input . width ; x ... | Very fast histogram based sorting . Index of each pixel is placed inside a list for its intensity level . |
26,717 | public static int numDigits ( int number ) { if ( number == 0 ) return 1 ; int adjustment = 0 ; if ( number < 0 ) { adjustment = 1 ; number = - number ; } return adjustment + ( int ) Math . log10 ( number ) + 1 ; } | Returns the number of digits in a number . E . g . 345 = 3 - 345 = 4 0 = 1 |
26,718 | public static void boundRectangleInside ( ImageBase b , ImageRectangle r ) { if ( r . x0 < 0 ) r . x0 = 0 ; if ( r . x1 > b . width ) r . x1 = b . width ; if ( r . y0 < 0 ) r . y0 = 0 ; if ( r . y1 > b . height ) r . y1 = b . height ; } | Bounds the provided rectangle to be inside the image . |
26,719 | public static boolean checkInside ( ImageBase b , int x , int y , int radius ) { if ( x - radius < 0 ) return false ; if ( x + radius >= b . width ) return false ; if ( y - radius < 0 ) return false ; if ( y + radius >= b . height ) return false ; return true ; } | Returns true if the point is contained inside the image and radius away from the image border . |
26,720 | public static void pause ( long milli ) { final Thread t = Thread . currentThread ( ) ; long start = System . currentTimeMillis ( ) ; while ( System . currentTimeMillis ( ) - start < milli ) { synchronized ( t ) { try { long target = milli - ( System . currentTimeMillis ( ) - start ) ; if ( target > 0 ) t . wait ( targ... | Invokes wait until the elapsed time has passed . In the thread is interrupted the interrupt is ignored . |
26,721 | private void processStream ( CameraPinholeBrown intrinsic , SimpleImageSequence < GrayU8 > sequence , ImagePanel gui , long pauseMilli ) { Font font = new Font ( "Serif" , Font . BOLD , 24 ) ; Se3_F64 fiducialToCamera = new Se3_F64 ( ) ; int frameNumber = 0 ; while ( sequence . hasNext ( ) ) { long before = System . cu... | Displays a continuous stream of images |
26,722 | private void processImage ( CameraPinholeBrown intrinsic , BufferedImage buffered , ImagePanel gui ) { Font font = new Font ( "Serif" , Font . BOLD , 24 ) ; GrayU8 gray = new GrayU8 ( buffered . getWidth ( ) , buffered . getHeight ( ) ) ; ConvertBufferedImage . convertFrom ( buffered , gray ) ; Se3_F64 fiducialToCamera... | Displays a simple image |
26,723 | public byte [ ] readFrame ( DataInputStream in ) { try { if ( findMarker ( in , SOI ) && in . available ( ) > 0 ) { return readJpegData ( in , EOI ) ; } } catch ( IOException e ) { } return null ; } | Read a single frame at a time |
26,724 | void applyToBorder ( GrayU8 input , GrayU8 output , int y0 , int y1 , int x0 , int x1 , ApplyHelper h ) { h . computeHistogram ( 0 , 0 , input ) ; h . applyToBlock ( 0 , 0 , x0 + 1 , y0 + 1 , input , output ) ; for ( int x = x0 + 1 ; x < x1 ; x ++ ) { h . updateHistogramX ( x - x0 , 0 , input ) ; h . applyToBlock ( x ,... | Apply around the image border . Use a region that s the full size but apply to all pixels that the region would go outside of it was centered on them . |
26,725 | public static PixelTransform < Point2D_F32 > createPixelTransform ( InvertibleTransform transform ) { PixelTransform < Point2D_F32 > pixelTran ; if ( transform instanceof Homography2D_F64 ) { Homography2D_F32 t = ConvertFloatType . convert ( ( Homography2D_F64 ) transform , null ) ; pixelTran = new PixelTransformHomogr... | Given a motion model create a PixelTransform used to distort the image |
26,726 | public static < T extends ImageGray < T > > OrientationImage < T > sift ( ConfigSiftScaleSpace configSS , ConfigSiftOrientation configOri , Class < T > imageType ) { if ( configSS == null ) configSS = new ConfigSiftScaleSpace ( ) ; configSS . checkValidity ( ) ; OrientationHistogramSift < GrayF32 > ori = FactoryOrienta... | Creates an implementation of the SIFT orientation estimation algorithm |
26,727 | public static List < Point2D_F64 > gridChess ( int numRows , int numCols , double squareWidth ) { List < Point2D_F64 > all = new ArrayList < > ( ) ; numCols = numCols - 1 ; numRows = numRows - 1 ; double startX = - ( ( numCols - 1 ) * squareWidth ) / 2.0 ; double startY = - ( ( numRows - 1 ) * squareWidth ) / 2.0 ; for... | This target is composed of a checkered chess board like squares . Each corner of an interior square touches an adjacent square but the sides are separated . Only interior square corners provide calibration points . |
26,728 | public static < T extends ImageGray < T > > void naiveGradient ( T ii , double tl_x , double tl_y , double samplePeriod , int regionSize , double kernelSize , boolean useHaar , double [ ] derivX , double derivY [ ] ) { SparseScaleGradient < T , ? > gg = SurfDescribeOps . createGradient ( useHaar , ( Class < T > ) ii . ... | Simple algorithm for computing the gradient of a region . Can handle image borders |
26,729 | public void setImageGradient ( D derivX , D derivY ) { InputSanityCheck . checkSameShape ( derivX , derivY ) ; if ( derivX . stride != derivY . stride || derivX . startIndex != derivY . startIndex ) throw new IllegalArgumentException ( "stride and start index must be the same" ) ; savedAngle . reshape ( derivX . width ... | Sets the gradient and precomputes pixel orientation and magnitude |
26,730 | public void process ( ) { int width = widthSubregion * widthGrid ; int radius = width / 2 ; int X0 = radius , X1 = savedAngle . width - radius ; int Y0 = radius , Y1 = savedAngle . height - radius ; int numX = ( int ) ( ( X1 - X0 ) / periodColumns ) ; int numY = ( int ) ( ( Y1 - Y0 ) / periodRows ) ; descriptors . rese... | Computes SIFT descriptors across the entire image |
26,731 | void precomputeAngles ( D image ) { int savecIndex = 0 ; for ( int y = 0 ; y < image . height ; y ++ ) { int pixelIndex = y * image . stride + image . startIndex ; for ( int x = 0 ; x < image . width ; x ++ , pixelIndex ++ , savecIndex ++ ) { float spacialDX = imageDerivX . getF ( pixelIndex ) ; float spacialDY = image... | Computes the angle of each pixel and its gradient magnitude |
26,732 | public void computeDescriptor ( int cx , int cy , TupleDesc_F64 desc ) { desc . fill ( 0 ) ; int widthPixels = widthSubregion * widthGrid ; int radius = widthPixels / 2 ; for ( int i = 0 ; i < widthPixels ; i ++ ) { int angleIndex = ( cy - radius + i ) * savedAngle . width + ( cx - radius ) ; float subY = i / ( float )... | Computes the descriptor centered at the specified coordinate |
26,733 | static public void naive4 ( GrayF32 _intensity , GrayS8 direction , GrayF32 output ) { final int w = _intensity . width ; final int h = _intensity . height ; ImageBorder_F32 intensity = ( ImageBorder_F32 ) FactoryImageBorderAlgs . value ( _intensity , 0 ) ; BoofConcurrency . loopFor ( 0 , h , y -> { for ( int x = 0 ; x... | Slow algorithm which processes the whole image . |
26,734 | public void reset ( ) { for ( int i = 0 ; i < 4 ; i ++ ) { ppCorner . get ( i ) . set ( 0 , 0 ) ; ppDown . get ( i ) . set ( 0 , 0 ) ; ppRight . get ( i ) . set ( 0 , 0 ) ; } this . threshCorner = 0 ; this . threshDown = 0 ; this . threshRight = 0 ; version = - 1 ; error = L ; mask = QrCodeMaskPattern . M111 ; alignmen... | Resets the QR - Code so that it s in its initial state . |
26,735 | public void set ( QrCode o ) { this . version = o . version ; this . error = o . error ; this . mask = o . mask ; this . mode = o . mode ; this . rawbits = o . rawbits == null ? null : o . rawbits . clone ( ) ; this . corrected = o . corrected == null ? null : o . corrected . clone ( ) ; this . message = o . message ; ... | Sets this so that it s equivalent to o . |
26,736 | public static void ensureDeterminantOfOne ( List < Homography2D_F64 > homography0toI ) { int N = homography0toI . size ( ) ; for ( int i = 0 ; i < N ; i ++ ) { Homography2D_F64 H = homography0toI . get ( i ) ; double d = CommonOps_DDF3 . det ( H ) ; if ( d < 0 ) CommonOps_DDF3 . divide ( H , - Math . pow ( - d , 1.0 / ... | Scales all homographies so that their determinants are equal to one |
26,737 | private boolean extractCalibration ( DMatrixRMaj x , CameraPinhole calibration ) { double s = x . data [ 5 ] ; double cx = calibration . cx = x . data [ 2 ] / s ; double cy = calibration . cy = x . data [ 4 ] / s ; double fy = calibration . fy = Math . sqrt ( x . data [ 3 ] / s - cy * cy ) ; double sk = calibration . s... | Extracts camera parameters from the solution . Checks for errors |
26,738 | private static WlBorderCoef < WlCoef_F32 > computeBorderCoefficients ( BorderIndex1D border , WlCoef_F32 forward , WlCoef_F32 inverse ) { int N = Math . max ( forward . getScalingLength ( ) , forward . getWaveletLength ( ) ) ; N += N % 2 ; N *= 2 ; border . setLength ( N ) ; DMatrixRMaj A = new DMatrixRMaj ( N , N ) ; ... | Computes inverse coefficients |
26,739 | public static WlBorderCoefFixed < WlCoef_I32 > convertToInt ( WlBorderCoefFixed < WlCoef_F32 > orig , WlCoef_I32 inner ) { WlBorderCoefFixed < WlCoef_I32 > ret = new WlBorderCoefFixed < > ( orig . getLowerLength ( ) , orig . getUpperLength ( ) ) ; for ( int i = 0 ; i < orig . getLowerLength ( ) ; i ++ ) { WlCoef_F32 o ... | todo rename and move to a utility function? |
26,740 | public int updateMixture ( float [ ] pixelValue , float [ ] dataRow , int modelIndex ) { int index = modelIndex ; float bestDistance = maxDistance * numBands ; int bestIndex = - 1 ; int ng ; for ( ng = 0 ; ng < maxGaussians ; ng ++ , index += gaussianStride ) { float variance = dataRow [ index + 1 ] ; if ( variance <= ... | Updates the mixtures of gaussian and determines if the pixel matches the background model |
26,741 | public void updateWeightAndPrune ( float [ ] dataRow , int modelIndex , int ng , int bestIndex , float bestWeight ) { int index = modelIndex ; float weightTotal = 0 ; for ( int i = 0 ; i < ng ; ) { float weight = dataRow [ index ] ; weight = weight - learningRate * ( weight + decay ) ; if ( weight <= 0 ) { int indexLas... | Updates the weight of each Gaussian and prunes one which have a negative weight after the update . |
26,742 | public int checkBackground ( float [ ] pixelValue , float [ ] dataRow , int modelIndex ) { int index = modelIndex ; float bestDistance = maxDistance * numBands ; float bestWeight = 0 ; int ng ; for ( ng = 0 ; ng < maxGaussians ; ng ++ , index += gaussianStride ) { float variance = dataRow [ index + 1 ] ; if ( variance ... | Checks to see if the the pivel value refers to the background or foreground |
26,743 | public static < T extends ImageGray < T > > T yuvToGray ( ByteBuffer bufferY , int width , int height , int strideRow , T output , BWorkArrays workArrays , Class < T > outputType ) { if ( outputType == GrayU8 . class ) { return ( T ) yuvToGray ( bufferY , width , height , strideRow , ( GrayU8 ) output ) ; } else if ( o... | Converts an YUV 420 888 into gray |
26,744 | public void requestSaveInputImage ( ) { saveRequested = false ; switch ( inputMethod ) { case IMAGE : new Thread ( ( ) -> saveInputImage ( ) ) . start ( ) ; break ; case VIDEO : case WEBCAM : if ( streamPaused ) { saveInputImage ( ) ; } else { saveRequested = true ; } break ; } } | Makes a request that the input image be saved . This request might be carried out immediately or when then next image is processed . |
26,745 | public boolean generate ( List < AssociatedPair > dataSet , Se3_F64 model ) { if ( ! computeEssential . process ( dataSet , E ) ) return false ; decomposeE . decompose ( E ) ; selectBest . select ( decomposeE . getSolutions ( ) , dataSet , model ) ; return true ; } | Computes the camera motion from the set of observations . The motion is from the first into the second camera frame . |
26,746 | public void setCameraParameters ( float fx , float fy , float cx , float cy , int width , int height ) { this . fx = fx ; this . fy = fy ; this . cx = cx ; this . cy = cy ; derivX . reshape ( width , height ) ; derivY . reshape ( width , height ) ; int N = width * height * imageType . getNumBands ( ) ; A . reshape ( N ... | Specifies intrinsic camera parameters . Must be called . |
26,747 | public void setInterpolation ( double inputMin , double inputMax , double derivMin , double derivMax , InterpolationType type ) { interpI = FactoryInterpolation . createPixelS ( inputMin , inputMax , type , BorderType . EXTENDED , imageType . getImageClass ( ) ) ; interpDX = FactoryInterpolation . createPixelS ( derivM... | Used to change interpolation method . Probably don t want to do this . |
26,748 | void setKeyFrame ( Planar < I > input , ImagePixelTo3D pixelTo3D ) { InputSanityCheck . checkSameShape ( derivX , input ) ; wrapI . wrap ( input ) ; keypixels . reset ( ) ; for ( int y = 0 ; y < input . height ; y ++ ) { for ( int x = 0 ; x < input . width ; x ++ ) { if ( ! pixelTo3D . process ( x , y ) ) { continue ; ... | Set s the keyframe . This is the image which motion is estimated relative to . The 3D location of points in the keyframe must be known . |
26,749 | public double computeFeatureDiversity ( Se3_F32 keyToCurrent ) { diversity . reset ( ) ; for ( int i = 0 ; i < keypixels . size ( ) ; i ++ ) { Pixel p = keypixels . data [ i ] ; if ( ! p . valid ) continue ; SePointOps_F32 . transform ( keyToCurrent , p . p3 , S ) ; diversity . addPoint ( S . x , S . y , S . z ) ; } di... | Computes the diversity of valid pixels in keyframe to the location in the current frame . |
26,750 | public boolean estimateMotion ( Planar < I > input , Se3_F32 hintKeyToInput ) { InputSanityCheck . checkSameShape ( derivX , input ) ; initMotion ( input ) ; keyToCurrent . set ( hintKeyToInput ) ; boolean foundSolution = false ; float previousError = Float . MAX_VALUE ; for ( int i = 0 ; i < maxIterations ; i ++ ) { c... | Estimates the motion relative to the key frame . |
26,751 | void initMotion ( Planar < I > input ) { if ( solver == null ) { solver = LinearSolverFactory_DDRM . qr ( input . width * input . height * input . getNumBands ( ) , 6 ) ; } computeD . process ( input , derivX , derivY ) ; } | Initialize motion related data structures |
26,752 | public boolean process ( List < AssociatedPair > points , FastQueue < DMatrixRMaj > solutions ) { if ( points . size ( ) != 5 ) throw new IllegalArgumentException ( "Exactly 5 points are required, not " + points . size ( ) ) ; solutions . reset ( ) ; computeSpan ( points ) ; helper . setNullSpace ( X , Y , Z , W ) ; he... | Computes the essential matrix from point correspondences . |
26,753 | private void solveForXandY ( double z ) { this . z = z ; tmpA . data [ 0 ] = ( ( helper . K00 * z + helper . K01 ) * z + helper . K02 ) * z + helper . K03 ; tmpA . data [ 1 ] = ( ( helper . K04 * z + helper . K05 ) * z + helper . K06 ) * z + helper . K07 ; tmpY . data [ 0 ] = ( ( ( helper . K08 * z + helper . K09 ) * z... | Once z is known then x and y can be solved for using the B matrix |
26,754 | public boolean checkPixel ( Point2D_F64 left , Point2D_F64 right ) { leftImageToRect . compute ( left . x , left . y , rectLeft ) ; rightImageToRect . compute ( right . x , right . y , rectRight ) ; return checkRectified ( rectLeft , rectRight ) ; } | Checks to see if the observations from the left and right camera are consistent . Observations are assumed to be in the original image pixel coordinates . |
26,755 | public boolean checkRectified ( Point2D_F64 left , Point2D_F64 right ) { if ( Math . abs ( left . y - right . y ) > toleranceY ) return false ; return right . x <= left . x + toleranceX ; } | Checks to see if the observations from the left and right camera are consistent . Observations are assumed to be in the rectified image pixel coordinates . |
26,756 | public static < T extends ImageGray < T > > DescribePointBriefSO < T > briefso ( BinaryCompareDefinition_I32 definition , BlurFilter < T > filterBlur ) { Class < T > imageType = filterBlur . getInputType ( ) . getImageClass ( ) ; InterpolatePixelS < T > interp = FactoryInterpolation . bilinearPixelS ( imageType , Borde... | todo remove filterBlur for all BRIEF change to radius sigma type |
26,757 | public boolean checkVariance ( ImageRectangle r ) { double sigma2 = computeVariance ( r . x0 , r . y0 , r . x1 , r . y1 ) ; return sigma2 >= thresholdLower ; } | Performs variance test at the specified rectangle |
26,758 | protected double computeVariance ( int x0 , int y0 , int x1 , int y1 ) { double square = GIntegralImageOps . block_unsafe ( integralSq , x0 - 1 , y0 - 1 , x1 - 1 , y1 - 1 ) ; double area = ( x1 - x0 ) * ( y1 - y0 ) ; double mean = GIntegralImageOps . block_unsafe ( integral , x0 - 1 , y0 - 1 , x1 - 1 , y1 - 1 ) / area ... | Computes the variance inside the specified rectangle . x0 and y0 must be > ; 0 . |
26,759 | protected double computeVarianceSafe ( int x0 , int y0 , int x1 , int y1 ) { double square = GIntegralImageOps . block_zero ( integralSq , x0 - 1 , y0 - 1 , x1 - 1 , y1 - 1 ) ; double area = ( x1 - x0 ) * ( y1 - y0 ) ; double mean = GIntegralImageOps . block_zero ( integral , x0 - 1 , y0 - 1 , x1 - 1 , y1 - 1 ) / area ... | Computes the variance inside the specified rectangle . |
26,760 | public static void transformSq ( final GrayU8 input , final GrayS64 transformed ) { int indexSrc = input . startIndex ; int indexDst = transformed . startIndex ; int end = indexSrc + input . width ; long total = 0 ; for ( ; indexSrc < end ; indexSrc ++ ) { int value = input . data [ indexSrc ] & 0xFF ; transformed . da... | Integral image of pixel value squared . integer |
26,761 | public static void transformSq ( final GrayF32 input , final GrayF64 transformed ) { int indexSrc = input . startIndex ; int indexDst = transformed . startIndex ; int end = indexSrc + input . width ; double total = 0 ; for ( ; indexSrc < end ; indexSrc ++ ) { float value = input . data [ indexSrc ] ; transformed . data... | Integral image of pixel value squared . floating point |
26,762 | private int addView ( DMatrixRMaj P , Point2D_F64 a , int index ) { final double sx = stats . stdX , sy = stats . stdY ; double r11 = P . data [ 0 ] , r12 = P . data [ 1 ] , r13 = P . data [ 2 ] , r14 = P . data [ 3 ] ; double r21 = P . data [ 4 ] , r22 = P . data [ 5 ] , r23 = P . data [ 6 ] , r24 = P . data [ 7 ] ; d... | Adds a view to the A matrix . Computed using cross product . |
26,763 | protected void detectionCascade ( FastQueue < ImageRectangle > cascadeRegions ) { success = false ; ambiguous = false ; best = null ; candidateDetections . reset ( ) ; localMaximums . reset ( ) ; ambiguousRegions . clear ( ) ; storageMetric . reset ( ) ; storageIndexes . reset ( ) ; storageRect . clear ( ) ; fernRegion... | Detects the object inside the image . Eliminates candidate regions using a cascade of tests |
26,764 | protected void computeTemplateConfidence ( ) { double max = 0 ; for ( int i = 0 ; i < fernRegions . size ( ) ; i ++ ) { ImageRectangle region = fernRegions . get ( i ) ; double confidence = template . computeConfidence ( region ) ; max = Math . max ( max , confidence ) ; if ( confidence < config . confidenceThresholdUp... | Computes the confidence for all the regions which pass the fern test |
26,765 | protected void selectBestRegionsFern ( double totalP , double totalN ) { for ( int i = 0 ; i < fernInfo . size ; i ++ ) { TldRegionFernInfo info = fernInfo . get ( i ) ; double probP = info . sumP / totalP ; double probN = info . sumN / totalN ; if ( probP > probN ) { storageMetric . add ( - ( probP - probN ) ) ; stora... | compute the probability that each region is the target conditional upon this image the sumP and sumN are needed for image conditional probability |
26,766 | public void setImage ( ImagePyramid < InputImage > image , DerivativeImage [ ] derivX , DerivativeImage [ ] derivY ) { if ( image . getNumLayers ( ) != derivX . length || image . getNumLayers ( ) != derivY . length ) throw new IllegalArgumentException ( "Number of layers does not match." ) ; this . image = image ; this... | Sets the current input images for the tracker to use . |
26,767 | public void setImage ( ImagePyramid < InputImage > image ) { this . image = image ; this . derivX = null ; this . derivY = null ; } | Only sets the image pyramid . The derivatives are set to null . Only use this when tracking . |
26,768 | public static void equalize ( int histogram [ ] , int transform [ ] ) { int sum = 0 ; for ( int i = 0 ; i < histogram . length ; i ++ ) { transform [ i ] = sum += histogram [ i ] ; } int maxValue = histogram . length - 1 ; for ( int i = 0 ; i < histogram . length ; i ++ ) { transform [ i ] = ( transform [ i ] * maxValu... | Computes a transformation table which will equalize the provided histogram . An equalized histogram spreads the weight across the whole spectrum of values . Often used to make dim images easier for people to see . |
26,769 | public static void sharpen8 ( GrayU8 input , GrayU8 output ) { InputSanityCheck . checkSameShape ( input , output ) ; if ( BoofConcurrency . USE_CONCURRENT ) { ImplEnhanceFilter_MT . sharpenInner8 ( input , output , 0 , 255 ) ; ImplEnhanceFilter_MT . sharpenBorder8 ( input , output , 0 , 255 ) ; } else { ImplEnhanceFil... | Applies a Laplacian - 8 based sharpen filter to the image . |
26,770 | protected void updateTrackLocation ( SetTrackInfo < Desc > info , FastQueue < AssociatedIndex > matches ) { info . matches . resize ( matches . size ) ; for ( int i = 0 ; i < matches . size ; i ++ ) { info . matches . get ( i ) . set ( matches . get ( i ) ) ; } tracksActive . clear ( ) ; for ( int i = 0 ; i < info . ma... | Update each track s location only and not its description . Update the active list too |
26,771 | public static int hamming ( TupleDesc_B a , TupleDesc_B b ) { int score = 0 ; final int N = a . data . length ; for ( int i = 0 ; i < N ; i ++ ) { score += hamming ( a . data [ i ] ^ b . data [ i ] ) ; } return score ; } | Computes the hamming distance between two binary feature descriptors |
26,772 | public static void derivX_F32 ( GrayF32 orig , GrayF32 derivX ) { final float [ ] data = orig . data ; final float [ ] imgX = derivX . data ; final int width = orig . getWidth ( ) ; final int height = orig . getHeight ( ) ; for ( int y = 0 ; y < height ; y ++ ) { int index = width * y + 1 ; int endX = index + width - 2... | Can only be used with images that are NOT sub - images . |
26,773 | private void pruneTracks ( SetTrackInfo < Desc > info , GrowQueue_I32 unassociated ) { if ( unassociated . size > maxInactiveTracks ) { int numDrop = unassociated . size - maxInactiveTracks ; for ( int i = 0 ; i < numDrop ; i ++ ) { int selected = rand . nextInt ( unassociated . size - i ) + i ; int a = unassociated . ... | If there are too many unassociated tracks randomly select some of those tracks and drop them |
26,774 | protected void putIntoSrcList ( SetTrackInfo < Desc > info ) { if ( info . isAssociated . length < info . tracks . size ( ) ) { info . isAssociated = new boolean [ info . tracks . size ( ) ] ; } info . featSrc . reset ( ) ; info . locSrc . reset ( ) ; for ( int i = 0 ; i < info . tracks . size ( ) ; i ++ ) { PointTrack... | Put existing tracks into source list for association |
26,775 | public void spawnTracks ( ) { for ( int setIndex = 0 ; setIndex < sets . length ; setIndex ++ ) { SetTrackInfo < Desc > info = sets [ setIndex ] ; if ( info . isAssociated . length < info . featDst . size ) { info . isAssociated = new boolean [ info . featDst . size ] ; } for ( int i = 0 ; i < info . featDst . size ; i... | Takes the current crop of detected features and makes them the keyframe |
26,776 | protected PointTrack addNewTrack ( int setIndex , double x , double y , Desc desc ) { PointTrack p = getUnused ( ) ; p . set ( x , y ) ; ( ( Desc ) p . getDescription ( ) ) . setTo ( desc ) ; if ( checkValidSpawn ( setIndex , p ) ) { p . setId = setIndex ; p . featureId = featureID ++ ; sets [ setIndex ] . tracks . add... | Adds a new track given its location and description |
26,777 | protected PointTrack getUnused ( ) { PointTrack p ; if ( unused . size ( ) > 0 ) { p = unused . remove ( unused . size ( ) - 1 ) ; } else { p = new PointTrack ( ) ; p . setDescription ( manager . createDescription ( ) ) ; } return p ; } | Returns an unused track . If there are no unused tracks then it creates a ne one . |
26,778 | public boolean dropTrack ( PointTrack track ) { if ( ! tracksAll . remove ( track ) ) return false ; if ( ! sets [ track . setId ] . tracks . remove ( track ) ) { return false ; } tracksActive . remove ( track ) ; tracksInactive . remove ( track ) ; unused . add ( track ) ; return true ; } | Remove from active list and mark so that it is dropped in the next cycle |
26,779 | private void addRodriguesJacobian ( DMatrixRMaj Rj , Point3D_F64 worldPt , Point3D_F64 cameraPt ) { double Rx = ( Rj . data [ 0 ] * worldPt . x + Rj . data [ 1 ] * worldPt . y + Rj . data [ 2 ] * worldPt . z ) / cameraPt . z ; double Ry = ( Rj . data [ 3 ] * worldPt . x + Rj . data [ 4 ] * worldPt . y + Rj . data [ 5 ]... | Adds to the Jacobian matrix using the derivative from a Rodrigues parameter . |
26,780 | private void addTranslationJacobian ( Point3D_F64 cameraPt ) { double divZ = 1.0 / cameraPt . z ; double divZ2 = 1.0 / ( cameraPt . z * cameraPt . z ) ; output [ indexX ++ ] = divZ ; output [ indexY ++ ] = 0 ; output [ indexX ++ ] = 0 ; output [ indexY ++ ] = divZ ; output [ indexX ++ ] = - cameraPt . x * divZ2 ; outpu... | Derivative for translation element |
26,781 | private void addTranslationJacobian ( DMatrixRMaj R , Point3D_F64 cameraPt ) { double z = cameraPt . z ; double z2 = z * z ; output [ indexX ++ ] = R . get ( 0 , 0 ) / cameraPt . z - R . get ( 2 , 0 ) / z2 * cameraPt . x ; output [ indexY ++ ] = R . get ( 1 , 0 ) / cameraPt . z - R . get ( 2 , 0 ) / z2 * cameraPt . y ;... | The translation vector is now multiplied by 3x3 matrix R . The components of T are no longer decoupled . |
26,782 | public static float [ ] subbandAbsVal ( GrayF32 subband , float [ ] coef ) { if ( coef == null ) { coef = new float [ subband . width * subband . height ] ; } int i = 0 ; for ( int y = 0 ; y < subband . height ; y ++ ) { int index = subband . startIndex + subband . stride * y ; int end = index + subband . width ; for (... | Computes the absolute value of each element in the subband image are places it into coef |
26,783 | public static < T extends ImageBase < T > > BlurStorageFilter < T > median ( ImageType < T > type , int radius ) { return new BlurStorageFilter < > ( "median" , type , radius ) ; } | Creates a median filter for the specified image type . |
26,784 | public static < T extends ImageBase < T > > BlurStorageFilter < T > mean ( ImageType < T > type , int radius ) { return new BlurStorageFilter < > ( "mean" , type , radius ) ; } | Creates a mean filter for the specified image type . |
26,785 | public static < T extends ImageBase < T > > BlurStorageFilter < T > gaussian ( ImageType < T > type , double sigma , int radius ) { return new BlurStorageFilter < > ( "gaussian" , type , sigma , radius ) ; } | Creates a Gaussian filter for the specified image type . |
26,786 | public void initialize ( T image , int x0 , int y0 , int regionWidth , int regionHeight ) { this . imageWidth = image . width ; this . imageHeight = image . height ; setTrackLocation ( x0 , y0 , regionWidth , regionHeight ) ; initialLearning ( image ) ; } | Initializes tracking around the specified rectangle region |
26,787 | public void setTrackLocation ( int x0 , int y0 , int regionWidth , int regionHeight ) { if ( imageWidth < regionWidth || imageHeight < regionHeight ) throw new IllegalArgumentException ( "Track region is larger than input image: " + regionWidth + " " + regionHeight ) ; regionOut . width = regionWidth ; regionOut . heig... | Used to change the track s location . If this method is used it is assumed that tracking is active and that the appearance of the target has not changed |
26,788 | protected void initialLearning ( T image ) { get_subwindow ( image , template ) ; dense_gauss_kernel ( sigma , template , template , k ) ; fft . forward ( k , kf ) ; computeAlphas ( gaussianWeightDFT , kf , lambda , alphaf ) ; } | Learn the target s appearance . |
26,789 | protected static void computeCosineWindow ( GrayF64 cosine ) { double cosX [ ] = new double [ cosine . width ] ; for ( int x = 0 ; x < cosine . width ; x ++ ) { cosX [ x ] = 0.5 * ( 1 - Math . cos ( 2.0 * Math . PI * x / ( cosine . width - 1 ) ) ) ; } for ( int y = 0 ; y < cosine . height ; y ++ ) { int index = cosine ... | Computes the cosine window |
26,790 | protected void computeGaussianWeights ( int width ) { double output_sigma = Math . sqrt ( width * width ) * output_sigma_factor ; double left = - 0.5 / ( output_sigma * output_sigma ) ; int radius = width / 2 ; for ( int y = 0 ; y < gaussianWeight . height ; y ++ ) { int index = gaussianWeight . startIndex + y * gaussi... | Computes the weights used in the gaussian kernel |
26,791 | public void performTracking ( T image ) { if ( image . width != imageWidth || image . height != imageHeight ) throw new IllegalArgumentException ( "Tracking image size is not the same as " + "input image. Expected " + imageWidth + " x " + imageHeight ) ; updateTrackLocation ( image ) ; if ( interp_factor != 0 ) perform... | Search for the track in the image and |
26,792 | protected void updateTrackLocation ( T image ) { get_subwindow ( image , templateNew ) ; dense_gauss_kernel ( sigma , templateNew , template , k ) ; fft . forward ( k , kf ) ; DiscreteFourierTransformOps . multiplyComplex ( alphaf , kf , tmpFourier0 ) ; fft . inverse ( tmpFourier0 , response ) ; int N = response . widt... | Find the target inside the current image by searching around its last known location |
26,793 | protected void subpixelPeak ( int peakX , int peakY ) { int r = Math . min ( 2 , response . width / 25 ) ; if ( r < 0 ) return ; localPeak . setSearchRadius ( r ) ; localPeak . search ( peakX , peakY ) ; offX = localPeak . getPeakX ( ) - peakX ; offY = localPeak . getPeakY ( ) - peakY ; } | Refine the local - peak using a search algorithm for sub - pixel accuracy . |
26,794 | public void performLearning ( T image ) { get_subwindow ( image , templateNew ) ; dense_gauss_kernel ( sigma , templateNew , templateNew , k ) ; fft . forward ( k , kf ) ; computeAlphas ( gaussianWeightDFT , kf , lambda , newAlphaf ) ; int N = alphaf . width * alphaf . height * 2 ; for ( int i = 0 ; i < N ; i ++ ) { al... | Update the alphas and the track s appearance |
26,795 | public static double imageDotProduct ( GrayF64 a ) { double total = 0 ; int N = a . width * a . height ; for ( int index = 0 ; index < N ; index ++ ) { double value = a . data [ index ] ; total += value * value ; } return total ; } | Computes the dot product of the image with itself |
26,796 | public static void elementMultConjB ( InterleavedF64 a , InterleavedF64 b , InterleavedF64 output ) { for ( int y = 0 ; y < a . height ; y ++ ) { int index = a . startIndex + y * a . stride ; for ( int x = 0 ; x < a . width ; x ++ , index += 2 ) { double realA = a . data [ index ] ; double imgA = a . data [ index + 1 ]... | Element - wise multiplication of a and the complex conjugate of b |
26,797 | protected static void gaussianKernel ( double xx , double yy , GrayF64 xy , double sigma , GrayF64 output ) { double sigma2 = sigma * sigma ; double N = xy . width * xy . height ; for ( int y = 0 ; y < xy . height ; y ++ ) { int index = xy . startIndex + y * xy . stride ; for ( int x = 0 ; x < xy . width ; x ++ , index... | Computes the output of the Gaussian kernel for each element in the target region |
26,798 | protected void get_subwindow ( T image , GrayF64 output ) { interp . setImage ( image ) ; int index = 0 ; for ( int y = 0 ; y < workRegionSize ; y ++ ) { float yy = regionTrack . y0 + y * stepY ; for ( int x = 0 ; x < workRegionSize ; x ++ ) { float xx = regionTrack . x0 + x * stepX ; if ( interp . isInFastBounds ( xx ... | Copies the target into the output image and applies the cosine window to it . |
26,799 | void selectBlockSize ( int width , int height , int requestedBlockWidth ) { if ( height < requestedBlockWidth ) { blockHeight = height ; } else { int rows = height / requestedBlockWidth ; blockHeight = height / rows ; } if ( width < requestedBlockWidth ) { blockWidth = width ; } else { int cols = width / requestedBlock... | Selects a block size which is close to the requested block size by the user |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.