Gabor Gampang Week7-Thu

Embed Size (px)

Citation preview

  • 8/12/2019 Gabor Gampang Week7-Thu

    1/24

    COGS 119

    MATLAB for Experimental Research

    Fall 2013 Week 7

    Basic Vision Science with Psychtoolbox

  • 8/12/2019 Gabor Gampang Week7-Thu

    2/24

    Gabor

    ! Simple cells in the primary visual cortex (V1) of theprimate brain can be modeled using Gabor filters, which

    is a product of sine waveand a Gaussian.

  • 8/12/2019 Gabor Gampang Week7-Thu

    3/24

    Gabor

    ! A gabor is characterized by several parameters:! Orientation (theta)! Spatial frequency (sf)! Width (sd)! Size

  • 8/12/2019 Gabor Gampang Week7-Thu

    4/24

    Example gabors

    theta = 90 theta = 45

    sf = 5 sf = 10

    sd = 0.2 sd = 0.2

    size = 100; size = 100

    theta = 90 theta = 45

    sf = 10 sf = 10sd = 0.2 sd = 0.4

    size = 100; size = 100

  • 8/12/2019 Gabor Gampang Week7-Thu

    5/24

    Creating a gabor in Matlab

    Gabor = Sinewave * Gaussian

    Step 1: Create Sinewave

    Step 2: Create Gaussian

    Step 3: Multiply

  • 8/12/2019 Gabor Gampang Week7-Thu

    6/24

    Creating a gabor in Matlab

    prep_gabor.m

  • 8/12/2019 Gabor Gampang Week7-Thu

    7/24

    Creating a gabor in Matlab

    prep_gabor.m

    sinewave andgrating

    gaussian

    multiply sinewave and gaussian

    inputs

  • 8/12/2019 Gabor Gampang Week7-Thu

    8/24

    Step-by-step

    prep_gabor.m

    sinewave andgrating

    gaussian

    multiply sinewave and gaussian

    inputs

  • 8/12/2019 Gabor Gampang Week7-Thu

    9/24

    Meshgrid

    !" $ %&'( !) $ *%( +,-+. $ '/( 0.+!12- $ *%%(

    33 45678 $ 0-!,9:1";.?-;@*6*60.+!12-A*BB(

    33 10.9-!?;5B( .51! C))( ?C;9:.7B(

    33 10.9-!?;7B( .51! C))(

  • 8/12/2019 Gabor Gampang Week7-Thu

    10/24

    ramp33 :.0> $ ?C!;+,-+.D>1E*F%BD;5@5?B A !1=;+,-+.D>1E*F%BD;7@7?B(

    33 10.9-!?;:.0>B( .51! !GH.:-( .51! C))(

  • 8/12/2019 Gabor Gampang Week7-Thu

    11/24

    Sinewave (grating)

    33 9:.+1=9 $ !1=;ID>1D!)D:.0>B(

    33 10.9-!?;9:.+1=9B( .51! !GH.:-( .51! C))(

  • 8/12/2019 Gabor Gampang Week7-Thu

    12/24

    Gaussian

    33 9.H!! $ -5>; @;;5@5?B&JI A ;7@7?B&JIBE;ID!"JIBB(

    33 10.9-!?;9.H!!B( .51! !GH.:-( .51! C))(

  • 8/12/2019 Gabor Gampang Week7-Thu

    13/24

    Gabor

    33 9.KC: $ 9.H!!&D9:.+1=9(

    33 10.9-!?;9.KC:B( .51! C))(

  • 8/12/2019 Gabor Gampang Week7-Thu

    14/24

    Orienting gabor

    ! Download gabor_sweep_orient.mfrom the classwebsite and run it.

    !Now, lets look at the code closely to understand howthe gabor changes orientation.

  • 8/12/2019 Gabor Gampang Week7-Thu

    15/24

    Displaying gabor in PTB

    ! Download disp_gabor.mfrom the class website andrun it.

    !disp_gabor.mprepares a gabor (callingprep_gabor.m) and displays it in Psychtoolbox.

    ! Inputs:! sd, sf, theta (gabor parameters)! offx, offy (offset from the center of the screen)

  • 8/12/2019 Gabor Gampang Week7-Thu

    16/24

    Displaying gabor in PTB

    disp_gabor.m

  • 8/12/2019 Gabor Gampang Week7-Thu

    17/24

    Displaying gabor in PTB

    disp_gabor.m

    Call prep_gabor.m

    Make gabor texture

    Draw gabor texture

    inputs

  • 8/12/2019 Gabor Gampang Week7-Thu

    18/24

    Experiment with gabors

    ! Lets display multiple gabors with various properties (sd,sf, theta) on various locations on the screen.

    !Download gabor_experiment.mfrom the classwebsite and run it.

    ! Lets look at the code closely to understand how itdisplays gabors.

  • 8/12/2019 Gabor Gampang Week7-Thu

    19/24

    gabor_experiment.m

    Experiment has the following trial types:

    ! gabor with sd = 0.1, sf = 10, theta = 5;! gabor with sd = 0.1, sf = 10, theta = 355;! gabor with sd = 0.1, sf = 16, theta = 5;! gabor with sd = 0.1, sf = 16, theta = 355;

  • 8/12/2019 Gabor Gampang Week7-Thu

    20/24

    gabor_experiment.m (trial set-up)

    Open a file to write

    Set-up the trials gaborparameters

    !! #$%& '()

  • 8/12/2019 Gabor Gampang Week7-Thu

    21/24

    rng

    :=9;L!,H))

  • 8/12/2019 Gabor Gampang Week7-Thu

    22/24

    gabor_experiment.m (open window

    and set screen parameters)

  • 8/12/2019 Gabor Gampang Week7-Thu

    23/24

    gabor_experiment.m (prepare and

    display gabors) Call prep_gabor.m

    Make a texture for

    the gabor and then draw itas in disp_gabor.m

    Get user response and rt

    Write into a file

  • 8/12/2019 Gabor Gampang Week7-Thu

    24/24

    Exercise

    ! Read Fine and Boynton chapter 5 and do the exercisesthere in Matlab.

    ! Submit project choices instructions via E-mail