next up previous [pdf]

Next: Writing a report Up: Maurice: Tutorial Previous: 1-D synthetic

Solution

  1. Change directory to the project directory
    bash$ cd ../channel2
    
  2. By now, you should know what to do next.
  3. Two-dimensional shifts generate a four-dimensional volume. Verify it by running
    bash$ scons local.rsf
    
    and
    bash$ sfin local.rsf
    
    View a movie of different shifts by running
    bash$ scons local.vpl
    
  4. Modify the filter weights by editing SConstruct in a text editor. Observe your final result by running
    bash$ scons smoothed2.view
    
  5. The file $\texttt{norm.rsf}$ contains the non-linear weights stacked over different shifts. Add a Result statement to SConstruct that would display the contents of $\texttt{norm.rsf}$ in a figure. Do you notice anything interesting?
  6. Apply the Canny edge detection to your final result and display it in a figure.
  7. EXTRA CREDIT Change directory to ../mona and apply your method to the image of Mona Lisa. Can you extract her smile?

from rsf.proj import *

# Download data
Fetch('horizon.asc','hall')

# Convert format
Flow('horizon2','horizon.asc',
     '''
     echo in=$SOURCE data_format=ascii_float n1=3 n2=57036 | 
     dd form=native | window n1=1 f1=-1 |
     add add=-65 | put
     n1=196 o1=33.139 d1=0.01 label1=y unit1=km
     n2=291 o2=35.031 d2=0.01 label2=x unit2=km 
     ''',stdin=0)
Result('horizon2','grey  yreverse=n color=j title=Input')

# Spray
Flow('spray','horizon2',
     '''
     spray axis=3 n=21 o=-0.1 d=0.01 |
     spray axis=4 n=21 o=-0.1 d=0.01
     ''')

# Shift
Flow('shift1','spray','window n1=1 | math output=x2')
Flow('shift2','spray','window n2=1 | math output=x3')

Flow('local','spray shift1 shift2',
     '''
     datstretch datum=${SOURCES[1]} | transp |
     datstretch datum=${SOURCES[2]} | transp
     ''')
Plot('local','window j3=4 j4=4 | grey color=j',view=1)

# -- CHANGE BELOW --
# try "exp(-0.1*(input-loc)^2-200*(x3^2+x4^2))"
Flow('simil','spray local',
     '''
     math loc=${SOURCES[1]} output=1 
     ''')

Flow('norm','simil',
     'stack axis=4 | stack axis=3')

Flow('smoothed2','local simil norm',
     '''
     add mode=p ${SOURCES[1]} |
     stack axis=4 | stack axis=3 |
     add mode=d ${SOURCES[2]}
     ''')
Result('smoothed2','grey yreverse=n color=j title=Output')
    
End()

smoothed2
Figure 12.
Your final result.
smoothed2
[pdf] [png] [scons]

mona
Figure 13.
Can you apply your algorithm to Mona Lisa?
mona
[pdf] [png] [scons]

from rsf.proj import *

# Download data
Fetch('mona.img','imgs')

# Convert to standard format
Flow('mona','mona.img',
     '''
     echo n1=512 n2=513 in=$SOURCE data_format=native_uchar |
     dd type=float
     ''',stdin=0)

Result('mona',
       '''
       grey transp=n allpos=y title="Mona Lisa"
       color=b screenratio=1 wantaxis=n
       ''')

End()


next up previous [pdf]

Next: Writing a report Up: Maurice: Tutorial Previous: 1-D synthetic

2015-01-08