lib/operation.js
function median (size) {
  if (!is.defined(size)) {
    // No arguments: default to 3x3
    this.options.medianSize = 3;
  } else if (is.integer(size) && is.inRange(size, 1, 1000)) {
    // Numeric argument: specific sigma
    this.options.medianSize = size;
  } else {
    throw new Error('Invalid median size ' + size);
  }
  return this;
}
function median (size) {
  if (!is.defined(size)) {
    // No arguments: default to 3x3
    this.options.medianSize = 3;
  } else if (is.integer(size) && is.inRange(size, 1, 1000)) {
    // Numeric argument: specific sigma
    this.options.medianSize = size;
  } else {
    throw new Error('Invalid median size ' + size);
  }
  return this;
}
function median ( size ) { if ( ! is . defined ( size ) ) { // No arguments: default to 3x3 this . options . medianSize = 3 ; } else if ( is . integer ( size ) && is . inRange ( size , 1 , 1000 ) ) { // Numeric argument: specific sigma this . options . medianSize = size ; } else { throw new Error ( 'Invalid median size ' + size ) ; } return this ; }
Apply median filter.
When used without parameters the default window is 3x3.
@param {Number} [size=3] square mask size: size x size
@returns {Sharp}
@throws {Error} Invalid parameters
Apply median filter . When used without parameters the default window is 3x3 .