idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
27,300 | public void init ( ) { N = getParameterLength ( ) ; jacR = new DMatrixRMaj [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { jacR [ i ] = new DMatrixRMaj ( 3 , 3 ) ; } jacobian = new DMatrixRMaj ( N , 9 ) ; paramInternal = new double [ N ] ; numericalJac = createNumericalAlgorithm ( function ) ; } | Initializes data structures . Separate function to make it easier to extend the class |
27,301 | public void checkOneObservationPerView ( ) { for ( int viewIdx = 0 ; viewIdx < views . length ; viewIdx ++ ) { SceneObservations . View v = views [ viewIdx ] ; for ( int obsIdx = 0 ; obsIdx < v . size ( ) ; obsIdx ++ ) { int a = v . point . get ( obsIdx ) ; for ( int i = obsIdx + 1 ; i < v . size ( ) ; i ++ ) { if ( a ... | Makes sure that each feature is only observed in each view |
27,302 | public static void profile ( Performer performer , int num ) { long deltaTime = measureTime ( performer , num ) ; System . out . printf ( "%30s time = %8d ms per frame = %8.3f\n" , performer . getName ( ) , deltaTime , ( deltaTime / ( double ) num ) ) ; } | See how long it takes to run the process num times and print the results to standard out |
27,303 | protected void initialize ( T input , GrayS32 output ) { this . graph = output ; final int N = input . width * input . height ; regionSize . resize ( N ) ; threshold . resize ( N ) ; for ( int i = 0 ; i < N ; i ++ ) { regionSize . data [ i ] = 1 ; threshold . data [ i ] = K ; graph . data [ i ] = i ; } edges . reset ( ... | Predeclares all memory required and sets data structures to their initial values |
27,304 | protected void mergeSmallRegions ( ) { for ( int i = 0 ; i < edgesNotMatched . size ( ) ; i ++ ) { Edge e = edgesNotMatched . get ( i ) ; int rootA = find ( e . indexA ) ; int rootB = find ( e . indexB ) ; if ( rootA == rootB ) continue ; int sizeA = regionSize . get ( rootA ) ; int sizeB = regionSize . get ( rootB ) ;... | Look at the remaining regions and if there are any small ones marge them into a larger region |
27,305 | protected int find ( int child ) { int root = graph . data [ child ] ; if ( root == graph . data [ root ] ) return root ; int inputChild = child ; while ( root != child ) { child = root ; root = graph . data [ child ] ; } graph . data [ inputChild ] = root ; return root ; } | Finds the root given child . If the child does not point directly to the parent find the parent and make the child point directly towards it . |
27,306 | protected void computeOutput ( ) { outputRegionId . reset ( ) ; outputRegionSizes . reset ( ) ; for ( int y = 0 ; y < graph . height ; y ++ ) { int indexGraph = graph . startIndex + y * graph . stride ; for ( int x = 0 ; x < graph . width ; x ++ , indexGraph ++ ) { int parent = graph . data [ indexGraph ] ; if ( parent... | Searches for root nodes in the graph and adds their size to the list of region sizes . Makes sure all other nodes in the graph point directly at their root . |
27,307 | public void apply ( DMatrixRMaj H , DMatrixRMaj output ) { output . reshape ( 3 , H . numCols ) ; int stride = H . numCols ; for ( int col = 0 ; col < H . numCols ; col ++ ) { double h1 = H . data [ col ] , h2 = H . data [ col + stride ] , h3 = H . data [ col + 2 * stride ] ; output . data [ col ] = h1 / stdX - meanX *... | Applies normalization to a H = 3xN matrix |
27,308 | public void apply ( DMatrix3x3 C , DMatrix3x3 output ) { DMatrix3x3 Hinv = matrixInv3 ( work ) ; PerspectiveOps . multTranA ( Hinv , C , Hinv , output ) ; } | Apply transform to conic in 3x3 matrix format . |
27,309 | private static WlCoef_I32 generateInv_I32 ( ) { WlCoef_I32 ret = new WlCoef_I32 ( ) ; ret . scaling = new int [ ] { 1 , 1 } ; ret . wavelet = new int [ ] { ret . scaling [ 0 ] , - ret . scaling [ 0 ] } ; ret . denominatorScaling = 2 ; ret . denominatorWavelet = 2 ; return ret ; } | Create a description for the inverse transform . Note that this will NOT produce an exact copy of the original due to rounding error . |
27,310 | public void updateTracks ( I input , PyramidDiscrete < I > pyramid , D [ ] derivX , D [ ] derivY ) { tracksSpawned . clear ( ) ; this . input = input ; trackerKlt . setInputs ( pyramid , derivX , derivY ) ; trackUsingKlt ( tracksPureKlt ) ; trackUsingKlt ( tracksReactivated ) ; } | Updates the location and description of tracks using KLT . Saves a reference to the input image for future processing . |
27,311 | private void trackUsingKlt ( List < CombinedTrack < TD > > tracks ) { for ( int i = 0 ; i < tracks . size ( ) ; ) { CombinedTrack < TD > track = tracks . get ( i ) ; if ( ! trackerKlt . performTracking ( track . track ) ) { tracks . remove ( i ) ; tracksDormant . add ( track ) ; } else { track . set ( track . track . x... | Tracks features in the list using KLT and update their state |
27,312 | public void spawnTracksFromDetected ( ) { FastQueue < AssociatedIndex > matches = associate . getMatches ( ) ; int N = detector . getNumberOfFeatures ( ) ; for ( int i = 0 ; i < N ; i ++ ) associated [ i ] = false ; for ( AssociatedIndex i : matches . toList ( ) ) { associated [ i . dst ] = true ; } for ( int i = 0 ; i... | From the found interest points create new tracks . Tracks are only created at points where there are no existing tracks . |
27,313 | private void associateToDetected ( List < CombinedTrack < TD > > known ) { detectedDesc . reset ( ) ; knownDesc . reset ( ) ; int N = detector . getNumberOfFeatures ( ) ; for ( int i = 0 ; i < N ; i ++ ) { detectedDesc . add ( detector . getDescription ( i ) ) ; } for ( CombinedTrack < TD > t : known ) { knownDesc . ad... | Associates pre - existing tracks to newly detected features |
27,314 | public void associateAllToDetected ( ) { List < CombinedTrack < TD > > all = new ArrayList < > ( ) ; all . addAll ( tracksReactivated ) ; all . addAll ( tracksDormant ) ; all . addAll ( tracksPureKlt ) ; int numTainted = tracksReactivated . size ( ) + tracksDormant . size ( ) ; tracksReactivated . clear ( ) ; tracksDor... | Associate all tracks in any state to the latest observations . If a dormant track is associated it will be reactivated . If a reactivated track is associated it s state will be updated . PureKLT tracks are left unmodified . |
27,315 | public boolean dropTrack ( CombinedTrack < TD > track ) { if ( ! tracksPureKlt . remove ( track ) ) if ( ! tracksReactivated . remove ( track ) ) if ( ! tracksDormant . remove ( track ) ) return false ; tracksUnused . add ( track ) ; return true ; } | Stops tracking the specified track and recycles its data . |
27,316 | public void dropAllTracks ( ) { tracksUnused . addAll ( tracksDormant ) ; tracksUnused . addAll ( tracksPureKlt ) ; tracksUnused . addAll ( tracksReactivated ) ; tracksSpawned . clear ( ) ; tracksPureKlt . clear ( ) ; tracksReactivated . clear ( ) ; tracksSpawned . clear ( ) ; tracksDormant . clear ( ) ; } | Drops all tracks and recycles the data |
27,317 | private void processImage ( ) { final List < Point2D_F64 > leftPts = new ArrayList < > ( ) ; final List < Point2D_F64 > rightPts = new ArrayList < > ( ) ; final List < TupleDesc > leftDesc = new ArrayList < > ( ) ; final List < TupleDesc > rightDesc = new ArrayList < > ( ) ; final ProgressMonitor progressMonitor = new ... | Extracts image information and then passes that info onto scorePanel for display . Data is not recycled to avoid threading issues . |
27,318 | private void extractImageFeatures ( final ProgressMonitor progressMonitor , final int progress , T image , List < TupleDesc > descs , List < Point2D_F64 > locs ) { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { progressMonitor . setNote ( "Detecting" ) ; } } ) ; detector . detect ( image ) ; Sw... | Detects the locations of the features in the image and extracts descriptions of each of the features . |
27,319 | protected void resizeForLayer ( int width , int height ) { deriv1X . reshape ( width , height ) ; deriv1Y . reshape ( width , height ) ; deriv2X . reshape ( width , height ) ; deriv2Y . reshape ( width , height ) ; deriv2XX . reshape ( width , height ) ; deriv2YY . reshape ( width , height ) ; deriv2XY . reshape ( widt... | Resize images for the current layer being processed |
27,320 | private void computePsiSmooth ( GrayF32 ux , GrayF32 uy , GrayF32 vx , GrayF32 vy , GrayF32 psiSmooth ) { int N = derivFlowUX . width * derivFlowUX . height ; for ( int i = 0 ; i < N ; i ++ ) { float vux = ux . data [ i ] ; float vuy = uy . data [ i ] ; float vvx = vx . data [ i ] ; float vvy = vy . data [ i ] ; float ... | Equation 5 . Psi_s |
27,321 | protected void computePsiDataPsiGradient ( GrayF32 image1 , GrayF32 image2 , GrayF32 deriv1x , GrayF32 deriv1y , GrayF32 deriv2x , GrayF32 deriv2y , GrayF32 deriv2xx , GrayF32 deriv2yy , GrayF32 deriv2xy , GrayF32 du , GrayF32 dv , GrayF32 psiData , GrayF32 psiGradient ) { int N = image1 . width * image1 . height ; for... | Compute Psi - data using equation 6 and approximation in equation 5 |
27,322 | private void computeDivUVD ( GrayF32 u , GrayF32 v , GrayF32 psi , GrayF32 divU , GrayF32 divV , GrayF32 divD ) { final int stride = psi . stride ; for ( int y = 1 ; y < psi . height - 1 ; y ++ ) { int index = y * stride + 1 ; for ( int x = 1 ; x < psi . width - 1 ; x ++ , index ++ ) { float psi_index = psi . data [ in... | Computes the divergence for u v and d . Equation 8 and Equation 10 . |
27,323 | public void reset ( ) { unused . addAll ( templateNegative ) ; unused . addAll ( templatePositive ) ; templateNegative . clear ( ) ; templatePositive . clear ( ) ; } | Discard previous results and puts it back into its initial state |
27,324 | public void addDescriptor ( boolean positive , ImageRectangle rect ) { addDescriptor ( positive , rect . x0 , rect . y0 , rect . x1 , rect . y1 ) ; } | Creates a new descriptor for the specified region |
27,325 | private void addDescriptor ( boolean positive , NccFeature f ) { if ( positive ) if ( distance ( f , templatePositive ) < 0.05 ) { return ; } if ( ! positive ) { if ( distance ( f , templateNegative ) < 0.05 ) { return ; } if ( distance ( f , templatePositive ) < 0.05 ) { return ; } } if ( positive ) templatePositive .... | Adds a descriptor to the positive or negative list . If it is very similar to an existing one it is not added . Look at code for details |
27,326 | public void computeNccDescriptor ( NccFeature f , float x0 , float y0 , float x1 , float y1 ) { double mean = 0 ; float widthStep = ( x1 - x0 ) / 15.0f ; float heightStep = ( y1 - y0 ) / 15.0f ; int index = 0 ; for ( int y = 0 ; y < 15 ; y ++ ) { float sampleY = y0 + y * heightStep ; for ( int x = 0 ; x < 15 ; x ++ ) {... | Computes the NCC descriptor by sample points at evenly spaced distances inside the rectangle |
27,327 | public NccFeature createDescriptor ( ) { NccFeature f ; if ( unused . isEmpty ( ) ) f = new NccFeature ( 15 * 15 ) ; else f = unused . pop ( ) ; return f ; } | Creates a new descriptor or recycles an old one |
27,328 | public double computeConfidence ( int x0 , int y0 , int x1 , int y1 ) { computeNccDescriptor ( observed , x0 , y0 , x1 , y1 ) ; if ( templateNegative . size ( ) > 0 && templatePositive . size ( ) > 0 ) { double distancePositive = distance ( observed , templatePositive ) ; double distanceNegative = distance ( observed ,... | Compute a value which indicates how confident the specified region is to be a member of the positive set . The confidence value is from 0 to 1 . 1 indicates 100% confidence . |
27,329 | public double computeConfidence ( ImageRectangle r ) { return computeConfidence ( r . x0 , r . y0 , r . x1 , r . y1 ) ; } | see the other function with the same name |
27,330 | public double distance ( NccFeature observed , List < NccFeature > candidates ) { double maximum = - Double . MAX_VALUE ; for ( NccFeature f : candidates ) { double score = DescriptorDistance . ncc ( observed , f ) ; if ( score > maximum ) maximum = score ; } return 1 - 0.5 * ( maximum + 1 ) ; } | Computes the best distance to observed from the candidate list . |
27,331 | public void process ( GrayF32 input ) { constructPyramid ( input ) ; corners . reset ( ) ; double scale = Math . pow ( 2.0 , pyramid . size ( ) - 1 ) ; for ( int level = pyramid . size ( ) - 1 ; level >= 0 ; level -- ) { detector . process ( pyramid . get ( level ) ) ; PyramidLevel featsLevel = featureLevels . get ( le... | Detects corner features inside the input gray scale image . |
27,332 | void markSeenAsFalse ( FastQueue < ChessboardCorner > corners0 , FastQueue < ChessboardCorner > corners1 ) { nn . setPoints ( corners1 . toList ( ) , false ) ; int radius = detector . shiRadius * 2 + 1 ; for ( int i = 0 ; i < corners0 . size ; i ++ ) { ChessboardCorner c0 = corners0 . get ( i ) ; nnSearch . findNearest... | Finds corners in list 1 which match corners in list 0 . If the feature in list 0 has already been seen then the feature in list 1 will be marked as seen . Otherwise the feature which is the most intense is marked as first . |
27,333 | public void processImage ( int sourceID , long frameID , final BufferedImage buffered , ImageBase input ) { System . out . flush ( ) ; synchronized ( bufferedImageLock ) { original = ConvertBufferedImage . checkCopy ( buffered , original ) ; work = ConvertBufferedImage . checkDeclare ( buffered , work ) ; } if ( saveRe... | Override this function so that it doesn t threshold the image twice |
27,334 | public boolean computeHomography ( CalibrationObservation observedPoints ) { if ( observedPoints . size ( ) < 4 ) throw new IllegalArgumentException ( "At least 4 points needed in each set of observations. " + " Filter these first please" ) ; List < AssociatedPair > pairs = new ArrayList < > ( ) ; for ( int i = 0 ; i <... | Computes the homography from a list of detected grid points in the image . The order of the grid points is important and must follow the expected row major starting at the top left . |
27,335 | public synchronized void recycle ( float [ ] array ) { if ( array . length != length ) { throw new IllegalArgumentException ( "Unexpected array length. Expected " + length + " found " + array . length ) ; } storage . add ( array ) ; } | Adds the array to storage . if the array length is unexpected an exception is thrown |
27,336 | private void visualizeResults ( SceneStructureMetric structure , List < BufferedImage > colorImages ) { List < Point3D_F64 > cloudXyz = new ArrayList < > ( ) ; GrowQueue_I32 cloudRgb = new GrowQueue_I32 ( ) ; Point3D_F64 world = new Point3D_F64 ( ) ; Point3D_F64 camera = new Point3D_F64 ( ) ; Point2D_F64 pixel = new Po... | Opens a window showing the found point cloud . Points are colorized using the pixel value inside one of the input images |
27,337 | public static void decodeFormatMessage ( int message , QrCode qr ) { int error = message >> 3 ; qr . error = QrCode . ErrorLevel . lookup ( error ) ; qr . mask = QrCodeMaskPattern . lookupMask ( message & 0x07 ) ; } | Assumes that the format message has no errors in it and decodes its data and saves it into the qr code |
27,338 | public static int correctDCH ( int N , int messageNoMask , int generator , int totalBits , int dataBits ) { int bestHamming = 255 ; int bestMessage = - 1 ; int errorBits = totalBits - dataBits ; for ( int i = 0 ; i < N ; i ++ ) { int test = i << errorBits ; test = test ^ bitPolyModulus ( test , generator , totalBits , ... | Applies a brute force algorithm to find the message which has the smallest hamming distance . if two messages have the same distance - 1 is returned . |
27,339 | private static void displayResults ( BufferedImage orig , Planar < GrayF32 > distortedImg , ImageDistort allInside , ImageDistort fullView ) { Planar < GrayF32 > undistortedImg = new Planar < > ( GrayF32 . class , distortedImg . getWidth ( ) , distortedImg . getHeight ( ) , distortedImg . getNumBands ( ) ) ; allInside ... | Displays results in a window for easy comparison .. |
27,340 | public boolean process ( double sampleRadius , Quadrilateral_F64 input ) { work . set ( input ) ; samples . reset ( ) ; estimator . process ( work , false ) ; estimator . getWorldToCamera ( ) . invert ( referenceCameraToWorld ) ; samples . reset ( ) ; createSamples ( sampleRadius , work . a , input . a ) ; createSample... | Processes the observation and generates a stability estimate |
27,341 | private void createSamples ( double sampleRadius , Point2D_F64 workPoint , Point2D_F64 originalPoint ) { workPoint . x = originalPoint . x + sampleRadius ; if ( estimator . process ( work , false ) ) { samples . grow ( ) . set ( estimator . getWorldToCamera ( ) ) ; } workPoint . x = originalPoint . x - sampleRadius ; i... | Samples around the provided corner + - in x and y directions |
27,342 | public void initialLearning ( Rectangle2D_F64 targetRegion , FastQueue < ImageRectangle > cascadeRegions ) { storageMetric . reset ( ) ; fernNegative . clear ( ) ; TldHelperFunctions . convertRegion ( targetRegion , targetRegion_I32 ) ; variance . selectThreshold ( targetRegion_I32 ) ; template . addDescriptor ( true ,... | Select positive and negative examples based on the region the user s initially selected region . The selected region is used as a positive example while all the other regions far away are used as negative examples . |
27,343 | public void updateLearning ( Rectangle2D_F64 targetRegion ) { storageMetric . reset ( ) ; TldHelperFunctions . convertRegion ( targetRegion , targetRegion_I32 ) ; template . addDescriptor ( true , targetRegion_I32 ) ; fern . learnFernNoise ( true , targetRegion_I32 ) ; FastQueue < TldRegionFernInfo > ferns = detection ... | Updates learning using the latest tracking results . |
27,344 | protected void learnAmbiguousNegative ( Rectangle2D_F64 targetRegion ) { TldHelperFunctions . convertRegion ( targetRegion , targetRegion_I32 ) ; if ( detection . isSuccess ( ) ) { TldRegion best = detection . getBest ( ) ; double overlap = helper . computeOverlap ( best . rect , targetRegion_I32 ) ; if ( overlap <= co... | Mark regions which were local maximums and had high confidence as negative . These regions were candidates for the tracker but were not selected |
27,345 | public static < T extends ImageGray < T > > InputToBinary < T > localOtsu ( ConfigLength regionWidth , double scale , boolean down , boolean otsu2 , double tuning , Class < T > inputType ) { if ( BOverrideFactoryThresholdBinary . localOtsu != null ) return BOverrideFactoryThresholdBinary . localOtsu . handle ( otsu2 , ... | Applies a local Otsu threshold |
27,346 | public static < T extends ImageGray < T > > InputToBinary < T > blockMean ( ConfigLength regionWidth , double scale , boolean down , boolean thresholdFromLocalBlocks , Class < T > inputType ) { if ( BOverrideFactoryThresholdBinary . blockMean != null ) return BOverrideFactoryThresholdBinary . blockMean . handle ( regio... | Applies a non - overlapping block mean threshold |
27,347 | public static < T extends ImageGray < T > > InputToBinary < T > blockOtsu ( ConfigLength regionWidth , double scale , boolean down , boolean thresholdFromLocalBlocks , boolean otsu2 , double tuning , Class < T > inputType ) { if ( BOverrideFactoryThresholdBinary . blockOtsu != null ) return BOverrideFactoryThresholdBin... | Applies a non - overlapping block Otsu threshold |
27,348 | public static < T extends ImageGray < T > > InputToBinary < T > threshold ( ConfigThreshold config , Class < T > inputType ) { switch ( config . type ) { case FIXED : return globalFixed ( config . fixedThreshold , config . down , inputType ) ; case GLOBAL_OTSU : return globalOtsu ( config . minPixelValue , config . max... | Creates threshold using a config class |
27,349 | public void constraintSouth ( JComponent target , JComponent top , JComponent bottom , int padV ) { if ( bottom == null ) { layout . putConstraint ( SpringLayout . SOUTH , target , - padV , SpringLayout . SOUTH , this ) ; } else { Spring a = Spring . sum ( Spring . constant ( - padV ) , layout . getConstraint ( SpringL... | Constrain it to the top of it s bottom panel and prevent it from getting crushed below it s size |
27,350 | public void setLensDistoriton ( LensDistortionNarrowFOV distortion ) { pixelToNorm = distortion . undistort_F64 ( true , false ) ; normToPixel = distortion . distort_F64 ( false , true ) ; } | Specifies the intrinsic parameters . |
27,351 | public void setFiducial ( double x0 , double y0 , double x1 , double y1 , double x2 , double y2 , double x3 , double y3 ) { points . get ( 0 ) . location . set ( x0 , y0 , 0 ) ; points . get ( 1 ) . location . set ( x1 , y1 , 0 ) ; points . get ( 2 ) . location . set ( x2 , y2 , 0 ) ; points . get ( 3 ) . location . se... | Specify the location of points on the 2D fiducial . These should be in world coordinates |
27,352 | public void pixelToMarker ( double pixelX , double pixelY , Point2D_F64 marker ) { pixelToNorm . compute ( pixelX , pixelY , marker ) ; cameraP3 . set ( marker . x , marker . y , 1 ) ; GeometryMath_F64 . multTran ( outputFiducialToCamera . R , cameraP3 , ray . slope ) ; GeometryMath_F64 . multTran ( outputFiducialToCam... | Given the found solution compute the the observed pixel would appear on the marker s surface . pixel - > normalized pixel - > rotated - > projected on to plane |
27,353 | protected boolean estimate ( Quadrilateral_F64 cornersPixels , Quadrilateral_F64 cornersNorm , Se3_F64 foundFiducialToCamera ) { listObs . clear ( ) ; listObs . add ( cornersPixels . a ) ; listObs . add ( cornersPixels . b ) ; listObs . add ( cornersPixels . c ) ; listObs . add ( cornersPixels . d ) ; points . get ( 0 ... | Given the observed corners of the quad in the image in pixels estimate and store the results of its pose |
27,354 | protected void estimateP3P ( int excluded ) { inputP3P . clear ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( i != excluded ) { inputP3P . add ( points . get ( i ) ) ; } } solutions . reset ( ) ; if ( ! p3p . process ( inputP3P , solutions ) ) { return ; } for ( int i = 0 ; i < solutions . size ; i ++ ) { double error =... | Estimates the pose using P3P from 3 out of 4 points . Then use all 4 to pick the best solution |
27,355 | protected void enlarge ( Quadrilateral_F64 corners , double scale ) { UtilPolygons2D_F64 . center ( corners , center ) ; extend ( center , corners . a , scale ) ; extend ( center , corners . b , scale ) ; extend ( center , corners . c , scale ) ; extend ( center , corners . d , scale ) ; } | Enlarges the quadrilateral to make it more sensitive to changes in orientation |
27,356 | protected double computeErrors ( Se3_F64 fiducialToCamera ) { if ( fiducialToCamera . T . z < 0 ) { return Double . MAX_VALUE ; } double maxError = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { maxError = Math . max ( maxError , computePixelError ( fiducialToCamera , points . get ( i ) . location , listObs . get ( i ) ) ) ; }... | Compute the sum of reprojection errors for all four points |
27,357 | public void encode ( DMatrixRMaj F , double [ ] param ) { selectColumns ( F ) ; double v [ ] = new double [ ] { F . get ( 0 , col0 ) , F . get ( 1 , col0 ) , F . get ( 2 , col0 ) , F . get ( 0 , col1 ) , F . get ( 1 , col1 ) , F . get ( 2 , col1 ) } ; double divisor = selectDivisor ( v , param ) ; SimpleMatrix A = new ... | Examines the matrix structure to determine how to parameterize F . |
27,358 | private double selectDivisor ( double v [ ] , double param [ ] ) { double maxValue = 0 ; int maxIndex = 0 ; for ( int i = 0 ; i < v . length ; i ++ ) { if ( Math . abs ( v [ i ] ) > maxValue ) { maxValue = Math . abs ( v [ i ] ) ; maxIndex = i ; } } double divisor = v [ maxIndex ] ; int index = 0 ; for ( int i = 0 ; i ... | The divisor is the element in the first two columns that has the largest absolute value . Finds this element sets col0 to be the row which contains it and specifies which elements in that column are to be used . |
27,359 | protected void createEdge ( String src , String dst , FastQueue < AssociatedPair > pairs , FastQueue < AssociatedIndex > matches ) { int countF = 0 ; if ( ransac3D . process ( pairs . toList ( ) ) ) { countF = ransac3D . getMatchSet ( ) . size ( ) ; } int countH = 0 ; if ( ransacH . process ( pairs . toList ( ) ) ) { c... | Connects two views together if they meet a minimal set of geometric requirements . Determines if there is strong evidence that there is 3D information present and not just a homography |
27,360 | private void saveInlierMatches ( ModelMatcher < ? , ? > ransac , FastQueue < AssociatedIndex > matches , PairwiseImageGraph2 . Motion edge ) { int N = ransac . getMatchSet ( ) . size ( ) ; edge . inliers . reset ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int idx = ransac . getInputIndex ( i ) ; edge . inliers . grow ( ) ... | Puts the inliers from RANSAC into the edge s list of associated features |
27,361 | protected void recycleData ( ) { for ( int i = 0 ; i < nodes . size ( ) ; i ++ ) { SquareNode n = nodes . get ( i ) ; for ( int j = 0 ; j < n . edges . length ; j ++ ) { if ( n . edges [ j ] != null ) { graph . detachEdge ( n . edges [ j ] ) ; } } } for ( int i = 0 ; i < nodes . size ( ) ; i ++ ) { SquareNode n = nodes... | Reset and recycle data structures from the previous run |
27,362 | protected void findClusters ( ) { for ( int i = 0 ; i < nodes . size ( ) ; i ++ ) { SquareNode n = nodes . get ( i ) ; if ( n . graph < 0 ) { n . graph = clusters . size ( ) ; List < SquareNode > graph = clusters . grow ( ) ; graph . add ( n ) ; addToCluster ( n , graph ) ; } } } | Put sets of nodes into the same list if they are some how connected |
27,363 | void addToCluster ( SquareNode seed , List < SquareNode > graph ) { open . clear ( ) ; open . add ( seed ) ; while ( ! open . isEmpty ( ) ) { SquareNode n = open . remove ( open . size ( ) - 1 ) ; for ( int i = 0 ; i < n . square . size ( ) ; i ++ ) { SquareEdge edge = n . edges [ i ] ; if ( edge == null ) continue ; S... | Finds all neighbors and adds them to the graph . Repeated until there are no more nodes to add to the graph |
27,364 | public static void printClickedColor ( final BufferedImage image ) { ImagePanel gui = new ImagePanel ( image ) ; gui . addMouseListener ( new MouseAdapter ( ) { public void mouseClicked ( MouseEvent e ) { float [ ] color = new float [ 3 ] ; int rgb = image . getRGB ( e . getX ( ) , e . getY ( ) ) ; ColorHsv . rgbToHsv ... | Shows a color image and allows the user to select a pixel convert it to HSV print the HSV values and calls the function below to display similar pixels . |
27,365 | public static void showSelectedColor ( String name , BufferedImage image , float hue , float saturation ) { Planar < GrayF32 > input = ConvertBufferedImage . convertFromPlanar ( image , null , true , GrayF32 . class ) ; Planar < GrayF32 > hsv = input . createSameShape ( ) ; ColorHsv . rgbToHsv ( input , hsv ) ; float m... | Selectively displays only pixels which have a similar hue and saturation values to what is provided . This is intended to be a simple example of color based segmentation . Color based segmentation can be done in RGB color but is more problematic due to it not being intensity invariant . More robust techniques can use G... |
27,366 | public static ImageDimension transformDimension ( ImageBase orig , int level ) { return transformDimension ( orig . width , orig . height , level ) ; } | Returns dimension which is required for the transformed image in a multilevel wavelet transform . |
27,367 | public static int borderForwardLower ( WlCoef desc ) { int ret = - Math . min ( desc . offsetScaling , desc . offsetWavelet ) ; return ret + ( ret % 2 ) ; } | Returns the lower border for a forward wavelet transform . |
27,368 | public static int borderInverseLower ( WlBorderCoef < ? > desc , BorderIndex1D border ) { WlCoef inner = desc . getInnerCoefficients ( ) ; int borderSize = borderForwardLower ( inner ) ; WlCoef ll = borderSize > 0 ? inner : null ; WlCoef lu = ll ; WlCoef uu = inner ; int indexLU = 0 ; if ( desc . getLowerLength ( ) > 0... | Returns the lower border for an inverse wavelet transform . |
27,369 | public static int round ( int top , int div2 , int divisor ) { if ( top > 0 ) return ( top + div2 ) / divisor ; else return ( top - div2 ) / divisor ; } | Specialized rounding for use with integer wavelet transform . |
27,370 | public static void adjustForDisplay ( ImageGray transform , int numLevels , double valueRange ) { if ( transform instanceof GrayF32 ) adjustForDisplay ( ( GrayF32 ) transform , numLevels , ( float ) valueRange ) ; else adjustForDisplay ( ( GrayI ) transform , numLevels , ( int ) valueRange ) ; } | Adjusts the values inside a wavelet transform to make it easier to view . |
27,371 | public static void equalizeLocalNaive ( GrayU8 input , int radius , GrayU8 output , IWorkArrays workArrays ) { int width = 2 * radius + 1 ; int maxValue = workArrays . length ( ) - 1 ; int idx0 = 0 , idx1 = input . height ; int [ ] histogram = workArrays . pop ( ) ; for ( int y = idx0 ; y < idx1 ; y ++ ) { int y0 = y -... | Inefficiently computes the local histogram but can handle every possible case for image size and local region size |
27,372 | public static void equalizeLocalInner ( GrayU8 input , int radius , GrayU8 output , IWorkArrays workArrays ) { int width = 2 * radius + 1 ; int area = width * width ; int maxValue = workArrays . length ( ) - 1 ; int y0 = radius , y1 = input . height - radius ; int [ ] histogram = workArrays . pop ( ) ; for ( int y = y0... | Performs local histogram equalization just on the inner portion of the image |
27,373 | public static void localHistogram ( GrayU16 input , int x0 , int y0 , int x1 , int y1 , int histogram [ ] ) { for ( int i = 0 ; i < histogram . length ; i ++ ) histogram [ i ] = 0 ; for ( int i = y0 ; i < y1 ; i ++ ) { int index = input . startIndex + i * input . stride + x0 ; int end = index + x1 - x0 ; for ( ; index ... | Computes the local histogram just for the specified inner region |
27,374 | public synchronized void setBufferedImage ( BufferedImage image ) { if ( checkEventDispatch && this . img != null ) { if ( ! SwingUtilities . isEventDispatchThread ( ) ) throw new RuntimeException ( "Changed image when not in GUI thread?" ) ; } this . img = image ; if ( image != null ) updateSize ( image . getWidth ( )... | Change the image being displayed . |
27,375 | public void initialize ( T image , RectangleLength2D_I32 initial ) { if ( ! image . isInBounds ( initial . x0 , initial . y0 ) ) throw new IllegalArgumentException ( "Initial rectangle is out of bounds!" ) ; if ( ! image . isInBounds ( initial . x0 + initial . width , initial . y0 + initial . height ) ) throw new Illeg... | Specifies the initial target location so that it can learn its description |
27,376 | public boolean process ( T image ) { if ( failed ) return false ; targetModel . setImage ( image ) ; dirty . set ( location . x0 , location . y0 , location . x0 + location . width , location . y0 + location . height ) ; updatePdfImage ( location . x0 , location . y0 , location . x0 + location . width , location . y0 + ... | Updates the target s location in the image by performing a mean - shift search . Returns if it was successful at finding the target or not . If it fails once it will need to be re - initialized |
27,377 | protected void updatePdfImage ( int x0 , int y0 , int x1 , int y1 ) { for ( int y = y0 ; y < y1 ; y ++ ) { int indexOut = pdf . startIndex + pdf . stride * y + x0 ; for ( int x = x0 ; x < x1 ; x ++ , indexOut ++ ) { if ( pdf . data [ indexOut ] < 0 ) pdf . data [ indexOut ] = targetModel . compute ( x , y ) ; } } if ( ... | Computes the PDF only inside the image as needed amd update the dirty rectangle |
27,378 | public void process ( T image ) { this . image = image ; this . stopRequested = false ; modeLocation . reset ( ) ; modeColor . reset ( ) ; modeMemberCount . reset ( ) ; interpolate . setImage ( image ) ; pixelToMode . reshape ( image . width , image . height ) ; quickMode . reshape ( image . width , image . height ) ; ... | Performs mean - shift clustering on the input image |
27,379 | public void set ( Point2D3D src ) { observation . set ( src . observation ) ; location . set ( src . location ) ; } | Sets this to be identical to src . |
27,380 | public void clearLensDistortion ( ) { detector . clearLensDistortion ( ) ; if ( refineGray != null ) refineGray . clearLensDistortion ( ) ; edgeIntensity . setTransform ( null ) ; } | Discard previously set lens distortion models |
27,381 | public void process ( T gray , GrayU8 binary ) { detector . process ( gray , binary ) ; if ( refineGray != null ) refineGray . setImage ( gray ) ; edgeIntensity . setImage ( gray ) ; long time0 = System . nanoTime ( ) ; FastQueue < DetectPolygonFromContour . Info > detections = detector . getFound ( ) ; if ( adjustForB... | Detects polygons inside the grayscale image and its thresholded version |
27,382 | public boolean refine ( DetectPolygonFromContour . Info info ) { double before , after ; if ( edgeIntensity . computeEdge ( info . polygon , ! detector . isOutputClockwise ( ) ) ) { before = edgeIntensity . getAverageOutside ( ) - edgeIntensity . getAverageInside ( ) ; } else { return false ; } boolean success = false ... | Refines the fit to the specified polygon . Only info . polygon is modified |
27,383 | public void refineAll ( ) { List < DetectPolygonFromContour . Info > detections = detector . getFound ( ) . toList ( ) ; for ( int i = 0 ; i < detections . size ( ) ; i ++ ) { refine ( detections . get ( i ) ) ; } } | Refines all the detected polygons and places them into the provided list . Polygons which fail the refinement step are not added . |
27,384 | public static < T extends ImageGray < T > > T checkReshape ( T target , ImageGray testImage , Class < T > targetType ) { if ( target == null ) { return GeneralizedImageOps . createSingleBand ( targetType , testImage . width , testImage . height ) ; } else if ( target . width != testImage . width || target . height != t... | Checks to see if the target image is null or if it is a different size than the test image . If it is null then a new image is returned otherwise target is reshaped and returned . |
27,385 | protected void findLocalScaleSpaceMax ( PyramidFloat < T > ss , int layerID ) { int index0 = spaceIndex ; int index1 = ( spaceIndex + 1 ) % 3 ; int index2 = ( spaceIndex + 2 ) % 3 ; List < Point2D_I16 > candidates = maximums [ index1 ] ; ImageBorder_F32 inten0 = ( ImageBorder_F32 ) FactoryImageBorderAlgs . value ( inte... | Searches the pyramid layers up and down to see if the found 2D features are also scale space maximums . |
27,386 | int getCornerIndex ( SquareNode node , double x , double y ) { for ( int i = 0 ; i < node . square . size ( ) ; i ++ ) { Point2D_F64 c = node . square . get ( i ) ; if ( c . x == x && c . y == y ) return i ; } throw new RuntimeException ( "BUG!" ) ; } | Returns the corner index of the specified coordinate |
27,387 | boolean candidateIsMuchCloser ( SquareNode node0 , SquareNode node1 , double distance2 ) { double length = Math . max ( node0 . largestSide , node1 . largestSide ) * tooFarFraction ; length *= length ; if ( distance2 > length ) return false ; return distance2 <= length ; } | Checks to see if the two corners which are to be connected are by far the two closest corners between the two squares |
27,388 | private void handleContextMenu ( JTree tree , int x , int y ) { TreePath path = tree . getPathForLocation ( x , y ) ; tree . setSelectionPath ( path ) ; DefaultMutableTreeNode node = ( DefaultMutableTreeNode ) tree . getLastSelectedPathComponent ( ) ; if ( node == null ) return ; if ( ! node . isLeaf ( ) ) { tree . set... | Displays a context menu for a class leaf node Allows copying of the name and the path to the source |
27,389 | private void openInGitHub ( AppInfo info ) { if ( Desktop . isDesktopSupported ( ) ) { try { URI uri = new URI ( UtilIO . getGithubURL ( info . app . getPackage ( ) . getName ( ) , info . app . getSimpleName ( ) ) ) ; if ( ! uri . getPath ( ) . isEmpty ( ) ) Desktop . getDesktop ( ) . browse ( uri ) ; else System . err... | Opens github page of source code up in a browser window |
27,390 | public void killAllProcesses ( long blockTimeMS ) { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { DefaultListModel model = ( DefaultListModel ) processList . getModel ( ) ; for ( int i = model . size ( ) - 1 ; i >= 0 ; i -- ) { ActiveProcess p = ( ActiveProcess ) model . get ( i ) ; removeProc... | Requests that all active processes be killed . |
27,391 | public void intervalAdded ( ListDataEvent e ) { DefaultListModel listModel = ( DefaultListModel ) e . getSource ( ) ; ActiveProcess process = ( ActiveProcess ) listModel . get ( listModel . getSize ( ) - 1 ) ; addProcessTab ( process , outputPanel ) ; } | Called after a new process is added to the process list |
27,392 | protected void setUpEdges ( GrayS32 input , GrayS32 output ) { if ( connectRule == ConnectRule . EIGHT ) { setUpEdges8 ( input , edgesIn ) ; setUpEdges8 ( output , edgesOut ) ; edges [ 0 ] . set ( 1 , 0 ) ; edges [ 1 ] . set ( 1 , 1 ) ; edges [ 2 ] . set ( 0 , 1 ) ; edges [ 3 ] . set ( - 1 , 0 ) ; } else { setUpEdges4 ... | Declares lookup tables for neighbors |
27,393 | public void process ( GrayS32 input , GrayS32 output , GrowQueue_I32 regionMemberCount ) { this . regionMemberCount = regionMemberCount ; regionMemberCount . reset ( ) ; setUpEdges ( input , output ) ; ImageMiscOps . fill ( output , - 1 ) ; mergeList . reset ( ) ; connectInner ( input , output ) ; connectLeftRight ( in... | Relabels the image such that all pixels with the same label are a member of the same graph . |
27,394 | protected void connectInner ( GrayS32 input , GrayS32 output ) { int startX = connectRule == ConnectRule . EIGHT ? 1 : 0 ; for ( int y = 0 ; y < input . height - 1 ; y ++ ) { int indexIn = input . startIndex + y * input . stride + startX ; int indexOut = output . startIndex + y * output . stride + startX ; for ( int x ... | Examines pixels inside the image without the need for bounds checking |
27,395 | protected void connectLeftRight ( GrayS32 input , GrayS32 output ) { for ( int y = 0 ; y < input . height ; y ++ ) { int x = input . width - 1 ; int inputLabel = input . unsafe_get ( x , y ) ; int outputLabel = output . unsafe_get ( x , y ) ; if ( outputLabel == - 1 ) { outputLabel = regionMemberCount . size ; output .... | Examines pixels along the left and right border |
27,396 | protected void connectBottom ( GrayS32 input , GrayS32 output ) { for ( int x = 0 ; x < input . width - 1 ; x ++ ) { int y = input . height - 1 ; int inputLabel = input . unsafe_get ( x , y ) ; int outputLabel = output . unsafe_get ( x , y ) ; if ( outputLabel == - 1 ) { outputLabel = regionMemberCount . size ; output ... | Examines pixels along the bottom border |
27,397 | public void setImage ( I image , D derivX , D derivY ) { InputSanityCheck . checkSameShape ( image , derivX , derivY ) ; this . image = image ; this . interpInput . setImage ( image ) ; this . derivX = derivX ; this . derivY = derivY ; } | Sets the current image it should be tracking with . |
27,398 | @ SuppressWarnings ( { "SuspiciousNameCombination" } ) public boolean setDescription ( KltFeature feature ) { setAllowedBounds ( feature ) ; if ( ! isFullyInside ( feature . x , feature . y ) ) { if ( isFullyOutside ( feature . x , feature . y ) ) return false ; else return internalSetDescriptionBorder ( feature ) ; } ... | Sets the features description using the current image and the location of the feature stored in the feature . If the feature is an illegal location and cannot be set then false is returned . |
27,399 | protected boolean internalSetDescriptionBorder ( KltFeature feature ) { computeSubImageBounds ( feature , feature . x , feature . y ) ; ImageMiscOps . fill ( feature . desc , Float . NaN ) ; feature . desc . subimage ( dstX0 , dstY0 , dstX1 , dstY1 , subimage ) ; interpInput . setImage ( image ) ; interpInput . region ... | Computes the descriptor for border features . All it needs to do is save the pixel value but derivative information is also computed so that it can reject bad features immediately . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.