Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ code 2d block

for(size_t bx = 0; bx < width;  bx += block_width)
for(size_t by = 0; by < height; by += block_height) {
  float sum = 0;
  for(size_t x = 0; x < block_width; ++x)
  for(size_t y = 0; y < block_height; ++y) {
    sum += array[bx + x][by + y];
  }
  average = sum / (block_width * block_height);
  new_array[bx][by] = average;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #code #block
ADD COMMENT
Topic
Name
3+5 =