(image processing code) |
(No difference)
|
Revision as of 12:49, 30 April 2015
Image Processing
Foreground Separation
Simple Foreground Separation with Processing.
img = loadImage("leaves.jpg") size(800, 600) # function as for loop def markit(): for i in range(len(img.pixels)): if brightness(img.pixels[i]) > 100: img.pixels[i] = color(0) else: img.pixels[i] = color(255) # function as list comprehension def markit2(): img.pixels = [color(0) if brightness(p) > 100 else color(255) for p in img.pixels ] # modify image img.loadPixels() markit2() img.updatePixels() # show image image(img, 0, 0, width, height)