Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Average values do not work #2

Open
samvanh opened this issue Oct 21, 2019 · 0 comments
Open

Average values do not work #2

samvanh opened this issue Oct 21, 2019 · 0 comments

Comments

@samvanh
Copy link

samvanh commented Oct 21, 2019

'left-average' option does not seem to work, 'right-average' option does work.
Suppose that it has something to do with the different implementation.

This does work:
elif position == 'right-average': pixels = layer1['right'] r_sum, g_sum, b_sum = 0,0,0 for i in range(0,len(pixels)): pixel = str(int(i)) r_sum = r_sum + ((pixels[pixel]['r']) ** 2) g_sum = g_sum + ((pixels[pixel]['g']) ** 2) b_sum = b_sum + ((pixels[pixel]['b']) ** 2) r = int((r_sum/len(pixels))**(1/2)) g = int((g_sum/len(pixels))**(1/2)) b = int((b_sum/len(pixels))**(1/2))

This does not:
elif position == 'left-average': pixels = layer1['left'] r_sum, g_sum, b_sum = 0,0,0 for pixel in pixels: r_sum = r_sum + ((pixel['r']) ** 2) g_sum = g_sum + ((pixel['g']) ** 2) b_sum = b_sum + ((pixel['b']) ** 2) r = int((r_sum/len(pixels))*(1/2)) g = int((g_sum/len(pixels))*(1/2)) b = int((b_sum/len(pixels))*(1/2))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant