idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
27,000 | public void getCenter ( int which , Point2D_F64 location ) { CalibrationObservation view = detector . getDetectedPoints ( ) ; location . set ( 0 , 0 ) ; for ( int i = 0 ; i < view . size ( ) ; i ++ ) { PointIndex2D_F64 p = view . get ( i ) ; location . x += p . x ; location . y += p . y ; } location . x /= view . size ... | Returns the detection point average location . This will NOT be the same as the geometric center . |
27,001 | public void setConstraints ( boolean zeroSkew , boolean principlePointOrigin , boolean knownAspect , double aspect ) { if ( knownAspect && ! zeroSkew ) throw new IllegalArgumentException ( "If aspect is known then skew must be zero" ) ; this . zeroSkew = zeroSkew ; this . principlePointOrigin = principlePointOrigin ; t... | Specifies linear constraints |
27,002 | void extractReferenceW ( DMatrixRMaj nv ) { W0 . a11 = nv . data [ 0 ] ; W0 . a12 = W0 . a21 = nv . data [ 1 ] ; W0 . a13 = W0 . a31 = nv . data [ 2 ] ; W0 . a22 = nv . data [ 3 ] ; W0 . a23 = W0 . a32 = nv . data [ 4 ] ; W0 . a33 = nv . data [ 5 ] ; } | Extracts calibration for the reference frame |
27,003 | void convertW ( Homography2D_F64 w , CameraPinhole c ) { tmp . set ( w ) ; CommonOps_DDF3 . divide ( tmp , tmp . a33 ) ; CommonOps_DDF3 . cholU ( tmp ) ; CommonOps_DDF3 . invert ( tmp , K ) ; CommonOps_DDF3 . divide ( K , K . a33 ) ; c . fx = K . a11 ; c . fy = knownAspectRatio ? ( K . a22 + c . fx * aspectRatio ) / 2.... | Converts W into a pinhole camera model by finding the cholesky decomposition |
27,004 | void extractCalibration ( Homography2D_F64 Hinv , CameraPinhole c ) { CommonOps_DDF3 . multTransA ( Hinv , W0 , tmp ) ; CommonOps_DDF3 . mult ( tmp , Hinv , Wi ) ; convertW ( Wi , c ) ; } | Extracts calibration for the non - reference frames |
27,005 | public boolean computeInverseH ( List < Homography2D_F64 > homography0toI ) { listHInv . reset ( ) ; int N = homography0toI . size ( ) ; for ( int i = 0 ; i < N ; i ++ ) { Homography2D_F64 H = homography0toI . get ( i ) ; Homography2D_F64 Hinv = listHInv . grow ( ) ; double d = CommonOps_DDF3 . det ( H ) ; if ( d < 0 )... | Ensures the determinant is one then inverts the homogrpahy |
27,006 | protected void startCameraTexture ( TextureView view ) { if ( verbose ) Log . i ( TAG , "startCamera(TextureView=" + ( view != null ) + ")" ) ; this . mTextureView = view ; this . mView = null ; this . mTextureView . setSurfaceTextureListener ( mSurfaceTextureListener ) ; } | After this function is called the camera will be start . It might not start immediately and there can be a delay . |
27,007 | protected void configureCamera ( CameraDevice device , CameraCharacteristics characteristics , CaptureRequest . Builder captureRequestBuilder ) { if ( verbose ) Log . i ( TAG , "configureCamera() default function" ) ; captureRequestBuilder . set ( CaptureRequest . CONTROL_AF_MODE , CaptureRequest . CONTROL_AF_MODE_CONT... | Override to do custom configuration of the camera s settings . By default the camera is put into auto mode . |
27,008 | protected boolean selectCamera ( String id , CameraCharacteristics characteristics ) { if ( verbose ) Log . i ( TAG , "selectCamera() default function" ) ; Integer facing = characteristics . get ( CameraCharacteristics . LENS_FACING ) ; return facing == null || facing != CameraCharacteristics . LENS_FACING_FRONT ; } | By default this will select the backfacing camera . override to change the camera it selects . |
27,009 | protected void reopenCameraAtResolution ( int cameraWidth , int cameraHeight ) { if ( Looper . getMainLooper ( ) . getThread ( ) != Thread . currentThread ( ) ) { throw new RuntimeException ( "Attempted to reopenCameraAtResolution main looper thread!" ) ; } boolean releaseLock = true ; open . mLock . lock ( ) ; try { i... | Re - opens the camera with the same settings at the specified resolution . It is assumed that you know what you re doing and that this is a valid resolution . |
27,010 | protected boolean closeCamera ( ) { if ( verbose ) Log . i ( TAG , "closeCamera() activity=" + getClass ( ) . getSimpleName ( ) ) ; if ( Looper . getMainLooper ( ) . getThread ( ) != Thread . currentThread ( ) ) { throw new RuntimeException ( "Attempted to close camera not on the main looper thread!" ) ; } boolean clos... | Closes the camera . Returns true if the camera was not already closed and it closed it |
27,011 | private void startPreview ( ) { if ( Looper . getMainLooper ( ) . getThread ( ) != Thread . currentThread ( ) ) { throw new RuntimeException ( "Not on main looper! Modify code to remove assumptions" ) ; } if ( verbose ) { Log . i ( TAG , "startPreview()" ) ; } try { open . mLock . lock ( ) ; if ( null == open . mCamera... | Start the camera preview . |
27,012 | public void cameraIntrinsicNominal ( CameraPinhole intrinsic ) { open . mLock . lock ( ) ; try { if ( open . mCameraCharacterstics != null ) { SizeF physicalSize = open . mCameraCharacterstics . get ( CameraCharacteristics . SENSOR_INFO_PHYSICAL_SIZE ) ; Rect activeSize = open . mCameraCharacterstics . get ( CameraChar... | Returns the camera intrinsic parameters estimated from the physical parameters returned by the camera2 API |
27,013 | private float displayDensityAdjusted ( ) { open . mLock . lock ( ) ; try { if ( open . mCameraSize == null ) return displayMetrics . density ; int rotation = getWindowManager ( ) . getDefaultDisplay ( ) . getRotation ( ) ; int screenWidth = ( rotation == 0 || rotation == 2 ) ? displayMetrics . widthPixels : displayMetr... | Some times the size of a font of stroke needs to be specified in the input image but then gets scaled to image resolution . This compensates for that . |
27,014 | public static < T extends ImageGray < T > > StereoDisparitySparse < T > regionSparseWta ( int minDisparity , int maxDisparity , int regionRadiusX , int regionRadiusY , double maxPerPixelError , double texture , boolean subpixelInterpolation , Class < T > imageType ) { double maxError = ( regionRadiusX * 2 + 1 ) * ( reg... | WTA algorithms that computes disparity on a sparse per - pixel basis as requested .. |
27,015 | public void addPoint ( float x , float y , float z ) { norm . grow ( ) . set ( x / z , y / z ) ; } | Adds the estimated 3D location of a feature . |
27,016 | public void process ( ) { computeCovarince ( ) ; float eigenvalue = smallestEigenvalue ( ) ; double stdev = Math . sqrt ( eigenvalue ) ; double angle0 = Math . atan2 ( 1.0 , sigmas * ( meanX - stdev ) ) ; double angle1 = Math . atan2 ( 1.0 , sigmas * ( meanX + stdev ) ) ; spread = Math . abs ( angle1 - angle0 ) ; } | Computes the worst case spread for how features are laid out |
27,017 | public static ClassifierAndSource vgg_cifar10 ( ) { List < String > sources = new ArrayList < > ( ) ; sources . add ( "http://boofcv.org/notwiki/largefiles/likevgg_cifar10.zip" ) ; ClassifierAndSource ret = new ClassifierAndSource ( ) ; ret . data0 = new ImageClassifierVggCifar10 ( ) ; ret . data1 = sources ; return re... | VGG trained on CIFAR10 data |
27,018 | public static ClassifierAndSource nin_imagenet ( ) { List < String > sources = new ArrayList < > ( ) ; sources . add ( "http://boofcv.org/notwiki/largefiles/nin_imagenet.zip" ) ; ClassifierAndSource ret = new ClassifierAndSource ( ) ; ret . data0 = new ImageClassifierNiNImageNet ( ) ; ret . data1 = sources ; return ret... | NIN trained on ImageNet data |
27,019 | public Exit launch ( Class mainClass , String ... args ) { jvmArgs = configureArguments ( mainClass , args ) ; try { Runtime rt = Runtime . getRuntime ( ) ; Process pr = rt . exec ( jvmArgs ) ; Thread . sleep ( 500 ) ; BufferedReader input = new BufferedReader ( new InputStreamReader ( pr . getInputStream ( ) ) ) ; Buf... | Launches the class with the provided arguments . Blocks until the process stops . |
27,020 | private boolean monitorSlave ( Process pr , BufferedReader input , BufferedReader error ) throws IOException , InterruptedException { System . in . skip ( System . in . available ( ) ) ; boolean frozen = false ; long startTime = System . currentTimeMillis ( ) ; long lastAliveMessage = startTime ; for ( ; ; ) { while ( ... | Prints printOut the standard printOut and error from the slave and checks its health . Exits if the slave has finished or is declared frozen . |
27,021 | protected void computeWeightBlockPixels ( ) { int rows = cellsPerBlockY * pixelsPerCell ; int cols = cellsPerBlockX * pixelsPerCell ; weights = new double [ rows * cols ] ; double offsetRow = 0 , offsetCol = 0 ; int radiusRow = rows / 2 , radiusCol = cols / 2 ; if ( rows % 2 == 0 ) { offsetRow = 0.5 ; } if ( cols % 2 =... | Compute gaussian weights applied to each pixel in the block |
27,022 | private void computePixelFeatures ( ) { for ( int y = 0 ; y < derivX . height ; y ++ ) { int pixelIndex = y * derivX . width ; int endIndex = pixelIndex + derivX . width ; for ( ; pixelIndex < endIndex ; pixelIndex ++ ) { float dx = derivX . data [ pixelIndex ] ; float dy = derivY . data [ pixelIndex ] ; orientation . ... | Computes the orientation and magnitude of each pixel |
27,023 | void addToHistogram ( int cellX , int cellY , int orientationIndex , double magnitude ) { if ( cellX < 0 || cellX >= cellsPerBlockX ) return ; if ( cellY < 0 || cellY >= cellsPerBlockY ) return ; int index = ( cellY * cellsPerBlockX + cellX ) * orientationBins + orientationIndex ; histogram [ index ] += magnitude ; } | Adds the magnitude to the histogram at the specified cell and orientation |
27,024 | public void setInput ( float x [ ] , float y [ ] , int size ) { if ( x . length < size || y . length < size ) { throw new IllegalArgumentException ( "Arrays too small for size." ) ; } if ( size < M ) { throw new IllegalArgumentException ( "Not enough data points for M" ) ; } this . x = x ; this . y = y ; this . size = ... | Sets the data that is being interpolated . |
27,025 | public float process ( float testX ) { if ( doHunt ) { hunt ( testX ) ; } else { bisectionSearch ( testX , 0 , size - 1 ) ; } return compute ( testX ) ; } | Performs interpolation at the sample point . |
27,026 | protected void hunt ( float val ) { int lowerLimit = center ; int upperLimit ; int inc = 1 ; if ( val >= x [ lowerLimit ] && ascend ) { for ( ; ; ) { upperLimit = lowerLimit + inc ; if ( upperLimit >= size - 1 ) { upperLimit = size - 1 ; break ; } else if ( val < x [ upperLimit ] && ascend ) { break ; } else { lowerLim... | To speed up finding the appropriate indexes to use in the interpolation it can use its previous results to search a smaller region than it would otherwise . |
27,027 | public static void process ( GrayI orig , GrayI derivX , GrayI derivY ) { final int width = orig . getWidth ( ) ; final int height = orig . getHeight ( ) ; for ( int y = 1 ; y < height - 1 ; y ++ ) { for ( int x = 1 ; x < width - 1 ; x ++ ) { int dy = - ( orig . get ( x - 1 , y - 1 ) + 2 * orig . get ( x , y - 1 ) + or... | Computes the derivative of orig along the x and y axes |
27,028 | public static < T extends ImageBase < T > > void performSegmentation ( ImageSuperpixels < T > alg , T color ) { GBlurImageOps . gaussian ( color , color , 0.5 , - 1 , null ) ; GrayS32 pixelToSegment = new GrayS32 ( color . width , color . height ) ; alg . segment ( color , pixelToSegment ) ; visualize ( pixelToSegment ... | Segments and visualizes the image |
27,029 | public static < T extends ImageBase < T > > void visualize ( GrayS32 pixelToRegion , T color , int numSegments ) { ImageType < T > type = color . getImageType ( ) ; ComputeRegionMeanColor < T > colorize = FactorySegmentationAlg . regionMeanColor ( type ) ; FastQueue < float [ ] > segmentColor = new ColorQueue_F32 ( typ... | Visualizes results three ways . 1 ) Colorized segmented image where each region is given a random color . 2 ) Each pixel is assigned the mean color through out the region . 3 ) Black pixels represent the border between regions . |
27,030 | public static GrayU8 denseDisparity ( GrayU8 rectLeft , GrayU8 rectRight , int regionSize , int minDisparity , int maxDisparity ) { StereoDisparity < GrayU8 , GrayU8 > disparityAlg = FactoryStereoDisparity . regionWta ( DisparityAlgorithms . RECT_FIVE , minDisparity , maxDisparity , regionSize , regionSize , 25 , 1 , 0... | Computes the dense disparity between between two stereo images . The input images must be rectified with lens distortion removed to work! Floating point images are also supported . |
27,031 | public static GrayF32 denseDisparitySubpixel ( GrayU8 rectLeft , GrayU8 rectRight , int regionSize , int minDisparity , int maxDisparity ) { StereoDisparity < GrayU8 , GrayF32 > disparityAlg = FactoryStereoDisparity . regionSubpixelWta ( DisparityAlgorithms . RECT_FIVE , minDisparity , maxDisparity , regionSize , regio... | Same as above but compute disparity to within sub - pixel accuracy . The difference between the two is more apparent when a 3D point cloud is computed . |
27,032 | public static RectifyCalibrated rectify ( GrayU8 origLeft , GrayU8 origRight , StereoParameters param , GrayU8 rectLeft , GrayU8 rectRight ) { RectifyCalibrated rectifyAlg = RectifyImageOps . createCalibrated ( ) ; Se3_F64 leftToRight = param . getRightToLeft ( ) . invert ( null ) ; DMatrixRMaj K1 = PerspectiveOps . pi... | Rectified the input images using known calibration . |
27,033 | public boolean isRangeSet ( ) { for ( int i = 0 ; i < getDimensions ( ) ; i ++ ) { if ( valueMin [ i ] == 0 && valueMax [ i ] == 0 ) { return false ; } } return true ; } | Returns true if the min and max value for each dimension has been set |
27,034 | public void setRange ( int dimension , double min , double max ) { valueMin [ dimension ] = min ; valueMax [ dimension ] = max ; } | Specifies the minimum and maximum values for a specific dimension |
27,035 | public int getDimensionIndex ( int dimension , int value ) { double min = valueMin [ dimension ] ; double max = valueMax [ dimension ] ; double fraction = ( ( value - min ) / ( max - min + 1.0 ) ) ; return ( int ) ( fraction * length [ dimension ] ) ; } | Given a value it returns the corresponding bin index in this histogram for integer values . The discretion is taken in account and 1 is added to the range . |
27,036 | public final int getIndex ( int coordinate [ ] ) { int index = coordinate [ 0 ] * strides [ 0 ] ; for ( int i = 1 ; i < coordinate . length ; i ++ ) { index += strides [ i ] * coordinate [ i ] ; } return index ; } | For a N - Dimensional histogram it will return the array index for the N - D coordinate |
27,037 | public Histogram_F64 copy ( ) { Histogram_F64 out = newInstance ( ) ; System . arraycopy ( value , 0 , out . value , 0 , length . length ) ; return out ; } | Creates an exact copy of this histogram |
27,038 | public boolean refine ( Polygon2D_F64 input , Polygon2D_F64 output ) { if ( input . size ( ) != output . size ( ) ) throw new IllegalArgumentException ( "Input and output sides do not match. " + input . size ( ) + " " + output . size ( ) ) ; if ( checkShapeTooSmall ( input ) ) return false ; if ( general . length < inp... | Refines the fit a polygon by snapping it to the edges . |
27,039 | private boolean checkShapeTooSmall ( Polygon2D_F64 input ) { double minLength = cornerOffset * 2 + 2 ; for ( int i = 0 ; i < input . size ( ) ; i ++ ) { int j = ( i + 1 ) % input . size ( ) ; Point2D_F64 a = input . get ( i ) ; Point2D_F64 b = input . get ( j ) ; if ( a . distance2 ( b ) < minLength * minLength ) retur... | Looks at the distance between each vertex . If that distance is so small the edge can t be measured the return true . |
27,040 | protected boolean optimize ( Polygon2D_F64 seed , Polygon2D_F64 current ) { previous . set ( seed ) ; double convergeTol = convergeTolPixels * convergeTolPixels ; for ( int i = 0 ; i < seed . size ( ) ; i ++ ) { int j = ( i + 1 ) % seed . size ( ) ; Point2D_F64 a = seed . get ( i ) ; Point2D_F64 b = seed . get ( j ) ; ... | Refines the initial line estimates using EM . The number of iterations is fixed . |
27,041 | protected boolean optimize ( Point2D_F64 a , Point2D_F64 b , LineGeneral2D_F64 found ) { computeAdjustedEndPoints ( a , b ) ; return snapToEdge . refine ( adjA , adjB , found ) ; } | Fits a line defined by the two points . When fitting the line the weight of the edge is used to determine how influential the point is |
27,042 | public static BufferedImage watersheds ( GrayS32 segments , BufferedImage output , int radius ) { if ( output == null ) output = new BufferedImage ( segments . width , segments . height , BufferedImage . TYPE_INT_RGB ) ; if ( radius <= 0 ) { for ( int y = 0 ; y < segments . height ; y ++ ) { for ( int x = 0 ; x < segme... | Sets the pixels of each watershed as red in the output image . Watersheds have a value of 0 |
27,043 | public static BufferedImage regions ( GrayS32 pixelToRegion , int numRegions , BufferedImage output ) { return VisualizeBinaryData . renderLabeled ( pixelToRegion , numRegions , output ) ; } | Draws each region with a random color |
27,044 | private static void randomGaussian ( Random rand , double sigma , int radius , Point2D_I32 pt ) { int x , y ; while ( true ) { x = ( int ) ( rand . nextGaussian ( ) * sigma ) ; y = ( int ) ( rand . nextGaussian ( ) * sigma ) ; if ( Math . sqrt ( x * x + y * y ) < radius ) break ; } pt . set ( x , y ) ; } | Randomly selects a point which is inside a square region using a Gaussian distribution . |
27,045 | public static < T extends ImageBase < T > > PyramidDiscrete < T > discreteGaussian ( int [ ] scaleFactors , double sigma , int radius , boolean saveOriginalReference , ImageType < T > imageType ) { Class < Kernel1D > kernelType = FactoryKernel . getKernelType ( imageType . getDataType ( ) , 1 ) ; Kernel1D kernel = Fact... | Creates an updater for discrete pyramids where a Gaussian is convolved across the input prior to sub - sampling . |
27,046 | public static < T extends ImageGray < T > > PyramidFloat < T > floatGaussian ( double scaleFactors [ ] , double [ ] sigmas , Class < T > imageType ) { InterpolatePixelS < T > interp = FactoryInterpolation . bilinearPixelS ( imageType , BorderType . EXTENDED ) ; return new PyramidFloatGaussianScale < > ( interp , scaleF... | Creates a float pyramid where each layer is blurred using a Gaussian with the specified sigma . Bilinear interpolation is used when sub - sampling . |
27,047 | public static double process_F64 ( double sample , double x [ ] , double y [ ] , int i0 , int i1 ) { double result = 0 ; for ( int i = i0 ; i <= i1 ; i ++ ) { double numerator = 1.0 ; for ( int j = i0 ; j <= i1 ; j ++ ) { if ( i != j ) numerator *= sample - x [ j ] ; } double denominator = 1.0 ; double a = x [ i ] ; fo... | UsingLlangrange s formula it interpulates the value of a function at the specified sample point given discrete samples . Which samples are used and the order of the approximation are given by i0 and i1 . |
27,048 | public void add ( Color color , Point3D_F64 ... polygon ) { final Poly p = new Poly ( polygon . length , color ) ; for ( int i = 0 ; i < polygon . length ; i ++ ) p . pts [ i ] = polygon [ i ] . copy ( ) ; synchronized ( polygons ) { polygons . add ( p ) ; } } | Adds a polygon to the viewer . GUI Thread safe . |
27,049 | public static BufferedImage checkDeclare ( int width , int height , BufferedImage image , int type ) { if ( image == null ) return new BufferedImage ( width , height , type ) ; if ( image . getType ( ) != type ) return new BufferedImage ( width , height , type ) ; if ( image . getWidth ( ) != width || image . getHeight... | If the provided image does not have the same shape and same type a new one is declared and returned . |
27,050 | public static BufferedImage checkCopy ( BufferedImage original , BufferedImage output ) { ColorModel cm = original . getColorModel ( ) ; boolean isAlphaPremultiplied = cm . isAlphaPremultiplied ( ) ; if ( output == null || original . getWidth ( ) != output . getWidth ( ) || original . getHeight ( ) != output . getHeigh... | Copies the original image into the output image . If it can t do a copy a new image is created and returned |
27,051 | public static BufferedImage stripAlphaChannel ( BufferedImage image ) { int numBands = image . getRaster ( ) . getNumBands ( ) ; if ( numBands == 4 ) { BufferedImage output = new BufferedImage ( image . getWidth ( ) , image . getHeight ( ) , BufferedImage . TYPE_INT_RGB ) ; output . createGraphics ( ) . drawImage ( ima... | Returns an image which doesn t have an alpha channel . If the input image doesn t have an alpha channel to start then its returned as is . Otherwise a new image is created and the RGB channels are copied and the new image returned . |
27,052 | public static InterleavedU8 extractInterleavedU8 ( BufferedImage img ) { DataBuffer buffer = img . getRaster ( ) . getDataBuffer ( ) ; if ( buffer . getDataType ( ) == DataBuffer . TYPE_BYTE && isKnownByteFormat ( img ) ) { WritableRaster raster = img . getRaster ( ) ; InterleavedU8 ret = new InterleavedU8 ( ) ; ret . ... | For BufferedImage stored as a byte array internally it extracts an interleaved image . The input image and the returned image will both share the same internal data array . Using this function allows unnecessary memory copying to be avoided . |
27,053 | public static GrayU8 extractGrayU8 ( BufferedImage img ) { WritableRaster raster = img . getRaster ( ) ; DataBuffer buffer = raster . getDataBuffer ( ) ; if ( buffer . getDataType ( ) == DataBuffer . TYPE_BYTE && isKnownByteFormat ( img ) ) { if ( raster . getNumBands ( ) != 1 ) throw new IllegalArgumentException ( "In... | For BufferedImage stored as a byte array internally it extracts an image . The input image and the returned image will both share the same internal data array . Using this function allows unnecessary memory copying to be avoided . |
27,054 | public static < T extends ImageGray < T > > T convertFromSingle ( BufferedImage src , T dst , Class < T > type ) { if ( type == GrayU8 . class ) { return ( T ) convertFrom ( src , ( GrayU8 ) dst ) ; } else if ( GrayI16 . class . isAssignableFrom ( type ) ) { return ( T ) convertFrom ( src , ( GrayI16 ) dst , ( Class ) ... | Converts a buffered image into an image of the specified type . In a dst image is provided it will be used for output otherwise a new image will be created . |
27,055 | public static BufferedImage convertTo ( JComponent comp , BufferedImage storage ) { if ( storage == null ) storage = new BufferedImage ( comp . getWidth ( ) , comp . getHeight ( ) , BufferedImage . TYPE_INT_RGB ) ; Graphics2D g2 = storage . createGraphics ( ) ; comp . paintComponents ( g2 ) ; return storage ; } | Draws the component into a BufferedImage . |
27,056 | public static Planar orderBandsIntoBuffered ( Planar src , BufferedImage dst ) { if ( dst . getType ( ) == BufferedImage . TYPE_INT_RGB ) return src ; Planar tmp = new Planar ( src . type , src . getNumBands ( ) ) ; tmp . width = src . width ; tmp . height = src . height ; tmp . stride = src . stride ; tmp . startIndex... | Returns a new image with the color bands in the appropriate ordering . The returned image will reference the original image s image arrays . |
27,057 | public static double computeError ( GrayF32 imgA , GrayF32 imgB ) { final int h = imgA . getHeight ( ) ; final int w = imgA . getWidth ( ) ; double total = 0 ; for ( int y = 0 ; y < h ; y ++ ) { for ( int x = 0 ; x < w ; x ++ ) { double difference = Math . abs ( imgA . get ( x , y ) - imgB . get ( x , y ) ) ; total += ... | todo push to what ops? Also what is this error called again? |
27,058 | public static double computeWeightedError ( GrayF32 imgA , GrayF32 imgB , GrayF32 imgWeight ) { final int h = imgA . getHeight ( ) ; final int w = imgA . getWidth ( ) ; double total = 0 ; double totalWeight = 0 ; for ( int y = 0 ; y < h ; y ++ ) { for ( int x = 0 ; x < w ; x ++ ) { float weight = imgWeight . get ( x , ... | todo push to what ops? |
27,059 | private static boolean nearBorder ( Point2D_F64 p , StitchingFromMotion2D < ? , ? > stitch ) { int r = 10 ; if ( p . x < r || p . y < r ) return true ; if ( p . x >= stitch . getStitchedImage ( ) . width - r ) return true ; if ( p . y >= stitch . getStitchedImage ( ) . height - r ) return true ; return false ; } | Checks to see if the point is near the image border |
27,060 | public void setShape ( double width , double height ) { points2D3D . get ( 0 ) . location . set ( - width / 2 , - height / 2 , 0 ) ; points2D3D . get ( 1 ) . location . set ( - width / 2 , height / 2 , 0 ) ; points2D3D . get ( 2 ) . location . set ( width / 2 , height / 2 , 0 ) ; points2D3D . get ( 3 ) . location . set... | Specifes how big the fiducial is along two axises |
27,061 | public void computeStability ( Se3_F64 targetToCamera , double disturbance , FiducialStability results ) { targetToCamera . invert ( referenceCameraToTarget ) ; maxOrientation = 0 ; maxLocation = 0 ; Point3D_F64 cameraPt = new Point3D_F64 ( ) ; for ( int i = 0 ; i < points2D3D . size ( ) ; i ++ ) { Point2D3D p23 = poin... | Estimate how sensitive this observation is to pixel noise |
27,062 | private void perturb ( double disturbance , Point2D_F64 pixel , Point2D3D p23 ) { double x ; double y = pixel . y ; x = pixel . x + disturbance ; computeDisturbance ( x , y , p23 ) ; x = pixel . x - disturbance ; computeDisturbance ( x , y , p23 ) ; x = pixel . x ; y = pixel . y + disturbance ; computeDisturbance ( x ,... | Perturb the observation in 4 different ways |
27,063 | public static < T extends ImageGray < T > , D extends ImageGray < D > > void detectLines ( BufferedImage image , Class < T > imageType , Class < D > derivType ) { T input = ConvertBufferedImage . convertFromSingle ( image , null , imageType ) ; DetectLineHoughPolar < T , D > detector = FactoryDetectLineAlgs . houghPola... | Detects lines inside the image using different types of Hough detectors |
27,064 | public static < T extends ImageGray < T > , D extends ImageGray < D > > void detectLineSegments ( BufferedImage image , Class < T > imageType , Class < D > derivType ) { T input = ConvertBufferedImage . convertFromSingle ( image , null , imageType ) ; DetectLineSegmentsGridRansac < T , D > detector = FactoryDetectLineA... | Detects segments inside the image |
27,065 | public static List < double [ ] > coupledHueSat ( List < String > images ) { List < double [ ] > points = new ArrayList < > ( ) ; Planar < GrayF32 > rgb = new Planar < > ( GrayF32 . class , 1 , 1 , 3 ) ; Planar < GrayF32 > hsv = new Planar < > ( GrayF32 . class , 1 , 1 , 3 ) ; for ( String path : images ) { BufferedIma... | HSV stores color information in Hue and Saturation while intensity is in Value . This computes a 2D histogram from hue and saturation only which makes it lighting independent . |
27,066 | public static List < double [ ] > independentHueSat ( List < File > images ) { List < double [ ] > points = new ArrayList < > ( ) ; TupleDesc_F64 histogramHue = new TupleDesc_F64 ( 30 ) ; TupleDesc_F64 histogramValue = new TupleDesc_F64 ( 30 ) ; List < TupleDesc_F64 > histogramList = new ArrayList < > ( ) ; histogramLi... | Computes two independent 1D histograms from hue and saturation . Less affects by sparsity but can produce worse results since the basic assumption that hue and saturation are decoupled is most of the time false . |
27,067 | public static List < double [ ] > coupledRGB ( List < File > images ) { List < double [ ] > points = new ArrayList < > ( ) ; Planar < GrayF32 > rgb = new Planar < > ( GrayF32 . class , 1 , 1 , 3 ) ; for ( File f : images ) { BufferedImage buffered = UtilImageIO . loadImage ( f . getPath ( ) ) ; if ( buffered == null ) ... | Constructs a 3D histogram using RGB . RGB is a popular color space but the resulting histogram will depend on lighting conditions and might not produce the accurate results . |
27,068 | public static List < double [ ] > histogramGray ( List < File > images ) { List < double [ ] > points = new ArrayList < > ( ) ; GrayU8 gray = new GrayU8 ( 1 , 1 ) ; for ( File f : images ) { BufferedImage buffered = UtilImageIO . loadImage ( f . getPath ( ) ) ; if ( buffered == null ) throw new RuntimeException ( "Can'... | Computes a histogram from the gray scale intensity image alone . Probably the least effective at looking up similar images . |
27,069 | public static int [ ] imageOffsets ( double radius , int imgWidth ) { double PI2 = Math . PI * 2.0 ; double circumference = PI2 * radius ; int num = ( int ) Math . ceil ( circumference ) ; num = num - num % 4 ; double angleStep = PI2 / num ; int temp [ ] = new int [ ( int ) Math . ceil ( circumference ) ] ; int i = 0 ;... | Computes the offsets for a discretized circle of the specified radius for an image with the specified width . |
27,070 | public static < T extends ImageGray < T > , TD extends TupleDesc > DetectDescribePoint < T , TD > createFromPremade ( Class < T > imageType ) { return ( DetectDescribePoint ) FactoryDetectDescribe . surfStable ( new ConfigFastHessian ( 1 , 2 , 200 , 1 , 9 , 4 , 4 ) , null , null , imageType ) ; } | For some features there are pre - made implementations of DetectDescribePoint . This has only been done in situations where there was a performance advantage or that it was a very common combination . |
27,071 | public static < T extends ImageGray < T > , TD extends TupleDesc > DetectDescribePoint < T , TD > createFromComponents ( Class < T > imageType ) { Class derivType = GImageDerivativeOps . getDerivativeType ( imageType ) ; GeneralFeatureDetector corner = FactoryDetectPoint . createShiTomasi ( new ConfigGeneralDetector ( ... | Any arbitrary implementation of InterestPointDetector OrientationImage DescribeRegionPoint can be combined into DetectDescribePoint . The syntax is more complex but the end result is more flexible . This should only be done if there isn t a pre - made DetectDescribePoint . |
27,072 | protected void computeWeights ( int numSamples , double numSigmas ) { weights = new float [ numSamples * numSamples ] ; float w [ ] = new float [ numSamples ] ; for ( int i = 0 ; i < numSamples ; i ++ ) { float x = i / ( float ) ( numSamples - 1 ) ; w [ i ] = ( float ) UtilGaussian . computePDF ( 0 , 1 , 2f * numSigmas... | compute the weights by convolving 1D gaussian kernel |
27,073 | protected void createSamplePoints ( int numSamples ) { for ( int y = 0 ; y < numSamples ; y ++ ) { float regionY = ( y / ( numSamples - 1.0f ) - 0.5f ) ; for ( int x = 0 ; x < numSamples ; x ++ ) { float regionX = ( x / ( numSamples - 1.0f ) - 0.5f ) ; samplePts . add ( new Point2D_F32 ( regionX , regionY ) ) ; } } } | create the list of points in square coordinates that it will sample . values will range from - 0 . 5 to 0 . 5 along each axis . |
27,074 | protected void computeHistogramInside ( RectangleRotate_F32 region ) { for ( int i = 0 ; i < samplePts . size ( ) ; i ++ ) { Point2D_F32 p = samplePts . get ( i ) ; squareToImageSample ( p . x , p . y , region ) ; interpolate . get_fast ( imageX , imageY , value ) ; int indexHistogram = computeHistogramBin ( value ) ; ... | Computes the histogram quickly inside the image |
27,075 | protected void computeHistogramBorder ( T image , RectangleRotate_F32 region ) { for ( int i = 0 ; i < samplePts . size ( ) ; i ++ ) { Point2D_F32 p = samplePts . get ( i ) ; squareToImageSample ( p . x , p . y , region ) ; if ( ! BoofMiscOps . checkInside ( image , imageX , imageY ) ) { sampleHistIndex [ i ] = - 1 ; }... | Computes the histogram and skips pixels which are outside the image border |
27,076 | protected int computeHistogramBin ( float value [ ] ) { int indexHistogram = 0 ; int binStride = 1 ; for ( int bandIndex = 0 ; bandIndex < value . length ; bandIndex ++ ) { int bin = ( int ) ( numBins * value [ bandIndex ] / maxPixelValue ) ; indexHistogram += bin * binStride ; binStride *= numBins ; } return indexHist... | Given the value of a pixel compute which bin in the histogram it belongs in |
27,077 | protected boolean isInFastBounds ( RectangleRotate_F32 region ) { squareToImageSample ( - 0.5f , - 0.5f , region ) ; if ( ! interpolate . isInFastBounds ( imageX , imageY ) ) return false ; squareToImageSample ( - 0.5f , 0.5f , region ) ; if ( ! interpolate . isInFastBounds ( imageX , imageY ) ) return false ; squareTo... | Checks to see if the region can be sampled using the fast algorithm |
27,078 | protected void squareToImageSample ( float x , float y , RectangleRotate_F32 region ) { x *= region . width - 1 ; y *= region . height - 1 ; imageX = x * c - y * s + region . cx ; imageY = x * s + y * c + region . cy ; } | Converts a point from square coordinates into image coordinates |
27,079 | private void createSparseDerivatives ( ) { Kernel1D_F32 kernelD = new Kernel1D_F32 ( new float [ ] { - 1 , 0 , 1 } , 3 ) ; Kernel1D_F32 kernelDD = KernelMath . convolve1D_F32 ( kernelD , kernelD ) ; Kernel2D_F32 kernelXY = KernelMath . convolve2D ( kernelD , kernelD ) ; derivXX = FactoryConvolveSparse . horizontal1D ( ... | Define sparse image derivative operators . |
27,080 | public void process ( GrayF32 input ) { scaleSpace . initialize ( input ) ; detections . reset ( ) ; do { pixelScaleToInput = scaleSpace . pixelScaleCurrentToInput ( ) ; for ( int j = 1 ; j < scaleSpace . getNumScales ( ) + 1 ; j ++ ) { sigmaLower = scaleSpace . computeSigmaScale ( j - 1 ) ; sigmaTarget = scaleSpace . ... | Detects SIFT features inside the input image |
27,081 | protected void detectFeatures ( int scaleIndex ) { extractor . process ( dogTarget ) ; FastQueue < NonMaxLimiter . LocalExtreme > found = extractor . getLocalExtreme ( ) ; derivXX . setImage ( dogTarget ) ; derivXY . setImage ( dogTarget ) ; derivYY . setImage ( dogTarget ) ; for ( int i = 0 ; i < found . size ; i ++ )... | Detect features inside the Difference - of - Gaussian image at the current scale |
27,082 | boolean isScaleSpaceExtremum ( int c_x , int c_y , float value , float signAdj ) { if ( c_x <= 1 || c_y <= 1 || c_x >= dogLower . width - 1 || c_y >= dogLower . height - 1 ) return false ; float v ; value *= signAdj ; for ( int y = - 1 ; y <= 1 ; y ++ ) { for ( int x = - 1 ; x <= 1 ; x ++ ) { v = dogLower . unsafe_get ... | See if the point is a local extremum in scale - space above and below . |
27,083 | public static PixelTransformAffine_F32 transformScale ( ImageBase from , ImageBase to , PixelTransformAffine_F32 distort ) { if ( distort == null ) distort = new PixelTransformAffine_F32 ( ) ; float scaleX = ( float ) ( to . width ) / ( float ) ( from . width ) ; float scaleY = ( float ) ( to . height ) / ( float ) ( f... | Computes a transform which is used to rescale an image . The scale is computed directly from the size of the two input images and independently scales the x and y axises . |
27,084 | protected boolean projectOntoEssential ( DMatrixRMaj E ) { if ( ! svdConstraints . decompose ( E ) ) { return false ; } svdV = svdConstraints . getV ( svdV , false ) ; svdU = svdConstraints . getU ( svdU , false ) ; svdS = svdConstraints . getW ( svdS ) ; SingularOps_DDRM . descendingOrder ( svdU , false , svdS , svdV ... | Projects the found estimate of E onto essential space . |
27,085 | protected boolean projectOntoFundamentalSpace ( DMatrixRMaj F ) { if ( ! svdConstraints . decompose ( F ) ) { return false ; } svdV = svdConstraints . getV ( svdV , false ) ; svdU = svdConstraints . getU ( svdU , false ) ; svdS = svdConstraints . getW ( svdS ) ; SingularOps_DDRM . descendingOrder ( svdU , false , svdS ... | Projects the found estimate of F onto Fundamental space . |
27,086 | public void learnFern ( boolean positive , ImageRectangle r ) { float rectWidth = r . getWidth ( ) ; float rectHeight = r . getHeight ( ) ; float c_x = r . x0 + ( rectWidth - 1 ) / 2f ; float c_y = r . y0 + ( rectHeight - 1 ) / 2f ; for ( int i = 0 ; i < ferns . length ; i ++ ) { int value = computeFernValue ( c_x , c_... | Learns a fern from the specified region . No noise is added . |
27,087 | public void learnFernNoise ( boolean positive , ImageRectangle r ) { float rectWidth = r . getWidth ( ) ; float rectHeight = r . getHeight ( ) ; float c_x = r . x0 + ( rectWidth - 1 ) / 2.0f ; float c_y = r . y0 + ( rectHeight - 1 ) / 2.0f ; for ( int i = 0 ; i < ferns . length ; i ++ ) { int value = computeFernValue (... | Computes the value for each fern inside the region and update s their P and N value . Noise is added to the image measurements to take in account the variability . |
27,088 | private void increment ( TldFernFeature f , boolean positive ) { if ( positive ) { f . incrementP ( ) ; if ( f . numP > maxP ) maxP = f . numP ; } else { f . incrementN ( ) ; if ( f . numN > maxN ) maxN = f . numN ; } } | Increments the P and N value for a fern . Also updates the maxP and maxN statistics so that it knows when to re - normalize data structures . |
27,089 | public boolean lookupFernPN ( TldRegionFernInfo info ) { ImageRectangle r = info . r ; float rectWidth = r . getWidth ( ) ; float rectHeight = r . getHeight ( ) ; float c_x = r . x0 + ( rectWidth - 1 ) / 2.0f ; float c_y = r . y0 + ( rectHeight - 1 ) / 2.0f ; int sumP = 0 ; int sumN = 0 ; for ( int i = 0 ; i < ferns . ... | For the specified regions computes the values of each fern inside of it and then retrives their P and N values . The sum of which is stored inside of info . |
27,090 | protected int computeFernValue ( float c_x , float c_y , float rectWidth , float rectHeight , TldFernDescription fern ) { rectWidth -= 1 ; rectHeight -= 1 ; int desc = 0 ; for ( int i = 0 ; i < fern . pairs . length ; i ++ ) { Point2D_F32 p_a = fern . pairs [ i ] . a ; Point2D_F32 p_b = fern . pairs [ i ] . b ; float v... | Computes the value of the specified fern at the specified location in the image . |
27,091 | public void renormalizeP ( ) { int targetMax = maxP / 20 ; for ( int i = 0 ; i < managers . length ; i ++ ) { TldFernManager m = managers [ i ] ; for ( int j = 0 ; j < m . table . length ; j ++ ) { TldFernFeature f = m . table [ j ] ; if ( f == null ) continue ; f . numP = targetMax * f . numP / maxP ; } } maxP = targe... | Renormalizes fern . numP to avoid overflow |
27,092 | public void renormalizeN ( ) { int targetMax = maxN / 20 ; for ( int i = 0 ; i < managers . length ; i ++ ) { TldFernManager m = managers [ i ] ; for ( int j = 0 ; j < m . table . length ; j ++ ) { TldFernFeature f = m . table [ j ] ; if ( f == null ) continue ; f . numN = targetMax * f . numN / maxN ; } } maxN = targe... | Renormalizes fern . numN to avoid overflow |
27,093 | public void describe ( double x , double y , double angle , double scale , TupleDesc_F64 ret ) { double c = Math . cos ( angle ) , s = Math . sin ( angle ) ; boolean isInBounds = SurfDescribeOps . isInside ( ii , x , y , radiusDescriptor , widthSample , scale , c , s ) ; if ( ret == null ) ret = new BrightFeature ( fea... | Compute SURF descriptor but without laplacian sign |
27,094 | public boolean computeLaplaceSign ( int x , int y , double scale ) { int s = ( int ) Math . ceil ( scale ) ; kerXX = DerivativeIntegralImage . kernelDerivXX ( 9 * s , kerXX ) ; kerYY = DerivativeIntegralImage . kernelDerivYY ( 9 * s , kerYY ) ; double lap = GIntegralImageOps . convolveSparse ( ii , kerXX , x , y ) ; la... | Compute the sign of the Laplacian using a sparse convolution . |
27,095 | public static < I extends ImageGray < I > , D extends ImageGray < D > > DetectLineHoughPolar < I , D > houghPolar ( ConfigHoughPolar config , Class < I > imageType , Class < D > derivType ) { if ( config == null ) throw new IllegalArgumentException ( "This is no default since minCounts must be specified" ) ; ImageGradi... | Creates a Hough line detector based on polar parametrization . |
27,096 | public static BufferedImage renderContours ( List < Contour > contours , int colorExternal , int colorInternal , int width , int height , BufferedImage out ) { if ( out == null ) { out = new BufferedImage ( width , height , BufferedImage . TYPE_INT_RGB ) ; } else { Graphics2D g2 = out . createGraphics ( ) ; g2 . setCol... | Draws contours . Internal and external contours are different user specified colors . |
27,097 | public static void render ( List < Contour > contours , int colors [ ] , BufferedImage out ) { colors = checkColors ( colors , contours . size ( ) ) ; for ( int i = 0 ; i < contours . size ( ) ; i ++ ) { Contour c = contours . get ( i ) ; int color = colors [ i ] ; for ( Point2D_I32 p : c . external ) { out . setRGB ( ... | Renders only the external contours . Each contour is individually colored as specified by colors |
27,098 | public static BufferedImage renderBinary ( GrayU8 binaryImage , boolean invert , BufferedImage out ) { if ( out == null || ( out . getWidth ( ) != binaryImage . width || out . getHeight ( ) != binaryImage . height ) ) { out = new BufferedImage ( binaryImage . getWidth ( ) , binaryImage . getHeight ( ) , BufferedImage .... | Renders a binary image . 0 = black and 1 = white . |
27,099 | public void process ( PairLineNorm line , AssociatedPair point ) { GeometryMath_F64 . mult ( F , point . p1 , Fx ) ; GeometryMath_F64 . cross ( Fx , line . getL2 ( ) , t0 ) ; GeometryMath_F64 . cross ( point . p2 , t0 , t1 ) ; GeometryMath_F64 . cross ( point . p2 , e2 , t0 ) ; double top = GeometryMath_F64 . dot ( t0 ... | Computes the homography based on a line and point on the plane |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.