Hints on Photoshoppe - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Hints on Photoshoppe

Description:

x = pts(1,1); y = pts(1,2) Making the project easy. Any code you copy from ... read the documentation. Fun and Games. Genetic Images. Due to Karl Sims, ca 1989 ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 18
Provided by: JFH
Category:

less

Transcript and Presenter's Notes

Title: Hints on Photoshoppe


1
Lecture 21
2
Hints on Photoshoppe
  • Your axes need to have replacechildren set
    before you do anything else to them
  • The moment you invoke image or imagesc, the
    axes properties will be lost if you havent set
    replacechildren

3
Setting Axis Size
  • Your axes display a region of the plane
  • image and imagesc decide what that region should
    be
  • They generally make it larger than you want
  • Fix with
  • set(ltaxeshandlegt, XLim, xmin xmax)
  • set(ltaxeshandlegt, YLim, ymin ymax)

4
Image positioning
  • 3 x 2 image displayed in plane
  • Each pixel occupiesa small square
  • Pixel (i,j) centeredon location (i,j)

0 1 2 3 4 5 6 7 8 9 10 11 12
5
Zooming
  • Theres a matlab procedure, zoom that will help
    you with zooming

6
Getting a mouse click
  • function PhotoAxes_ButtonDownFcn(hObject, ...
  • pts get(hObject, 'CurrentPoint')
  • pts is a 2x3 matrix
  • pts
  • x1 y1 z1
  • x2 y2 z2
  • We only want x and y.
  • For non-rotated axes, x1 x2, and y1 y2.
  • So
  • x pts(1,1) y pts(1,2)

7
Making the project easy
  • Any code you copy from the handout
  • step through it in the debugger
  • understand every line of code
  • read the documentation

8
Fun and Games
  • Genetic Images
  • Due to Karl Sims, ca 1989
  • Treat each point in an image as having (x,y)
    coordinates
  • Color is a function sometimes complicated! of
    x and y

9
Color function
  • Described by a tree structure
  • Arithmetic example
  • (3(57)) (16/4)

10
Arithmetic
  • The internal nodes areoperations
  • Leaf nodes are numbers
  • Leaf nodes could alsobe variables like x or y
  • Now value depends on x and y.

11
For images
  • Leaf nodes are color triples (rgb).
  • Operations are on a per-color basis, so that
    (r1, g1, b1) (r2, g2, b2)
    (r1r2, g1g2, b1b2)
  • All operations are binary (take two arguments)
    like , -, , /

12
What about cosine?
  • For things that normally take one argument, like
    sine and cosine, we define two argument
    operation by adding
  • 4 2sine 3 (in analogy with 4 3) means
  • sin(4 3)

13
Operations producing numbers
  • Sometimes its nice to have an operation
    producing just numbers
  • Examples
  • (r, g, b) -gt max(r, g, b)
  • (r,g,b) -gt sum(r,g,b)
  • (r,g,b) -gt if (r gt 0.5) then g, else b

14
casting
  • If an operation produces just ONE number
  • Well copy that number 3 times to get an RGB value

15
Evaluation
  • If we have a tree, representing an expression
    like this
  • Evaluate it recursively
  • value(tree) DIFF(value(lefthalf),
    value(righthalf))
  • In general, you evaluate left, eval right, and
    apply the operator at the node.
  • If node is a number, the value IS that number.


16

3
5
16
Matlab code
  • function y evaltree(t)
  • if (t.number)
  • y t.value
  • else
  • op t.operation
  • left evaltree(t.leftchild)
  • right evaltree(t.rightchild)
  • y apply(op, left, right)
  • end

17
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com