UNPKG

image-js

Version:

Image processing and manipulation in JavaScript

24 lines (23 loc) 615 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = mean; var _histogram = require("../../util/histogram"); /** * Returns an array with the average value of each channel * @memberof Image * @instance * @return {number[]} Array having has size the number of channels */ function mean() { let histograms = this.getHistograms({ maxSlots: this.maxValue + 1 }); let result = new Array(histograms.length); for (let c = 0; c < histograms.length; c++) { let histogram = histograms[c]; result[c] = (0, _histogram.mean)(histogram); } return result; }