Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

34
LINES

< > BotCompany Repo | #1033569 - TruncatedIBWIntegralImage [forget sub-pixels]

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (11454L) is out of date.

// forgets sub-pixels
// TODO: fix
sclass TruncatedIBWIntegralImage is IBWIntegralImage {
  IBWIntegralImage img;
  int w, h;

  *(IBWIntegralImage *img) {
    w = img.getWidth();
    h = img.getHeight();
  }
    
  public int getWidth() { ret w; }
  public int getHeight() { ret h; }
    
  // normal range [0; pixelCount*256)
  public double getIIValue(dbl x, dbl y) {
    int xFloor = ifloor(x), yFloor = ifloor(y);
    
    // get value at top left corner of pixel
    double val = img.getIIValue(xFloor, yFloor);
    
    // at integer coordinate? done
    if (xFloor == x && yFloor == y)
      ret val;
      
    double xFrac = x-xFloor, yFrac = y-yFloor;
    
    // at non-integer coordinate, perform subpixel calculation
    double area = xFrac*yFrac;
    double pixelColor = img.getPixelBrightness(xFloor+1, yFloor+1);
    
    ret val+area*pixelColor;
  }
}

Author comment

Began life as a copy of #1033566

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033569
Snippet name: TruncatedIBWIntegralImage [forget sub-pixels]
Eternal ID of this version: #1033569/9
Text MD5: 013b5765cb29eafbdc0bb625ec07fa2f
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-05 04:58:20
Source code size: 902 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 22 / 51
Version history: 8 change(s)
Referenced in: [show references]