I am looking for a pythonic way to make a list of tuples that looks at a range of points determines if the pixel information at those points meets criteria and if so adds to the list.
I have the following line of code, which I know is incorrect but I hope it explains what i'm trying to accomplish. the "h,s,v = img[iy,((x//2)-ix)]" part is not correct because I don't think you can not assign h,s,v how I currently have the code.
how do you assign h,s,v = img[] inside a for loop?
pointlist = [h,s,v = img[iy,((x//2)-ix)] for ix in range(x//2) for iy in ylist if any((hm-hsm)<h<(hm+hsm) and (sm-ssm)<s<(sm+ssm) and (vm-vsm)<v<(vm+vsm) for hm,sm,vm,hsm,ssm,vsm in csample)]
Another way to maybe write this would be:
csample = (60,30,100,15,15,25)
for iy in ylist:
for (x//2)-ix for ix in range(x//2):
h,s,v = img[iy,ix]
if any((hm-hsm)<h<(hm+hsm) and (sm-ssm)<s<(sm+ssm) and (vm-vsm)<v<(vm+vsm) for hm,sm,vm,hsm,ssm,vsm in csample)