Bottom Page

Thread Rating:
  • 3 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 grayscale image processing
#11
You still have to find the maximum yourself.
As Mekire already said: This solution is slow.

from PIL import Image
img  = Image.open('grey.jpg')

for row in range(img.height):
    counter = 0
    for col in range(img.width):
        pixel = img.getpixel((col,row))
        red   = pixel[0]; green = pixel[1]; blue  = pixel[2]
        grey  = (red + green + blue) // 3
        if grey > 200:
            counter += 1
    if counter != 0:
        print("row %d: %d" % (row, counter))
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Pillow Image Processing matteusbeus 2 1,167 Nov-02-2017, 03:07 PM
Last Post: DeaD_EyE

Forum Jump:


Users browsing this thread: 1 Guest(s)