点运算符C++

cha*_*les -2 c++ image-processing cimg

我使用库CImg有以下代码进行图像处理.

for (int y = 0; y < height; y++)
  for (int x = 0; x < width; x++) { 
      width = in.
      float weight = strength*x*(xmax-x)*y*(ymax-y)/(xmax*xmax)/(ymax*ymax);
      int new_x  = (int) ((1-weight)*x + weight*      y * xmax/ymax);
      int new_y  = (int) ((1-weight)*y + weight*(xmax-x)* ymax/xmax);
      out(x,y) = in(new_x,new_y);
  }
Run Code Online (Sandbox Code Playgroud)

循环开始时的下一行是什么意思?

  width = in.
Run Code Online (Sandbox Code Playgroud)

'width'和'in'分别是一个int和之前声明的CImg对象.

谢谢.

int*_*jay 6

该行是语法错误,不会通过编译.它很可能被意外粘贴在那里.

谷歌搜索代码给出了这个,它包含没有该行的相同代码:

for (int y = 0; y < height; y++)
  for (int x = 0; x < width; x++) {
    float weight = strength*x*(xmax-x)*y*(ymax-y)/(xmax*xmax)/(ymax*ymax);
    int new_x  = (int) ((1-weight)*x + weight*      y * xmax/ymax);
    int new_y  = (int) ((1-weight)*y + weight*(xmax-x)* ymax/xmax);
    out(x,y) = in(new_x,new_y);
  }
Run Code Online (Sandbox Code Playgroud)

代码的另一部分包含行const int width = in.dimx();,这可能是意外复制/粘贴的来源.