User:Renee Oldemonnikhof/technicalcourse

From XPUB & Lens-Based wiki
< User:Renee Oldemonnikhof
Revision as of 20:37, 23 September 2010 by Migratebot (talk | contribs) (Created page with "= Technical course trimester 1 = ---- '''Assignment for next week/ 06/10/2009''' * Start with a single image -- this is your "input". Make a copy of your file and call it...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Technical course trimester 1


Assignment for next week/ 06/10/2009

  • Start with a single image -- this is your "input". Make a copy of your file and call it "image0001.png" (or "image0001.jpg") (remember to zero-pad your file names). Use ImageMagick's commands to alter this image in some way, transforming it, extracting some portion, and give the result the name "image0002.png". Continue in this way, each time using images already created (using image0001 and/or image0002 to make image0003, and so on). Finally, use ImageMagick to assemble the sequence of images into an animation. Save all of your commands from the terminal to a single text file, and save it as something like "image.sh".
renee@renee-laptop:~/Pictures$ display new.JPG

renee@renee-laptop:~/Pictures$ mogrify -resize 800x800 new.JPG

convert new.JPG  -crop 27x strip%2d.png

convert -dispose background strip*.png slide.gif

convert -dispose background strip*.png bar*pnseg slide.gif

convert -delay 20 strip*.png -dispose 2 bar*.png slide.gif



User Renee Oldemonnikhof technicalcourse slide.gif

Assignment for next week/ 12/10/2009

  • Produce a "song" using sox & python loops. Produce two "songs", one with "sequential loops", and one with a nested loop.

Sequential loop:: song.wav

#!/usr/bin/env python

from os import system

for i in range(3):

    system("cat 01.raw >> song.raw")
    system("cat sweep_down.raw >> song.raw")
    system("cat beep.raw >> song.raw")
    system("cat ch.raw >> song.raw")
    system("cat 02.raw >> song.raw")
    system("cat ch.raw >> song.raw")
    system("cat song.raw >> song.raw")
    system("cat sweep_down.raw >> song.raw")
    system("cat 02.raw >> song.raw")

system("sox --rate 44100 --bits 16 --channels 2 --encoding signed-integer song.raw song.wav")

system("rm song.raw")


Nested loop:

#!/usr/bin/env python

from os import system

for i in range(3):
    system("cat 01.raw >> nested.raw")
    system("cat 03.raw >> nested.raw")
    system("cat sweep_down.raw >> song.raw")

    for i in range(3):
        system("cat 02.raw >> nested.raw")
        system("cat 04.raw >> nested.raw")
        system("cat ch.raw >> song.raw")

# print("goodbye")

system("sox --rate 44100 --bits 16 --channels 2 --encoding signed-integer nested.raw nested.wav")
system("rm nested.raw")
system("play nested.wav")



Assignment for next week/ 27/10/2009

  • To be completed after the break: Create a "command-line movie" using ImageMagick, sox, and ffmpeg. Reading: Chapter 1 of ThinkPython.
- mkdir first_tech_assignment
- cd first_tech_assignment
- cd Videos
- cd fabmovie.avi
- cd Documents 
- cd first_tech_assignment

- ffmpeg -i ~/Videos/fabmovie.avi -an -y -ss 0:00:00 -t 00:00:01 -f image2 frame%04d.png

- convert frame0001.png -background black -chop  20x20+0+0 -splice 460x460+0+0 frame0002.png
- convert frame0001.png -background black -chop  40x40+0+0 -splice 40x40+0+0frame0003.png
- convert frame0001.png -background black -chop  80x80+0+0 -splice 80x80+0+0 frame0004.png
- convert frame0001.png -background black -chop  100x100+0+0 -splice 100x100+0+0 frame0005.png
- convert frame0001.png -background black -chop  120x120+0+0 -splice 120x120+0+0 frame0006.png
- convert frame0001.png -background black -chop  140x149+0+0 -splice 140x140+0+0 frame0007.png
- convert frame0001.png -background black -chop  160x160+0+0 -splice 160x160+0+0 frame0008.png
- convert frame0001.png -background black -chop  180x180+0+0 -splice 180x180+0+0 frame0009.png
- convert frame0001.png -background black -chop  200x200+0+0 -splice 200x200+0+0 frame0010.png
- convert frame0001.png -background black -chop  220x220+0+0 -splice 220x220+0+0 frame0011.png
- convert frame0001.png -background black -chop  240x240+0+0 -splice 240x240+0+0 frame0012.png
- convert frame0001.png -background black -chop  240x240+0+0 -splice 240x240+0+0 frame0013.png
- convert frame0001.png -background black -chop  260x260+0+0 -splice 260x260+0+0 frame0014.png
- convert frame0001.png -background black -chop  280x280+0+0 -splice 280x280+0+0 frame0015.png
- convert frame0001.png -background black -chop  280x280+0+0 -splice 280x280+0+0 frame0016.png
- convert frame0001.png -background black -chop  300x300+0+0 -splice 300x300+0+0 frame0017.png
- convert frame0001.png -background black -chop  320x320+0+0 -splice 320x320+0+0 frame0018.png
- convert frame0001.png -background black -chop  340x340+0+0 -splice 340x340+0+0 frame0019.png
- convert frame0001.png -background black -chop  360x360+0+0 -splice 360x360+0+0 frame0020.png
- convert frame0001.png -background black -chop  380x380+0+0 -splice 380x380+0+0 frame0021.png
- convert frame0001.png -background black -chop  400x400+0+0 -splice 400x400+0+0 frame0022.png
- convert frame0001.png -background black -chop  420x420+0+0 -splice 420x420+0+0 frame0023.png
- convert frame0001.png -background black -chop  440x440+0+0 -splice 440x440+0+0 frame0024.png
- convert frame0001.png -background black -chop  460x460+0+0 -splice 460x460+0+0 frame0025.png

ffmpeg -y -r 30 -b 2000 -sameq -i frame%04d.png test.mpeg


Second Technical assignment!/ 24/11/2009

import pygame, sys

pygame.init()
screen = pygame.display.set_mode((640, 480))
clock = pygame.time.Clock()

(rx, ry) = (0, 0)
(dx, dy) = (0, 0)

while True:

    for event in pygame.event.get():
        if event.type==pygame.QUIT or \
        (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE):
            sys.exit()
        elif event.type == pygame.KEYDOWN and event.key == pygame.K_g:
            pygame.display.toggle_fullscreen()

    mx, my = pygame.mouse.get_pos()

    dx = (0.9 * dx) + (0.25 * (mx - rx))
    rx += dx

    dy = (0.9 * dy) + (0.25 * (my - ry))
    ry += dy

    screen.fill((0, 0, 0))
    pygame.draw.rect(screen, (0, 191, 255), (rx, ry, 60, 60))
    #pygame.display.update()
    #clock.tick(30)

    dx = (0.9 * dx) + (0.80 * (mx - rx))
    rx += dx

    dy = (0.9 * dy) + (0.80 * (my - ry))
    ry += dy

    pygame.draw.ellipse(screen, (30, 144, 255), (rx, ry, 20, 20))
    #pygame.display.update()
    #clock.tick(30)

    dx = (0.9 * dx) + (0.25 * (mx - rx))
    rx += dx

    dy = (0.9 * dy) + (0.25 * (my - ry))
    ry += dy

    pygame.draw.rect(screen, (0, 0, 205), (rx, ry, 100, 100),5)
    #pygame.display.update()
    #clock.tick(30)


    dx = (0.9 * dx) + (0.25 * (mx - rx))
    rx += dx
    dy = (0.9 * dy) + (0.25 * (my - ry))
    ry += dy

    pygame.draw.ellipse(screen, (173, 216, 230), (rx, ry, 200, 200),8)
    pygame.display.update()
    clock.tick(30)



(BACK)



Attachments