Apr-06-2021, 01:50 PM
I'd use Pandas, largely as it is simple to select data according to your preference.
import pandas as pd sky = [[20,20,150,200,230],[21,20,0,0,0],[22,20,100,110,90],[23,20,200,220,220],[24,20,210,210,210]] colnames = ['x','y','red','green','blue'] df = pd.DataFrame(sky,columns=colnames) df.head()
Output: x y red green blue
0 20 20 150 200 230
1 21 20 0 0 0
2 22 20 100 110 90
3 23 20 200 220 220
4 24 20 210 210 210
This sets up the dataframe with columns for x and y coordinates and columns for the RGB readings of the pixels. Selecting bright ones is then simple asdfbright = df[df.red+df.green+df.blue > 600] dfbright.head()
Output: x y red green blue
3 23 20 200 220 220
4 24 20 210 210 210