Hello all,
i thought my problem was simple but i turn around and if you could help it will be great.
I would like to have mean or median of RGB color but i have different values than rgb chart values at bottom right of oepnmv ide.
Here is the code :
import sensor,image,time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time=2000)
print("---------------------------------" )
while True :
img=sensor.snapshot()
istat=img.get_histogram().statistics()
print("L value (mean, median) :",istat.l_mean(),istat.l_median())
print("A value (mean, median) :",istat.a_mean(),istat.a_median())
print("B vlaue (mean, median) :",istat.b_mean(),istat.b_median())
RGBmedian=image.lab_to_rgb((istat.l_median(),istat.a_median(),istat.b_median()))
print("")
RGBmean=image.lab_to_rgb((istat.l_mean(),istat.a_mean(),istat.b_mean()))
print("R value (mean, median) :",RGBmean[0],RGBmedian[0])
print("G value (mean, median) :",RGBmean[1],RGBmedian[1])
print("B vlaue (mean, median) :",RGBmean[2],RGBmedian[2])
print("---------------------------------")
time.sleep(3000)
LAB value are nearly the same but not rgb, specially the red median ???
Thanks for help,