You are here

function _focal_point_smartcrop_sum_entropies in Focal Point 7

Calculate the entropy of several adjacent areas.

1 call to _focal_point_smartcrop_sum_entropies()
_focal_point_smartcrop_get_best_first_area in ./focal_point.smartcrop.inc
Calculate the best area to use based on its entropy.

File

./focal_point.smartcrop.inc, line 113

Code

function _focal_point_smartcrop_sum_entropies($area_entropies, $first_area, $target_areas_counts) {
  $entropy = 0;
  for ($i = 0; $i < $target_areas_counts[0]; $i++) {
    for ($j = 0; $j < $target_areas_counts[1]; $j++) {
      $entropy += $area_entropies[$first_area[0] + $i][$first_area[1] + $j];
    }
  }
  return $entropy;
}