idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
27,100 | public static int downSampleSize ( int length , int squareWidth ) { int ret = length / squareWidth ; if ( length % squareWidth != 0 ) ret ++ ; return ret ; } | Computes the length of a down sampled image based on the original length and the square width |
27,101 | public static void reshapeDown ( ImageBase image , int inputWidth , int inputHeight , int squareWidth ) { int w = downSampleSize ( inputWidth , squareWidth ) ; int h = downSampleSize ( inputHeight , squareWidth ) ; image . reshape ( w , h ) ; } | Reshapes an image so that it is the correct size to store the down sampled image |
27,102 | public static < T extends ImageGray < T > > void down ( Planar < T > input , int sampleWidth , Planar < T > output ) { for ( int band = 0 ; band < input . getNumBands ( ) ; band ++ ) { down ( input . getBand ( band ) , sampleWidth , output . getBand ( band ) ) ; } } | Down samples a planar image . Type checking is done at runtime . |
27,103 | public void setCamera1 ( double fx , double fy , double skew , double cx , double cy ) { PerspectiveOps . pinholeToMatrix ( fx , fy , skew , cx , cy , K1 ) ; } | Specifies known intrinsic parameters for view 1 |
27,104 | public void setCamera2 ( double fx , double fy , double skew , double cx , double cy ) { PerspectiveOps . pinholeToMatrix ( fx , fy , skew , cx , cy , K2 ) ; PerspectiveOps . invertPinhole ( K2 , K2_inv ) ; } | Specifies known intrinsic parameters for view 2 |
27,105 | public boolean estimatePlaneAtInfinity ( DMatrixRMaj P2 , Vector3D_F64 v ) { PerspectiveOps . projectionSplit ( P2 , Q2 , q2 ) ; CommonOps_DDF3 . mult ( K2_inv , q2 , t2 ) ; CommonOps_DDF3 . mult ( K2_inv , Q2 , tmpA ) ; CommonOps_DDF3 . mult ( tmpA , K1 , tmpB ) ; computeRotation ( t2 , RR ) ; CommonOps_DDF3 . mult ( ... | Computes the plane at infinity |
27,106 | public void process ( SimpleImageSequence < T > sequence ) { T frame = sequence . next ( ) ; gui . setPreferredSize ( new Dimension ( frame . getWidth ( ) , frame . getHeight ( ) ) ) ; ShowImages . showWindow ( gui , "KTL Tracker" , true ) ; while ( sequence . hasNext ( ) ) { frame = sequence . next ( ) ; tracker . pro... | Processes the sequence of images and displays the tracked features in a window |
27,107 | private void updateGUI ( SimpleImageSequence < T > sequence ) { BufferedImage orig = sequence . getGuiImage ( ) ; Graphics2D g2 = orig . createGraphics ( ) ; for ( PointTrack p : tracker . getActiveTracks ( null ) ) { int red = ( int ) ( 2.5 * ( p . featureId % 100 ) ) ; int green = ( int ) ( ( 255.0 / 150.0 ) * ( p . ... | Draw tracked features in blue or red if they were just spawned . |
27,108 | public void createSURF ( ) { ConfigFastHessian configDetector = new ConfigFastHessian ( ) ; configDetector . maxFeaturesPerScale = 250 ; configDetector . extractRadius = 3 ; configDetector . initialSampleSize = 2 ; tracker = FactoryPointTracker . dda_FH_SURF_Fast ( configDetector , null , null , imageType ) ; } | Creates a SURF feature tracker . |
27,109 | public void configure ( int width , int height , float vfov ) { declareVectors ( width , height ) ; float r = ( float ) Math . tan ( vfov / 2.0f ) ; for ( int pixelY = 0 ; pixelY < height ; pixelY ++ ) { float z = 2 * r * pixelY / ( height - 1 ) - r ; for ( int pixelX = 0 ; pixelX < width ; pixelX ++ ) { float theta = ... | Configures the rendered cylinder |
27,110 | public boolean process ( T image ) { configureContourDetector ( image ) ; binary . reshape ( image . width , image . height ) ; inputToBinary . process ( image , binary ) ; detectorSquare . process ( image , binary ) ; detectorSquare . refineAll ( ) ; detectorSquare . getPolygons ( found , null ) ; clusters = s2c . pro... | Process the image and detect the calibration target |
27,111 | void extractCalibrationPoints ( SquareGrid grid ) { calibrationPoints . clear ( ) ; for ( int row = 0 ; row < grid . rows ; row ++ ) { row0 . clear ( ) ; row1 . clear ( ) ; for ( int col = 0 ; col < grid . columns ; col ++ ) { Polygon2D_F64 square = grid . get ( row , col ) . square ; row0 . add ( square . get ( 0 ) ) ... | Extracts the calibration points from the corners of a fully ordered grid |
27,112 | public static < T extends ImageGray < T > > SparseScaleGradient < T , ? > createGradient ( boolean useHaar , Class < T > imageType ) { if ( useHaar ) return FactorySparseIntegralFilters . haar ( imageType ) ; else return FactorySparseIntegralFilters . gradient ( imageType ) ; } | Creates a class for computing the image gradient from an integral image in a sparse fashion . All these kernels assume that the kernel is entirely contained inside the image! |
27,113 | public static < T extends ImageGray < T > > boolean isInside ( T ii , double X , double Y , int radiusRegions , int kernelSize , double scale , double c , double s ) { int c_x = ( int ) Math . round ( X ) ; int c_y = ( int ) Math . round ( Y ) ; kernelSize = ( int ) Math . ceil ( kernelSize * scale ) ; int kernelRadius... | Checks to see if the region is contained inside the image . This includes convolution kernel . Take in account the orientation of the region . |
27,114 | public static double rotatedWidth ( double width , double c , double s ) { return Math . abs ( c ) * width + Math . abs ( s ) * width ; } | Computes the width of a square containment region that contains a rotated rectangle . |
27,115 | public void assignIDsToRigidPoints ( ) { if ( lookupRigid != null ) return ; lookupRigid = new int [ getTotalRigidPoints ( ) ] ; int pointID = 0 ; for ( int i = 0 ; i < rigids . length ; i ++ ) { Rigid r = rigids [ i ] ; r . indexFirst = pointID ; for ( int j = 0 ; j < r . points . length ; j ++ , pointID ++ ) { lookup... | Assigns an ID to all rigid points . This function does not need to be called by the user as it will be called by the residual function if needed |
27,116 | public void setCamera ( int which , boolean fixed , BundleAdjustmentCamera model ) { cameras [ which ] . known = fixed ; cameras [ which ] . model = model ; } | Specifies the camera model being used . |
27,117 | public void setRigid ( int which , boolean fixed , Se3_F64 worldToObject , int totalPoints ) { Rigid r = rigids [ which ] = new Rigid ( ) ; r . known = fixed ; r . objectToWorld . set ( worldToObject ) ; r . points = new Point [ totalPoints ] ; for ( int i = 0 ; i < totalPoints ; i ++ ) { r . points [ i ] = new Point (... | Declares the data structure for a rigid object . Location of points are set by accessing the object directly . Rigid objects are useful in known scenes with calibration targets . |
27,118 | public void connectViewToCamera ( int viewIndex , int cameraIndex ) { if ( views [ viewIndex ] . camera != - 1 ) throw new RuntimeException ( "View has already been assigned a camera" ) ; views [ viewIndex ] . camera = cameraIndex ; } | Specifies that the view uses the specified camera |
27,119 | public int getUnknownCameraCount ( ) { int total = 0 ; for ( int i = 0 ; i < cameras . length ; i ++ ) { if ( ! cameras [ i ] . known ) { total ++ ; } } return total ; } | Returns the number of cameras with parameters that are not fixed |
27,120 | public int getTotalRigidPoints ( ) { if ( rigids == null ) return 0 ; int total = 0 ; for ( int i = 0 ; i < rigids . length ; i ++ ) { total += rigids [ i ] . points . length ; } return total ; } | Returns total number of points associated with rigid objects . |
27,121 | public static < T extends KernelBase > T random ( Class < ? > type , int radius , int min , int max , Random rand ) { int width = radius * 2 + 1 ; return random ( type , width , radius , min , max , rand ) ; } | Creates a random kernel of the specified type where each element is drawn from an uniform distribution . |
27,122 | public void detect ( II integral ) { if ( intensity == null ) { intensity = new GrayF32 [ 3 ] ; for ( int i = 0 ; i < intensity . length ; i ++ ) { intensity [ i ] = new GrayF32 ( integral . width , integral . height ) ; } } foundPoints . reset ( ) ; int skip = initialSampleRate ; int sizeStep = scaleStepSize ; int oct... | Detect interest points inside of the image . |
27,123 | protected void detectOctave ( II integral , int skip , int ... featureSize ) { int w = integral . width / skip ; int h = integral . height / skip ; for ( int i = 0 ; i < intensity . length ; i ++ ) { intensity [ i ] . reshape ( w , h ) ; } for ( int i = 0 ; i < featureSize . length ; i ++ ) { GIntegralImageFeatureInten... | Computes feature intensities for all the specified feature sizes and finds features inside of the middle feature sizes . |
27,124 | protected static boolean checkMax ( ImageBorder_F32 inten , float bestScore , int c_x , int c_y ) { for ( int y = c_y - 1 ; y <= c_y + 1 ; y ++ ) { for ( int x = c_x - 1 ; x <= c_x + 1 ; x ++ ) { if ( inten . get ( x , y ) >= bestScore ) { return false ; } } } return true ; } | Sees if the best score in the current layer is greater than all the scores in a 3x3 neighborhood in another layer . |
27,125 | public void process ( T gray , GrayU8 binary ) { configureContourDetector ( gray ) ; recycleData ( ) ; positionPatterns . reset ( ) ; interpolate . setImage ( gray ) ; squareDetector . process ( gray , binary ) ; long time0 = System . nanoTime ( ) ; squaresToPositionList ( ) ; long time1 = System . nanoTime ( ) ; creat... | Detects position patterns inside the image and forms a graph . |
27,126 | private void createPositionPatternGraph ( ) { nn . setPoints ( ( List ) positionPatterns . toList ( ) , false ) ; for ( int i = 0 ; i < positionPatterns . size ( ) ; i ++ ) { PositionPatternNode f = positionPatterns . get ( i ) ; double maximumQrCodeWidth = f . largestSide * ( 17 + 4 * maxVersionQR - 7.0 ) / 7.0 ; doub... | Connects together position patterns . For each square finds all of its neighbors based on center distance . Then considers them for connections |
27,127 | void considerConnect ( SquareNode node0 , SquareNode node1 ) { lineA . a = node0 . center ; lineA . b = node1 . center ; int intersection0 = graph . findSideIntersect ( node0 , lineA , intersection , lineB ) ; connectLine . a . set ( intersection ) ; int intersection1 = graph . findSideIntersect ( node1 , lineA , inter... | Connects the candidate node to node n if they meet several criteria . See code for details . |
27,128 | boolean checkPositionPatternAppearance ( Polygon2D_F64 square , float grayThreshold ) { return ( checkLine ( square , grayThreshold , 0 ) || checkLine ( square , grayThreshold , 1 ) ) ; } | Determines if the found polygon looks like a position pattern . A horizontal and vertical line are sampled . At each sample point it is marked if it is above or below the binary threshold for this square . Location of sample points is found by removing perspective distortion . |
27,129 | static boolean positionSquareIntensityCheck ( float values [ ] , float threshold ) { if ( values [ 0 ] > threshold || values [ 1 ] < threshold ) return false ; if ( values [ 2 ] > threshold || values [ 3 ] > threshold || values [ 4 ] > threshold ) return false ; if ( values [ 5 ] < threshold || values [ 6 ] > threshold... | Checks to see if the array of sampled intensity values follows the expected pattern for a position pattern . X . XXX . X where x = black and . = white . |
27,130 | public void process ( DMatrixRMaj K1 , Se3_F64 worldToCamera1 , DMatrixRMaj K2 , Se3_F64 worldToCamera2 ) { SimpleMatrix sK1 = SimpleMatrix . wrap ( K1 ) ; SimpleMatrix sK2 = SimpleMatrix . wrap ( K2 ) ; SimpleMatrix R1 = SimpleMatrix . wrap ( worldToCamera1 . getR ( ) ) ; SimpleMatrix R2 = SimpleMatrix . wrap ( worldT... | Computes rectification transforms for both cameras and optionally a single calibration matrix . |
27,131 | private void selectAxises ( SimpleMatrix R1 , SimpleMatrix R2 , SimpleMatrix c1 , SimpleMatrix c2 ) { v1 . set ( c2 . get ( 0 ) - c1 . get ( 0 ) , c2 . get ( 1 ) - c1 . get ( 1 ) , c2 . get ( 2 ) - c1 . get ( 2 ) ) ; v1 . normalize ( ) ; Vector3D_F64 oldZ = new Vector3D_F64 ( R1 . get ( 2 , 0 ) + R2 . get ( 2 , 0 ) , R... | Selects axises of new coordinate system |
27,132 | public boolean process ( PairLineNorm line0 , PairLineNorm line1 ) { double a0 = GeometryMath_F64 . dot ( e2 , line0 . l2 ) ; double a1 = GeometryMath_F64 . dot ( e2 , line1 . l2 ) ; GeometryMath_F64 . multTran ( A , line0 . l2 , Al0 ) ; GeometryMath_F64 . multTran ( A , line1 . l2 , Al1 ) ; planeA . set ( line0 . l1 .... | Computes the homography based on two unique lines on the plane |
27,133 | protected int extractNumeral ( ) { int val = 0 ; final int topLeft = getTotalGridElements ( ) - gridWidth ; int shift = 0 ; for ( int i = 1 ; i < gridWidth - 1 ; i ++ ) { final int idx = topLeft + i ; val |= classified [ idx ] << shift ; shift ++ ; } for ( int ii = 1 ; ii < gridWidth - 1 ; ii ++ ) { for ( int i = 0 ; i... | Extract the numerical value it encodes |
27,134 | private boolean rotateUntilInLowerCorner ( Result result ) { final int topLeft = getTotalGridElements ( ) - gridWidth ; final int topRight = getTotalGridElements ( ) - 1 ; final int bottomLeft = 0 ; final int bottomRight = gridWidth - 1 ; if ( classified [ bottomLeft ] + classified [ bottomRight ] + classified [ topRig... | Rotate the pattern until the black corner is in the lower right . Sanity check to make sure there is only one black corner |
27,135 | protected boolean thresholdBinaryNumber ( ) { int lower = ( int ) ( N * ( ambiguityThreshold / 2.0 ) ) ; int upper = ( int ) ( N * ( 1 - ambiguityThreshold / 2.0 ) ) ; final int totalElements = getTotalGridElements ( ) ; for ( int i = 0 ; i < totalElements ; i ++ ) { if ( counts [ i ] < lower ) { classified [ i ] = 0 ;... | Sees how many pixels were positive and negative in each square region . Then decides if they should be 0 or 1 or unknown |
27,136 | protected void findBitCounts ( GrayF32 gray , double threshold ) { ThresholdImageOps . threshold ( gray , binaryInner , ( float ) threshold , true ) ; Arrays . fill ( counts , 0 ) ; for ( int row = 0 ; row < gridWidth ; row ++ ) { int y0 = row * binaryInner . width / gridWidth + 2 ; int y1 = ( row + 1 ) * binaryInner .... | Converts the gray scale image into a binary number . Skip the outer 1 pixel of each inner square . These tend to be incorrectly classified due to distortion . |
27,137 | public void printClassified ( ) { System . out . println ( ) ; System . out . println ( " " ) ; for ( int row = 0 ; row < gridWidth ; row ++ ) { System . out . print ( " " ) ; for ( int col = 0 ; col < gridWidth ; col ++ ) { System . out . print ( classified [ row * gridWidth + col ] == 1 ? " " : "X" ) ; } System ... | This is only works well as a visual representation if the output font is mono spaced . |
27,138 | private void initializeStructure ( List < AssociatedTriple > listObs , DMatrixRMaj P2 , DMatrixRMaj P3 ) { List < DMatrixRMaj > cameraMatrices = new ArrayList < > ( ) ; cameraMatrices . add ( P1 ) ; cameraMatrices . add ( P2 ) ; cameraMatrices . add ( P3 ) ; List < Point2D_F64 > triangObs = new ArrayList < > ( ) ; tria... | Sets up data structures for SBA |
27,139 | private boolean backwardsValidation ( int indexSrc , int bestIndex ) { double bestScoreV = maxError ; int bestIndexV = - 1 ; D d_forward = descDst . get ( bestIndex ) ; setActiveSource ( locationDst . get ( bestIndex ) ) ; for ( int j = 0 ; j < locationSrc . size ( ) ; j ++ ) { double distance = computeDistanceToSource... | Finds the best match for an index in destination and sees if it matches the source index |
27,140 | public static void multiply ( GrayU8 input , double value , GrayU8 output ) { output . reshape ( input . width , input . height ) ; int columns = input . width ; if ( BoofConcurrency . USE_CONCURRENT ) { ImplPixelMath_MT . multiplyU_A ( input . data , input . startIndex , input . stride , value , output . data , output... | Multiply each element by a scalar value . Both input and output images can be the same instance . |
27,141 | public static void divide ( GrayU8 input , double denominator , GrayU8 output ) { output . reshape ( input . width , input . height ) ; int columns = input . width ; if ( BoofConcurrency . USE_CONCURRENT ) { ImplPixelMath_MT . divideU_A ( input . data , input . startIndex , input . stride , denominator , output . data ... | Divide each element by a scalar value . Both input and output images can be the same instance . |
27,142 | public boolean performTracking ( PyramidKltFeature feature ) { KltTrackFault result = tracker . track ( feature ) ; if ( result != KltTrackFault . SUCCESS ) { return false ; } else { tracker . setDescription ( feature ) ; return true ; } } | Updates the track using the latest inputs . If tracking fails then the feature description in each layer is unchanged and its global position . |
27,143 | public static void showDialog ( BufferedImage img ) { ImageIcon icon = new ImageIcon ( ) ; icon . setImage ( img ) ; JOptionPane . showMessageDialog ( null , icon ) ; } | Creates a dialog window showing the specified image . The function will not exit until the user clicks ok |
27,144 | public static ImageGridPanel showGrid ( int numColumns , String title , BufferedImage ... images ) { JFrame frame = new JFrame ( title ) ; int numRows = images . length / numColumns + images . length % numColumns ; ImageGridPanel panel = new ImageGridPanel ( numRows , numColumns , images ) ; frame . add ( panel , Borde... | Shows a set of images in a grid pattern . |
27,145 | public static JFrame setupWindow ( final JComponent component , String title , final boolean closeOnExit ) { BoofSwingUtil . checkGuiThread ( ) ; final JFrame frame = new JFrame ( title ) ; frame . add ( component , BorderLayout . CENTER ) ; frame . pack ( ) ; frame . setLocationRelativeTo ( null ) ; if ( closeOnExit )... | Sets up the window but doesn t show it . Must be called in a GUI thread |
27,146 | public static void applyBoxFilter ( GrayF32 input ) { GrayF32 boxImage = new GrayF32 ( input . width , input . height ) ; InterleavedF32 boxTransform = new InterleavedF32 ( input . width , input . height , 2 ) ; InterleavedF32 transform = new InterleavedF32 ( input . width , input . height , 2 ) ; GrayF32 blurredImage ... | Demonstration of how to apply a box filter in the frequency domain and compares the results to a box filter which has been applied in the spatial domain |
27,147 | public static void displayTransform ( InterleavedF32 transform , String name ) { GrayF32 magnitude = new GrayF32 ( transform . width , transform . height ) ; GrayF32 phase = new GrayF32 ( transform . width , transform . height ) ; transform = transform . clone ( ) ; DiscreteFourierTransformOps . shiftZeroFrequency ( tr... | Display the fourier transform s magnitude and phase . |
27,148 | public static DMatrixRMaj robustFundamental ( List < AssociatedPair > matches , List < AssociatedPair > inliers , double inlierThreshold ) { ConfigRansac configRansac = new ConfigRansac ( ) ; configRansac . inlierThreshold = inlierThreshold ; configRansac . maxIterations = 1000 ; ConfigFundamental configFundamental = n... | Given a set of noisy observations compute the Fundamental matrix while removing the noise . |
27,149 | public static DMatrixRMaj simpleFundamental ( List < AssociatedPair > matches ) { Estimate1ofEpipolar estimateF = FactoryMultiView . fundamental_1 ( EnumFundamental . LINEAR_8 , 0 ) ; DMatrixRMaj F = new DMatrixRMaj ( 3 , 3 ) ; if ( ! estimateF . process ( matches , F ) ) throw new IllegalArgumentException ( "Failed" )... | If the set of associated features are known to be correct then the fundamental matrix can be computed directly with a lot less code . The down side is that this technique is very sensitive to noise . |
27,150 | public boolean applyErrorCorrection ( QrCode qr ) { QrCode . VersionInfo info = QrCode . VERSION_INFO [ qr . version ] ; QrCode . BlockInfo block = info . levels . get ( qr . error ) ; int wordsBlockAllA = block . codewords ; int wordsBlockDataA = block . dataCodewords ; int wordsEcc = wordsBlockAllA - wordsBlockDataA ... | Reconstruct the data while applying error correction . |
27,151 | private QrCode . Mode updateModeLogic ( QrCode . Mode current , QrCode . Mode candidate ) { if ( current == candidate ) return current ; else if ( current == QrCode . Mode . UNKNOWN ) { return candidate ; } else { return QrCode . Mode . MIXED ; } } | If only one mode then that mode is used . If more than one mode is used then set to multiple |
27,152 | boolean checkPaddingBytes ( QrCode qr , int lengthBytes ) { boolean a = true ; for ( int i = lengthBytes ; i < qr . corrected . length ; i ++ ) { if ( a ) { if ( 0b00110111 != ( qr . corrected [ i ] & 0xFF ) ) return false ; } else { if ( 0b10001000 != ( qr . corrected [ i ] & 0xFF ) ) { if ( 0b00110111 == ( qr . corre... | Makes sure the used bytes have the expected values |
27,153 | private int decodeNumeric ( QrCode qr , PackedBits8 data , int bitLocation ) { int lengthBits = QrCodeEncoder . getLengthBitsNumeric ( qr . version ) ; int length = data . read ( bitLocation , lengthBits , true ) ; bitLocation += lengthBits ; while ( length >= 3 ) { if ( data . size < bitLocation + 10 ) { qr . failureC... | Decodes a numeric message |
27,154 | private int decodeAlphanumeric ( QrCode qr , PackedBits8 data , int bitLocation ) { int lengthBits = QrCodeEncoder . getLengthBitsAlphanumeric ( qr . version ) ; int length = data . read ( bitLocation , lengthBits , true ) ; bitLocation += lengthBits ; while ( length >= 2 ) { if ( data . size < bitLocation + 11 ) { qr ... | Decodes alphanumeric messages |
27,155 | private int decodeByte ( QrCode qr , PackedBits8 data , int bitLocation ) { int lengthBits = QrCodeEncoder . getLengthBitsBytes ( qr . version ) ; int length = data . read ( bitLocation , lengthBits , true ) ; bitLocation += lengthBits ; if ( length * 8 > data . size - bitLocation ) { qr . failureCause = QrCode . Failu... | Decodes byte messages |
27,156 | private int decodeKanji ( QrCode qr , PackedBits8 data , int bitLocation ) { int lengthBits = QrCodeEncoder . getLengthBitsKanji ( qr . version ) ; int length = data . read ( bitLocation , lengthBits , true ) ; bitLocation += lengthBits ; byte rawdata [ ] = new byte [ length * 2 ] ; for ( int i = 0 ; i < length ; i ++ ... | Decodes Kanji messages |
27,157 | NodeInfo selectSeedCorner ( ) { NodeInfo best = null ; double bestScore = 0 ; double minAngle = Math . PI + 0.1 ; for ( int i = 0 ; i < contour . size ; i ++ ) { NodeInfo info = contour . get ( i ) ; if ( info . angleBetween < minAngle ) continue ; Edge middleR = selectClosest ( info . right , info , true ) ; if ( midd... | Pick a corner but avoid the pointy edges at the other end |
27,158 | static void bottomTwoColumns ( NodeInfo first , NodeInfo second , List < NodeInfo > column0 , List < NodeInfo > column1 ) { column0 . add ( first ) ; column0 . add ( second ) ; NodeInfo a = selectClosestN ( first , second ) ; if ( a == null ) { return ; } a . marked = true ; column1 . add ( a ) ; NodeInfo b = second ; ... | Traverses along the first two columns and sets them up |
27,159 | static Edge selectClosest ( NodeInfo a , NodeInfo b , boolean checkSide ) { double bestScore = Double . MAX_VALUE ; Edge bestEdgeA = null ; Edge edgeAB = a . findEdge ( b ) ; double distAB = a . distance ( b ) ; if ( edgeAB == null ) { return null ; } for ( int i = 0 ; i < a . edges . size ; i ++ ) { Edge edgeA = a . e... | Finds the closest that is the same distance from the two nodes and part of an approximate equilateral triangle |
27,160 | static NodeInfo selectClosestSide ( NodeInfo a , NodeInfo b ) { double ratio = 1.7321 ; NodeInfo best = null ; double bestDistance = Double . MAX_VALUE ; Edge bestEdgeA = null ; Edge bestEdgeB = null ; for ( int i = 0 ; i < a . edges . size ; i ++ ) { NodeInfo aa = a . edges . get ( i ) . target ; if ( aa . marked ) co... | Selects the closest node with the assumption that it s along the side of the grid . |
27,161 | public static void rgbToYuv ( double r , double g , double b , double yuv [ ] ) { double y = yuv [ 0 ] = 0.299 * r + 0.587 * g + 0.114 * b ; yuv [ 1 ] = 0.492 * ( b - y ) ; yuv [ 2 ] = 0.877 * ( r - y ) ; } | Conversion from RGB to YUV using same equations as Intel IPP . |
27,162 | public static void yuvToRgb ( double y , double u , double v , double rgb [ ] ) { rgb [ 0 ] = y + 1.13983 * v ; rgb [ 1 ] = y - 0.39465 * u - 0.58060 * v ; rgb [ 2 ] = y + 2.032 * u ; } | Conversion from YUV to RGB using same equations as Intel IPP . |
27,163 | public boolean process ( List < AssociatedTriple > observations , TrifocalTensor solution ) { if ( observations . size ( ) < 7 ) throw new IllegalArgumentException ( "At least 7 correspondences must be provided. Found " + observations . size ( ) ) ; LowLevelMultiViewOps . computeNormalization ( observations , N1 , N2 ,... | Estimates the trifocal tensor given the set of observations |
27,164 | protected void createLinearSystem ( List < AssociatedTriple > observations ) { int N = observations . size ( ) ; A . reshape ( 4 * N , 27 ) ; A . zero ( ) ; for ( int i = 0 ; i < N ; i ++ ) { AssociatedTriple t = observations . get ( i ) ; N1 . apply ( t . p1 , p1_norm ) ; N2 . apply ( t . p2 , p2_norm ) ; N3 . apply (... | Constructs the linear matrix that describes from the 3 - point constraint with linear dependent rows removed |
27,165 | protected boolean solveLinearSystem ( ) { if ( ! svdNull . decompose ( A ) ) return false ; SingularOps_DDRM . nullVector ( svdNull , true , vectorizedSolution ) ; solutionN . convertFrom ( vectorizedSolution ) ; return true ; } | Computes the null space of the linear system to find the trifocal tensor |
27,166 | protected void removeNormalization ( TrifocalTensor solution ) { DMatrixRMaj N2_inv = N2 . matrixInv ( ) ; DMatrixRMaj N3_inv = N3 . matrixInv ( ) ; DMatrixRMaj N1 = this . N1 . matrix ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { DMatrixRMaj T = solution . getT ( i ) ; for ( int j = 0 ; j < 3 ; j ++ ) { for ( int k = 0 ; k... | Translates the trifocal tensor back into regular coordinate system |
27,167 | public double computeAverageDerivative ( Point2D_F64 a , Point2D_F64 b , double tanX , double tanY ) { samplesInside = 0 ; averageUp = averageDown = 0 ; for ( int i = 0 ; i < numSamples ; i ++ ) { double x = ( b . x - a . x ) * i / ( numSamples - 1 ) + a . x ; double y = ( b . y - a . y ) * i / ( numSamples - 1 ) + a .... | Returns average tangential derivative along the line segment . Derivative is computed in direction of tangent . A positive step in the tangent direction will have a positive value . If all samples go outside the image then zero is returned . |
27,168 | public static void rgbToXyz ( int r , int g , int b , double xyz [ ] ) { srgbToXyz ( r / 255.0 , g / 255.0 , b / 255.0 , xyz ) ; } | Conversion from 8 - bit RGB into XYZ . 8 - bit = range of 0 to 255 . |
27,169 | public void configureCamera ( CameraPinholeBrown intrinsic , Se3_F64 planeToCamera ) { this . planeToCamera = planeToCamera ; if ( ! selectOverhead . process ( intrinsic , planeToCamera ) ) throw new IllegalArgumentException ( "Can't find a reasonable overhead map. Can the camera view the plane?" ) ; overhead . center... | Camera the camera s intrinsic and extrinsic parameters . Can be called at any time . |
27,170 | public Se3_F64 getWorldToCurr3D ( ) { worldToCurr3D . getT ( ) . set ( - worldToCurr2D . T . y , 0 , worldToCurr2D . T . x ) ; DMatrixRMaj R = worldToCurr3D . getR ( ) ; R . unsafe_set ( 0 , 0 , worldToCurr2D . c ) ; R . unsafe_set ( 0 , 2 , - worldToCurr2D . s ) ; R . unsafe_set ( 1 , 1 , 1 ) ; R . unsafe_set ( 2 , 0 ... | 3D motion . |
27,171 | public void process ( T gray , GrayU8 binary ) { results . reset ( ) ; ellipseDetector . process ( binary ) ; if ( ellipseRefiner != null ) ellipseRefiner . setImage ( gray ) ; intensityCheck . setImage ( gray ) ; List < BinaryEllipseDetectorPixel . Found > found = ellipseDetector . getFound ( ) ; for ( BinaryEllipseDe... | Detects ellipses inside the binary image and refines the edges for all detections inside the gray image |
27,172 | public boolean refine ( EllipseRotated_F64 ellipse ) { if ( autoRefine ) throw new IllegalArgumentException ( "Autorefine is true, no need to refine again" ) ; if ( ellipseRefiner == null ) throw new IllegalArgumentException ( "Refiner has not been passed in" ) ; if ( ! ellipseRefiner . process ( ellipse , ellipse ) ) ... | If auto refine is turned off an ellipse can be refined after the fact using this function provided that the refinement algorithm was passed in to the constructor |
27,173 | public static void colorizeSign ( GrayF32 input , float maxAbsValue , Bitmap output , byte [ ] storage ) { shapeShape ( input , output ) ; if ( storage == null ) storage = declareStorage ( output , null ) ; if ( maxAbsValue < 0 ) maxAbsValue = ImageStatistics . maxAbs ( input ) ; int indexDst = 0 ; for ( int y = 0 ; y ... | Renders positive and negative values as two different colors . |
27,174 | public static void grayMagnitude ( GrayS32 input , int maxAbsValue , Bitmap output , byte [ ] storage ) { shapeShape ( input , output ) ; if ( storage == null ) storage = declareStorage ( output , null ) ; if ( maxAbsValue < 0 ) maxAbsValue = ImageStatistics . maxAbs ( input ) ; int indexDst = 0 ; for ( int y = 0 ; y <... | Renders the image using its gray magnitude |
27,175 | public static void disparity ( GrayI disparity , int minValue , int maxValue , int invalidColor , Bitmap output , byte [ ] storage ) { shapeShape ( disparity , output ) ; if ( storage == null ) storage = declareStorage ( output , null ) ; int range = maxValue - minValue ; int indexDst = 0 ; for ( int y = 0 ; y < dispar... | Colorizes a disparity image . |
27,176 | public static void drawEdgeContours ( List < EdgeContour > contours , int color , Bitmap output , byte [ ] storage ) { if ( output . getConfig ( ) != Bitmap . Config . ARGB_8888 ) throw new IllegalArgumentException ( "Only ARGB_8888 is supported" ) ; if ( storage == null ) storage = declareStorage ( output , null ) ; e... | Draws each contour using a single color . |
27,177 | public void massage ( T input , T output ) { if ( clip ) { T inputAdjusted = clipInput ( input , output ) ; transform . a11 = input . width / ( float ) output . width ; transform . a22 = input . height / ( float ) output . height ; distort . apply ( inputAdjusted , output ) ; } else { transform . a11 = input . width / ... | Clipps and scales the input iamge as neccisary |
27,178 | T clipInput ( T input , T output ) { double ratioInput = input . width / ( double ) input . height ; double ratioOutput = output . width / ( double ) output . height ; T a = input ; if ( ratioInput > ratioOutput ) { int width = input . height * output . width / output . height ; int x0 = ( input . width - width ) / 2 ;... | Clip the input image to ensure a constant aspect ratio |
27,179 | public static int nextPow2 ( int x ) { if ( x < 1 ) throw new IllegalArgumentException ( "x must be greater or equal 1" ) ; if ( ( x & ( x - 1 ) ) == 0 ) { if ( x == 1 ) return 2 ; return x ; } x |= ( x >>> 1 ) ; x |= ( x >>> 2 ) ; x |= ( x >>> 4 ) ; x |= ( x >>> 8 ) ; x |= ( x >>> 16 ) ; x |= ( x >>> 32 ) ; return x +... | Returns the closest power - of - two number greater than or equal to x . |
27,180 | public static void checkImageArguments ( ImageBase image , ImageInterleaved transform ) { InputSanityCheck . checkSameShape ( image , transform ) ; if ( 2 != transform . getNumBands ( ) ) throw new IllegalArgumentException ( "The transform must have two bands" ) ; } | Checks to see if the image and its transform are appropriate sizes . The transform should have twice the width and twice the height as the image . |
27,181 | public static Se3_F64 estimateCameraMotion ( CameraPinholeBrown intrinsic , List < AssociatedPair > matchedNorm , List < AssociatedPair > inliers ) { ModelMatcherMultiview < Se3_F64 , AssociatedPair > epipolarMotion = FactoryMultiViewRobust . baselineRansac ( new ConfigEssential ( ) , new ConfigRansac ( 200 , 0.5 ) ) ;... | Estimates the camera motion robustly using RANSAC and a set of associated points . |
27,182 | public static List < AssociatedPair > convertToNormalizedCoordinates ( List < AssociatedPair > matchedFeatures , CameraPinholeBrown intrinsic ) { Point2Transform2_F64 p_to_n = LensDistortionFactory . narrow ( intrinsic ) . undistort_F64 ( true , false ) ; List < AssociatedPair > calibratedFeatures = new ArrayList < > (... | Convert a set of associated point features from pixel coordinates into normalized image coordinates . |
27,183 | public static < T extends ImageBase < T > > void rectifyImages ( T distortedLeft , T distortedRight , Se3_F64 leftToRight , CameraPinholeBrown intrinsicLeft , CameraPinholeBrown intrinsicRight , T rectifiedLeft , T rectifiedRight , GrayU8 rectifiedMask , DMatrixRMaj rectifiedK , DMatrixRMaj rectifiedR ) { RectifyCalibr... | Remove lens distortion and rectify stereo images |
27,184 | public static void drawInliers ( BufferedImage left , BufferedImage right , CameraPinholeBrown intrinsic , List < AssociatedPair > normalized ) { Point2Transform2_F64 n_to_p = LensDistortionFactory . narrow ( intrinsic ) . distort_F64 ( false , true ) ; List < AssociatedPair > pixels = new ArrayList < > ( ) ; for ( Ass... | Draw inliers for debugging purposes . Need to convert from normalized to pixel coordinates . |
27,185 | public static double euclideanSq ( TupleDesc_F64 a , TupleDesc_F64 b ) { final int N = a . value . length ; double total = 0 ; for ( int i = 0 ; i < N ; i ++ ) { double d = a . value [ i ] - b . value [ i ] ; total += d * d ; } return total ; } | Returns the Euclidean distance squared between the two descriptors . |
27,186 | private float iterationSorSafe ( GrayF32 image1 , int x , int y , int pixelIndex ) { float w = SOR_RELAXATION ; float uf ; float vf ; float ui = initFlowX . data [ pixelIndex ] ; float vi = initFlowY . data [ pixelIndex ] ; float u = flowX . data [ pixelIndex ] ; float v = flowY . data [ pixelIndex ] ; float I1 = image... | SOR iteration for border pixels |
27,187 | protected static float A_safe ( int x , int y , GrayF32 flow ) { float u0 = safe ( x - 1 , y , flow ) ; float u1 = safe ( x + 1 , y , flow ) ; float u2 = safe ( x , y - 1 , flow ) ; float u3 = safe ( x , y + 1 , flow ) ; float u4 = safe ( x - 1 , y - 1 , flow ) ; float u5 = safe ( x + 1 , y - 1 , flow ) ; float u6 = sa... | See equation 25 . Safe version |
27,188 | protected static float A ( int x , int y , GrayF32 flow ) { int index = flow . getIndex ( x , y ) ; float u0 = flow . data [ index - 1 ] ; float u1 = flow . data [ index + 1 ] ; float u2 = flow . data [ index - flow . stride ] ; float u3 = flow . data [ index + flow . stride ] ; float u4 = flow . data [ index - 1 - flo... | See equation 25 . Fast unsafe version |
27,189 | protected static float safe ( int x , int y , GrayF32 image ) { if ( x < 0 ) x = 0 ; else if ( x >= image . width ) x = image . width - 1 ; if ( y < 0 ) y = 0 ; else if ( y >= image . height ) y = image . height - 1 ; return image . unsafe_get ( x , y ) ; } | Ensures pixel values are inside the image . If output it is assigned to the nearest pixel inside the image |
27,190 | public void search ( float cx , float cy ) { peakX = cx ; peakY = cy ; setRegion ( cx , cy ) ; for ( int i = 0 ; i < maxIterations ; i ++ ) { float total = 0 ; float sumX = 0 , sumY = 0 ; int kernelIndex = 0 ; if ( interpolate . isInFastBounds ( x0 , y0 ) && interpolate . isInFastBounds ( x0 + width - 1 , y0 + width - ... | Performs a mean - shift search center at the specified coordinates |
27,191 | protected void setRegion ( float cx , float cy ) { x0 = cx - radius ; y0 = cy - radius ; if ( x0 < 0 ) { x0 = 0 ; } else if ( x0 + width > image . width ) { x0 = image . width - width ; } if ( y0 < 0 ) { y0 = 0 ; } else if ( y0 + width > image . height ) { y0 = image . height - width ; } } | Updates the location of the rectangular bounding box |
27,192 | public void gaussianDerivToDirectDeriv ( ) { T blur = GeneralizedImageOps . createSingleBand ( imageType , width , height ) ; T blurDeriv = GeneralizedImageOps . createSingleBand ( imageType , width , height ) ; T gaussDeriv = GeneralizedImageOps . createSingleBand ( imageType , width , height ) ; BlurStorageFilter < T... | Compare computing the image |
27,193 | public static PaperSize lookup ( String word ) { for ( PaperSize paper : values ) { if ( paper . name . compareToIgnoreCase ( word ) == 0 ) { return paper ; } } return null ; } | Sees if the specified work matches any of the units full name or short name . |
27,194 | public static < In extends ImageBase < In > , Out extends ImageBase < Out > , K extends Kernel1D , B extends ImageBorder < In > > void horizontal ( K kernel , In input , Out output , B border ) { switch ( input . getImageType ( ) . getFamily ( ) ) { case GRAY : { if ( input instanceof GrayF32 ) { ConvolveImage . horizo... | Performs a horizontal 1D convolution across the image . Borders are handled as specified by the border parameter . |
27,195 | public static < In extends ImageBase < In > , Out extends ImageBase < Out > , K extends Kernel1D > void horizontal ( K kernel , In input , Out output ) { switch ( input . getImageType ( ) . getFamily ( ) ) { case GRAY : { if ( input instanceof GrayF32 ) { ConvolveImageNoBorder . horizontal ( ( Kernel1D_F32 ) kernel , (... | Performs a horizontal 1D convolution across the image . The horizontal border is not processed . |
27,196 | public static < In extends ImageBase , Out extends ImageBase , K extends Kernel1D > void horizontalNormalized ( K kernel , In input , Out output ) { switch ( input . getImageType ( ) . getFamily ( ) ) { case GRAY : { if ( input instanceof GrayF32 ) { ConvolveImageNormalized . horizontal ( ( Kernel1D_F32 ) kernel , ( Gr... | Performs a horizontal 1D convolution across the image while re - normalizing the kernel depending on its overlap with the image . |
27,197 | public static < T extends ImageBase < T > , K extends Kernel2D > void convolveNormalized ( K kernel , T input , T output ) { switch ( input . getImageType ( ) . getFamily ( ) ) { case GRAY : { if ( input instanceof GrayF32 ) { ConvolveImageNormalized . convolve ( ( Kernel2D_F32 ) kernel , ( GrayF32 ) input , ( GrayF32 ... | Performs a 2D convolution across the image while re - normalizing the kernel depending on its overlap with the image . |
27,198 | private void addFirstSegment ( int x , int y ) { Point2D_I32 p = queuePoints . grow ( ) ; p . set ( x , y ) ; EdgeSegment s = new EdgeSegment ( ) ; s . points . add ( p ) ; s . index = 0 ; s . parent = s . parentPixel = - 1 ; e . segments . add ( s ) ; open . add ( s ) ; } | Starts a new segment at the first point in the contour |
27,199 | public static < T extends ImageBase < T > > void abs ( T input , T output ) { if ( input instanceof ImageGray ) { if ( GrayS8 . class == input . getClass ( ) ) { PixelMath . abs ( ( GrayS8 ) input , ( GrayS8 ) output ) ; } else if ( GrayS16 . class == input . getClass ( ) ) { PixelMath . abs ( ( GrayS16 ) input , ( Gra... | Sets each pixel in the output image to be the absolute value of the input image . Both the input and output image can be the same instance . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.