diff --git a/example5.png b/example5.png index 0c7d55c..ccaa7df 100644 Binary files a/example5.png and b/example5.png differ diff --git a/frame0.png b/frame0.png new file mode 100644 index 0000000..64ae471 Binary files /dev/null and b/frame0.png differ diff --git a/frame1.png b/frame1.png new file mode 100644 index 0000000..bd6b5a2 Binary files /dev/null and b/frame1.png differ diff --git a/frame10.png b/frame10.png new file mode 100644 index 0000000..95827d9 Binary files /dev/null and b/frame10.png differ diff --git a/frame11.png b/frame11.png new file mode 100644 index 0000000..fa7a755 Binary files /dev/null and b/frame11.png differ diff --git a/frame12.png b/frame12.png new file mode 100644 index 0000000..43653e9 Binary files /dev/null and b/frame12.png differ diff --git a/frame13.png b/frame13.png new file mode 100644 index 0000000..eb8c5f9 Binary files /dev/null and b/frame13.png differ diff --git a/frame14.png b/frame14.png new file mode 100644 index 0000000..2cc8248 Binary files /dev/null and b/frame14.png differ diff --git a/frame15.png b/frame15.png new file mode 100644 index 0000000..fdbbce9 Binary files /dev/null and b/frame15.png differ diff --git a/frame16.png b/frame16.png new file mode 100644 index 0000000..24789c4 Binary files /dev/null and b/frame16.png differ diff --git a/frame17.png b/frame17.png new file mode 100644 index 0000000..439147e Binary files /dev/null and b/frame17.png differ diff --git a/frame18.png b/frame18.png new file mode 100644 index 0000000..2227ec7 Binary files /dev/null and b/frame18.png differ diff --git a/frame19.png b/frame19.png new file mode 100644 index 0000000..9cf143a Binary files /dev/null and b/frame19.png differ diff --git a/frame2.png b/frame2.png new file mode 100644 index 0000000..d804ec6 Binary files /dev/null and b/frame2.png differ diff --git a/frame20.png b/frame20.png new file mode 100644 index 0000000..74d638c Binary files /dev/null and b/frame20.png differ diff --git a/frame21.png b/frame21.png new file mode 100644 index 0000000..c7b9422 Binary files /dev/null and b/frame21.png differ diff --git a/frame22.png b/frame22.png new file mode 100644 index 0000000..73bc1c2 Binary files /dev/null and b/frame22.png differ diff --git a/frame23.png b/frame23.png new file mode 100644 index 0000000..0b50e2e Binary files /dev/null and b/frame23.png differ diff --git a/frame24.png b/frame24.png new file mode 100644 index 0000000..54a95ba Binary files /dev/null and b/frame24.png differ diff --git a/frame25.png b/frame25.png new file mode 100644 index 0000000..382d9cb Binary files /dev/null and b/frame25.png differ diff --git a/frame26.png b/frame26.png new file mode 100644 index 0000000..a09cd4f Binary files /dev/null and b/frame26.png differ diff --git a/frame27.png b/frame27.png new file mode 100644 index 0000000..bebb7de Binary files /dev/null and b/frame27.png differ diff --git a/frame28.png b/frame28.png new file mode 100644 index 0000000..78cac13 Binary files /dev/null and b/frame28.png differ diff --git a/frame29.png b/frame29.png new file mode 100644 index 0000000..2555f8d Binary files /dev/null and b/frame29.png differ diff --git a/frame3.png b/frame3.png new file mode 100644 index 0000000..1bcf7a0 Binary files /dev/null and b/frame3.png differ diff --git a/frame30.png b/frame30.png new file mode 100644 index 0000000..fc9c39e Binary files /dev/null and b/frame30.png differ diff --git a/frame31.png b/frame31.png new file mode 100644 index 0000000..812cf14 Binary files /dev/null and b/frame31.png differ diff --git a/frame32.png b/frame32.png new file mode 100644 index 0000000..e291220 Binary files /dev/null and b/frame32.png differ diff --git a/frame33.png b/frame33.png new file mode 100644 index 0000000..e97bd00 Binary files /dev/null and b/frame33.png differ diff --git a/frame34.png b/frame34.png new file mode 100644 index 0000000..72f9084 Binary files /dev/null and b/frame34.png differ diff --git a/frame35.png b/frame35.png new file mode 100644 index 0000000..ff5ddc5 Binary files /dev/null and b/frame35.png differ diff --git a/frame36.png b/frame36.png new file mode 100644 index 0000000..aecc55e Binary files /dev/null and b/frame36.png differ diff --git a/frame37.png b/frame37.png new file mode 100644 index 0000000..8a38ccb Binary files /dev/null and b/frame37.png differ diff --git a/frame38.png b/frame38.png new file mode 100644 index 0000000..acd0ff4 Binary files /dev/null and b/frame38.png differ diff --git a/frame39.png b/frame39.png new file mode 100644 index 0000000..15e7e60 Binary files /dev/null and b/frame39.png differ diff --git a/frame4.png b/frame4.png new file mode 100644 index 0000000..855750c Binary files /dev/null and b/frame4.png differ diff --git a/frame40.png b/frame40.png new file mode 100644 index 0000000..42e98e8 Binary files /dev/null and b/frame40.png differ diff --git a/frame41.png b/frame41.png new file mode 100644 index 0000000..bf54769 Binary files /dev/null and b/frame41.png differ diff --git a/frame42.png b/frame42.png new file mode 100644 index 0000000..c42c7e0 Binary files /dev/null and b/frame42.png differ diff --git a/frame43.png b/frame43.png new file mode 100644 index 0000000..ecceffc Binary files /dev/null and b/frame43.png differ diff --git a/frame44.png b/frame44.png new file mode 100644 index 0000000..0246e36 Binary files /dev/null and b/frame44.png differ diff --git a/frame45.png b/frame45.png new file mode 100644 index 0000000..31d0bc1 Binary files /dev/null and b/frame45.png differ diff --git a/frame46.png b/frame46.png new file mode 100644 index 0000000..209602a Binary files /dev/null and b/frame46.png differ diff --git a/frame47.png b/frame47.png new file mode 100644 index 0000000..3926ebc Binary files /dev/null and b/frame47.png differ diff --git a/frame48.png b/frame48.png new file mode 100644 index 0000000..40291c7 Binary files /dev/null and b/frame48.png differ diff --git a/frame49.png b/frame49.png new file mode 100644 index 0000000..c17dd88 Binary files /dev/null and b/frame49.png differ diff --git a/frame5.png b/frame5.png new file mode 100644 index 0000000..d9c58ae Binary files /dev/null and b/frame5.png differ diff --git a/frame50.png b/frame50.png new file mode 100644 index 0000000..23ea643 Binary files /dev/null and b/frame50.png differ diff --git a/frame51.png b/frame51.png new file mode 100644 index 0000000..8a57d4d Binary files /dev/null and b/frame51.png differ diff --git a/frame52.png b/frame52.png new file mode 100644 index 0000000..8020591 Binary files /dev/null and b/frame52.png differ diff --git a/frame53.png b/frame53.png new file mode 100644 index 0000000..670791d Binary files /dev/null and b/frame53.png differ diff --git a/frame54.png b/frame54.png new file mode 100644 index 0000000..7cc3d57 Binary files /dev/null and b/frame54.png differ diff --git a/frame55.png b/frame55.png new file mode 100644 index 0000000..868acca Binary files /dev/null and b/frame55.png differ diff --git a/frame56.png b/frame56.png new file mode 100644 index 0000000..c5ba09d Binary files /dev/null and b/frame56.png differ diff --git a/frame57.png b/frame57.png new file mode 100644 index 0000000..96f1aa8 Binary files /dev/null and b/frame57.png differ diff --git a/frame58.png b/frame58.png new file mode 100644 index 0000000..eef1c16 Binary files /dev/null and b/frame58.png differ diff --git a/frame59.png b/frame59.png new file mode 100644 index 0000000..9d1b0ca Binary files /dev/null and b/frame59.png differ diff --git a/frame6.png b/frame6.png new file mode 100644 index 0000000..e0c2171 Binary files /dev/null and b/frame6.png differ diff --git a/frame7.png b/frame7.png new file mode 100644 index 0000000..2fed0a9 Binary files /dev/null and b/frame7.png differ diff --git a/frame8.png b/frame8.png new file mode 100644 index 0000000..ca15fa8 Binary files /dev/null and b/frame8.png differ diff --git a/frame9.png b/frame9.png new file mode 100644 index 0000000..7ae5f6f Binary files /dev/null and b/frame9.png differ diff --git a/mymovie.avi b/mymovie.avi new file mode 100644 index 0000000..ddb3434 Binary files /dev/null and b/mymovie.avi differ diff --git a/recursive_art.py b/recursive_art.py index 1636559..f3a1370 100644 --- a/recursive_art.py +++ b/recursive_art.py @@ -37,7 +37,7 @@ def build_random_function(min_depth, max_depth): return functions[random.randint(7, 8)] -def evaluate_random_function(f, x, y): +def evaluate_random_function(f, x, y, t): """ Evaluate the random function f with input x Representation of the function f is defined in the assignment writeup @@ -55,28 +55,28 @@ def evaluate_random_function(f, x, y): functions = {1: "prod", 2: "avg", 3: "cos_pi", 4: "sin_pi", 5: "arctan", 6: "step", 7: "x", 8: "y"} if len(f) == 3: - eval1 = evaluate_random_function(f[1], x, y) - eval2 = evaluate_random_function(f[2], x, y) + eval1 = evaluate_random_function(f[1], x, y,t) + eval2 = evaluate_random_function(f[2], x, y,t) elif len(f) == 2: - eval1 = evaluate_random_function(f[1], x, y) + eval1 = evaluate_random_function(f[1], x, y,t) if f[0] == functions[1]: return eval1 * eval2 elif f[0] == functions[2]: - return 0.5 * (eval1 + eval2) + return 0.5 * (eval1 + eval2) elif f[0] == functions[3]: - return math.cos(math.pi * eval1) + return math.cos(math.pi * eval1 + t) elif f[0] == functions[4]: - return math.sin(math.pi * eval1) + return math.sin(math.pi * eval1 + t) elif f[0] == functions[5]: return math.atan(eval1)/(math.pi)/2 elif f[0] == functions[6]: - if eval1 > 0: - return 1 - elif eval1 == 0: - return 0 - elif eval1 < 0: - return -1 + #if eval1 > 0: + return 1 + # elif eval1 == 0: + # return 0 + # elif eval1 < 0: + # return -1 elif f[0] == functions[7]: return x elif f[0] == functions[8]: @@ -158,33 +158,33 @@ def test_image(filename, x_size=350, y_size=350): im.save(filename) -def generate_art(filename, x_size=350, y_size=350): +def generate_art(filename, x_size=350, y_size=350, frames = 5): """ Generate computational art and save as an image file. filename: string filename for image (should be .png) x_size, y_size: optional args to set image dimensions (default: 350) """ - # Functions for red, green, and blue channels - where the magic happens! - red_function = build_random_function(8, 8) - green_function = build_random_function(8, 8) - blue_function = build_random_function(8, 8) - - # Create image and loop over all pixels - im = Image.new("RGB", (x_size, y_size)) - pixels = im.load() - for i in range(x_size): - for j in range(y_size): - print "i: " + str(i) - print "j: " + str(j) - x = remap_interval(i, 0, x_size, -1, 1) - y = remap_interval(j, 0, y_size, -1, 1) - pixels[i, j] = ( - color_map(evaluate_random_function(red_function, x, y)), - color_map(evaluate_random_function(green_function, x, y)), - color_map(evaluate_random_function(blue_function, x, y)) - ) - - im.save(filename) + + # Functions for red, green, and blue channels - where the magic happens! + red_function = build_random_function(5, 8) + green_function = build_random_function(3, 8) + blue_function = build_random_function(2, 8) + for t in xrange(frames): + # Create image and loop over all pixels + im = Image.new("RGB", (x_size, y_size)) + pixels = im.load() + for i in range(x_size): + for j in range(y_size): + x = remap_interval(i, 0, x_size, -1, 1) + y = remap_interval(j, 0, y_size, -1, 1) + pixels[i, j] = ( + color_map(evaluate_random_function(red_function, x, y,t)), + color_map(evaluate_random_function(green_function, x, y,t)), + color_map(evaluate_random_function(blue_function, x, y,t)) + ) + + im.save(filename + str(t)+ '.png') + print 'done' + str(t) if __name__ == '__main__': @@ -193,7 +193,7 @@ def generate_art(filename, x_size=350, y_size=350): # Create some computational art! # TODO: Un-comment the generate_art function call after you # implement remap_interval and evaluate_random_function - generate_art("example5.png", 350, 350) + generate_art("frame", 100, 100, 60) # Test that PIL is installed correctly # TODO: Comment or remove this function call after testing PIL install # test_image("noise.png")