Tabnine Logo
ImageRectangle
Code IndexAdd Tabnine to your IDE (free)

How to use
ImageRectangle
in
boofcv.struct

Best Java code snippets using boofcv.struct.ImageRectangle (Showing top 20 results out of 315)

origin: org.boofcv/boofcv-ip

public ImageRectangle(int x0, int y0, int x1, int y1) {
  set(x0,y0,x1,y1);
}
origin: org.boofcv/boofcv-ip

public IntegralKernel( int numBlocks ) {
  this.blocks = new ImageRectangle[numBlocks];
  this.scales = new int[ numBlocks ];
  for( int i = 0; i < numBlocks; i++ ) {
    blocks[i] = new ImageRectangle();
  }
}
origin: org.boofcv/recognition

/**
 * Computes the fractional area of intersection between the two regions.
 *
 * @return number from 0 to 1.  higher means more intersection
 */
public double computeOverlap( ImageRectangle a , ImageRectangle b ) {
  if( !a.intersection(b,work) )
    return 0;
  int areaI = work.area();
  int bottom = a.area() + b.area() - areaI;
  return areaI/ (double)bottom;
}
origin: org.boofcv/recognition

/**
 * 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.
 * @param info (Input) Location/Rectangle (output) P and N values
 * @return true if a known value for any of the ferns was observed in this region
 */
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.length; i++ ) {
    TldFernDescription fern = ferns[i];
    int value = computeFernValue(c_x, c_y, rectWidth, rectHeight, fern);
    TldFernFeature f = managers[i].table[value];
    if( f != null ) {
      sumP += f.numP;
      sumN += f.numN;
    }
  }
  info.sumP = sumP;
  info.sumN = sumN;
  return sumN != 0 || sumP != 0;
}
origin: org.boofcv/recognition

/**
 * Learns a fern from the specified region.  No noise is added.
 */
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++ ) {
    // first learn it with no noise
    int value = computeFernValue(c_x, c_y, rectWidth, rectHeight,ferns[i]);
    TldFernFeature f = managers[i].lookupFern(value);
    increment(f,positive);
  }
}
origin: org.boofcv/boofcv-ip

public ImageRectangle( ImageRectangle orig ) {
  set(orig);
}
origin: org.boofcv/boofcv-ip

  public IntegralKernel copy() {
    IntegralKernel ret = new IntegralKernel( blocks.length );
    for( int i = 0; i < blocks.length; i++ ) {
      this.blocks[i] = new ImageRectangle(blocks[i]);
      this.scales[i] = scales[i];
    }

    return ret;
  }
}
origin: org.boofcv/recognition

/**
 * 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.
 */
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++ ) {
    // first learn it with no noise
    int value = computeFernValue(c_x, c_y, rectWidth, rectHeight,ferns[i]);
    TldFernFeature f = managers[i].lookupFern(value);
    increment(f,positive);
    for( int j = 0; j < numLearnRandom; j++ ) {
      value = computeFernValueRand(c_x, c_y, rectWidth, rectHeight,ferns[i]);
      f = managers[i].lookupFern(value);
      increment(f,positive);
    }
  }
}
origin: org.boofcv/boofcv-ip

public static IntegralKernel kernelDerivXY( int size , IntegralKernel ret ) {
  if( ret == null )
    ret = new IntegralKernel(4);
  int block = size/3;
  ret.blocks[0].set(-block-1,-block-1,-1,-1);
  ret.blocks[1].set(0,-block-1,block,-1);
  ret.blocks[2].set(0, 0, block, block);
  ret.blocks[3].set(-block-1,0,-1,block);
  ret.scales[0] = 1;
  ret.scales[1] = -1;
  ret.scales[2] = 1;
  ret.scales[3] = -1;
  return ret;
}
origin: us.ihmc/ImageProcessing

public void mouseDragged(MouseEvent e) {
  // compute coordinates in the original image
  int x = (int)(e.getX()/scale);
  int y = (int)(e.getY()/scale);
  if( !selected.isInBounds(x,y) )
   return;
  int drawRadius = ((Number) spinnerRadius.getValue()).intValue();
  // mark pixels near the selected point
  ImageRectangle r = new ImageRectangle(x-drawRadius,y-drawRadius,x+drawRadius+1,y+drawRadius+1);
  BoofMiscOps.boundRectangleInside(selected,r);
  ImageMiscOps.fillRectangle(selected, (byte)1,r.x0,r.y0,r.x1-r.x0,r.y1-r.y0);
  // visualize these changes
  synchronized ( work ) {
   int color = 0x22FF45;
   for( int i = r.y0;i < r.y1; i++ ) {
     for( int j = r.x0; j < r.x1; j++ ) {
      work.setRGB(j,i,color);
     }
   }
  }
  repaint((int)(r.x0*scale),(int)(r.y0*scale),(int)((r.x1-r.x0)*scale),(int)((r.y1-r.y0)*scale));
}
origin: org.boofcv/boofcv-ip

public static IntegralKernel kernelDerivYY( int size , IntegralKernel ret ) {
  if( ret == null )
    ret = new IntegralKernel(2);
  int blockW = size/3;
  int blockH = size-blockW-1;
  int r1 = blockW/2;
  int r2 = blockW+r1;
  int r3 = blockH/2;
  ret.blocks[0].set(-r3-1,-r2-1,r3,r2);
  ret.blocks[1].set(-r3-1,-r1-1,r3,r1);
  ret.scales[0] = 1;
  ret.scales[1] = -3;
  return ret;
}
origin: org.boofcv/boofcv-ip

/**
 * Creates a kernel for a symmetric box derivative.
 *
 * @param r Radius of the box.  width is 2*r+1
 * @return Kernel Kernel for derivative.
 */
public static IntegralKernel kernelDerivX( int r , IntegralKernel ret ) {
  if( ret == null )
    ret = new IntegralKernel(2);
  ret.blocks[0].set(-r-1,-r-1,-1,r);
  ret.blocks[1].set(0,-r-1,r,r);
  ret.scales[0] = -1;
  ret.scales[1] = 1;
  return ret;
}
origin: org.boofcv/boofcv-ip

public static IntegralKernel kernelDerivXX( int size , IntegralKernel ret ) {
  if( ret == null )
    ret = new IntegralKernel(2);
  // lobe size
  int blockW = size/3;
  // horizontal band size
  int blockH = size-blockW-1;
  int r1 = blockW/2;
  int r2 = blockW+r1;
  int r3 = blockH/2;
  ret.blocks[0].set(-r2-1,-r3-1,r2,r3);
  ret.blocks[1].set(-r1 - 1, -r3 - 1, r1, r3);
  ret.scales[0] = 1;
  ret.scales[1] = -3;
  return ret;
}
origin: org.boofcv/boofcv-ip

/**
 * Creates a kernel for a symmetric box derivative.
 *
 * @param r Radius of the box.  width is 2*r+1
 * @return Kernel Kernel for derivative.
 */
public static IntegralKernel kernelDerivY( int r , IntegralKernel ret ) {
  if( ret == null )
    ret = new IntegralKernel(2);
  ret.blocks[0].set(-r-1,-r-1,r,-1);
  ret.blocks[1].set(-r-1,0,r,r);
  ret.scales[0] = -1;
  ret.scales[1] = 1;
  return ret;
}
origin: org.boofcv/boofcv-ip

/**
 * Creates a kernel for the Haar wavelet "centered" around the target pixel.
 *
 * @param r Radius of the box.  width is 2*r
 * @return Kernel for a Haar x-axis wavelet.
 */
public static IntegralKernel kernelHaarX( int r , IntegralKernel ret) {
  if( ret == null )
    ret = new IntegralKernel(2);
  ret.blocks[0].set(-r, -r, 0, r);
  ret.blocks[1].set(0,-r,r,r);
  ret.scales[0] = -1;
  ret.scales[1] = 1;
  return ret;
}
origin: org.boofcv/boofcv-ip

/**
 * Creates a kernel for the Haar wavelet "centered" around the target pixel.
 *
 * @param r Radius of the box.  width is 2*r
 * @return Kernel for a Haar y-axis wavelet.
 */
public static IntegralKernel kernelHaarY( int r , IntegralKernel ret) {
  if( ret == null )
    ret = new IntegralKernel(2);
  ret.blocks[0].set(-r,-r,r,0);
  ret.blocks[1].set(-r,0,r,r);
  ret.scales[0] = -1;
  ret.scales[1] = 1;
  return ret;
}
origin: org.boofcv/recognition

/**
 * Computes the confidence for all the regions which pass the fern test
 */
protected void computeTemplateConfidence() {
  double max = 0;
  for( int i = 0; i < fernRegions.size(); i++ ) {
    ImageRectangle region = fernRegions.get(i);
    double confidence = template.computeConfidence(region);
    max = Math.max(max,confidence);
    if( confidence < config.confidenceThresholdUpper)
      continue;
    TldRegion r = candidateDetections.grow();
    r.connections = 0;
    r.rect.set(region);
    r.confidence = confidence;
  }
}
origin: org.boofcv/boofcv-swing

private void addDetections( FastQueue<TldRegion> detections ) {
  this.detections.reset();
  for( TldRegion r : detections.toList() ){
    TldRegion a = this.detections.grow();
    a.confidence = r.confidence;
    a.rect.set(r.rect);
  }
}
origin: org.boofcv/visualize

private void addDetections( FastQueue<TldRegion> detections ) {
  this.detections.reset();
  for( TldRegion r : detections.toList() ){
    TldRegion a = this.detections.grow();
    a.confidence = r.confidence;
    a.rect.set(r.rect);
  }
}
origin: org.boofcv/recognition

  o.connections = ra.connections;
  o.confidence = ra.confidence;
  o.rect.set(ra.rect);
} else if( ra.connections == 0 ) {
  System.out.println("Not a maximum but has zero connections?");
boofcv.structImageRectangle

Most used methods

  • set
  • <init>
  • area
  • getHeight
  • getWidth
  • intersection

Popular in Java

  • Updating database using SQL prepared statement
  • findViewById (Activity)
  • getSystemService (Context)
  • startActivity (Activity)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now