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

26
LINES

< > BotCompany Repo | #1027206 // scaledIBWIntegralImage - broken. use scaledIntegralImage instead

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

Libraryless. Click here for Pure Java version (11387L/66K).

static IBWIntegralImage scaledIBWIntegralImage(int w, IBWIntegralImage img) {
  ret scaledIBWIntegralImage(img, w);
}

static IBWIntegralImage scaledIBWIntegralImage(IBWIntegralImage img, int w) {
  ret scaledIBWIntegralImage(img, w, iround(w*img.getHeight()/(double) img.getWidth()));
}

static IBWIntegralImage scaledIBWIntegralImage(IBWIntegralImage img, int w, int h) {
  ret new IBWIntegralImage {
    int w1 = img.getWidth(), h1 = img.getHeight();
    double factorX = doubleRatio(w1, w);
    double factorY = doubleRatio(h1, h);
    double areaCorrection = 1/(factorX*factorY);
    
    public int getWidth() { ret w; }
    public int getHeight() { ret h; }
    
    // get value for 1 channel
    // normal range [0; pixelCount*256)
    // TODO: test
    public double getIIValue(double x, double y) {
      ret img.getIIValue(x*factorX, y*factorY)*areaCorrection;
    }
  };
}

Author comment

Began life as a copy of #1022980

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027206
Snippet name: scaledIBWIntegralImage - broken. use scaledIntegralImage instead
Eternal ID of this version: #1027206/11
Text MD5: 7e041d65002593f686e9e1ef533cc527
Transpilation MD5: 6ad7353d2a41937a45f3f6db2e089dc6
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-03 17:41:26
Source code size: 910 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 253 / 404
Version history: 10 change(s)
Referenced in: [show references]