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

17
LINES

< > BotCompany Repo | #1024729 // img_cubedDistanceFromColor_withGain (gain before cubing)

JavaX fragment (include)

static BWImage img_cubedDistanceFromColor_withGain(RGBImage img, RGB color, double gain) {
  int w = img.getWidth(), h = img.getHeight();
  int col = color.getInt();
  BWImage bw = new(w, h);
  for y to h:
    for x to w:
      bw.setPixel(x, y, pow(rgbDiff(img.getInt(x, y), col)*(float) gain, 3));
  ret bw;
}

static BWImage img_cubedDistanceFromColor_withGain(BufferedImage img, RGB color, double gain) {
  ret img_cubedDistanceFromColor_withGain(RGBImage(img), color, gain);
}

static BWImage img_cubedDistanceFromColor_withGain(RGB color, double gain, BufferedImage img) {
  ret img_cubedDistanceFromColor_withGain(img, color, gain);
}

Author comment

Began life as a copy of #1024725

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1024729
Snippet name: img_cubedDistanceFromColor_withGain (gain before cubing)
Eternal ID of this version: #1024729/3
Text MD5: 8adbbf07e185c6f18afd129166fae648
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-24 15:14:01
Source code size: 657 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 142 / 175
Version history: 2 change(s)
Referenced in: [show references]