November 2018
Intermediate to advanced
492 pages
12h 19m
English
We can use the stat module to compute the basic statistics (mean, median, standard deviation of pixel values of different channels, and so on) of an image, as shown in the following:
s = stat.Stat(im)print(s.extrema) # maximum and minimum pixel values for each channel R, G, B# [(4, 255), (0, 255), (0, 253)]print(s.count)# [154020, 154020, 154020]print(s.mean)# [125.41305674587716, 124.43517724970783, 68.38463186599142]print(s.median)# [117, 128, 63]print(s.stddev)# [47.56564506512579, 51.08397900881395, 39.067418896260094]
Read now
Unlock full access