Output the standard deviation of the image as a servo position.

I have a simple task to read the standard deviation of an image histogram (preferably colour) of a low frame rate window size (yet to be determined) and out put it as a servo signal (1-2ms pulse)

I am recovering from a stroke and reading is still difficult, i have been able to find the histogram command and watch the histogram output and i have been able to run and manipulate the servo output code.
I am having problems reading about the standard deviation output from the histogram command.

I thank anyone that can help

Hi, just do something like:

stdev = img.get_stats().stdev() # 0-255
servo_motor.angle(max(min(stdev, 180), 0) - 90)


Note that for color we return the LAB histogram and not RGB. If you want RGB you can extract a channel of the image using: http://docs.openmv.io/library/omv.image.html?highlight=stdev#image.image.to_grayscale and then calling the stats method on that image channel.

Thanks, i will try that after dinner.

I only got here and got lost
Computes the mean, median, mode, standard deviation, min, max, lower quartile, and upper quartile of each color channel in the histogram and returns a statistics object.

You may also use histogram.statistics() and histogram.get_stats() as aliases for this method.

Perfect, thanks for that.