up [pdf]
from rsf.proj import *

# Download image

image = 'IMG_0974.jpg'

Fetch(image,'1546044',server='http://files.figshare.com',top=None)

# Convert to RSF

Flow('byte',image,'jpg2byte')

# Use standard formula for luminance
Flow('image','byte',
     '''
     dd type=float | 
     stack axis=1 scale=0.2126,0.7152,0.0722 |
     put o1=0 d1=1 o2=0 d2=1
     ''')

Plot('image','grey title="Talitrus Saltator" allpos=y transp=n screenwd=8.2 screenht=9.6')

Result('image','Overlay')

# Segment an eye

Flow('sobel','image','grad2')

Result('sobel','grey title="Sobel filter" allpos=y')

Flow('time','sobel','eikonal yshot=400 zshot=204 vel=n')

Plot('eye','time',
     '''
     clip clip=400 | contour nc=1 c0=200 plotfat=5 plotcol=2 
     transp=n screenwd=8.2 screenht=9.6 wantaxis=n wanttitle=n
     ''')

Result('eye','image eye','Overlay')

Flow('eye','time','mask max=200 | dd type=float')

Result('eye2','image eye',
       '''
       math m=${SOURCES[1]} output="(1-m)*input+m*1000" | 
       grey title="Talitrus Saltator" 
       allpos=y transp=n screenwd=8.2 screenht=9.6 clip=86 color=iC
       ''')

End()

sfjpg2byte
sfdd
sfstack
sfput
sfgrey
sfgrad2
sfeikonal
sfclip
sfcontour
sfmask
sfmath

1546044/IMG_0974.jpg