1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

photobot.Layer.statistics()

Syntax

canvas.layers[i].statistics()

Description

Returns a number of statistics of layer i's pixel data. These are:

  • extrema: a list of 2-tuples giving the minimum and maximum pixel value for each band (red/green/blue/alpha).
  • count: a list giving the total number of pixels for each band.
  • sum: a list giving the sum of all pixels for each band.
  • sum2: a list giving the squared sum of all pixels for each band.
  • mean: a list giving the average pixel value for each band.
  • median: a list giving the median pixel value for each band.
  • rms: a list giving the root-median-square pixel value for each band.
  • var: a list giving the variance pixel value for each band.
  • stddev: a list giving the standard deviation pixel value for each band.

Example

import photobot
canvas = photobot.canvas(100,100)
canvas.layer("robot.jpg")
stats = canvas.layers[1].statistics()
print stats.mean
>>>[68.778499999999994, 57.926200000000001, 46.7866, 255.0]