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).

1  
static IBWIntegralImage scaledIBWIntegralImage(int w, IBWIntegralImage img) {
2  
  ret scaledIBWIntegralImage(img, w);
3  
}
4  
5  
static IBWIntegralImage scaledIBWIntegralImage(IBWIntegralImage img, int w) {
6  
  ret scaledIBWIntegralImage(img, w, iround(w*img.getHeight()/(double) img.getWidth()));
7  
}
8  
9  
static IBWIntegralImage scaledIBWIntegralImage(IBWIntegralImage img, int w, int h) {
10  
  ret new IBWIntegralImage {
11  
    int w1 = img.getWidth(), h1 = img.getHeight();
12  
    double factorX = doubleRatio(w1, w);
13  
    double factorY = doubleRatio(h1, h);
14  
    double areaCorrection = 1/(factorX*factorY);
15  
    
16  
    public int getWidth() { ret w; }
17  
    public int getHeight() { ret h; }
18  
    
19  
    // get value for 1 channel
20  
    // normal range [0; pixelCount*256)
21  
    // TODO: test
22  
    public double getIIValue(double x, double y) {
23  
      ret img.getIIValue(x*factorX, y*factorY)*areaCorrection;
24  
    }
25  
  };
26  
}

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: 254 / 407
Version history: 10 change(s)
Referenced in: [show references]