The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Radial / Polar Gabor Patch
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Chris Dopuch

Posts: 1
Registered: 5/2/13
Radial / Polar Gabor Patch
Posted: May 2, 2013 3:55 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Dear Mathworks community,

I am very new to Matlab, and I need to create a mask for an experiment my lab is trying to run. The stimuli we are using are gabor patches arranged in a circle, pointing in various angles. The mask needs to look like a radial gabor patch with the 'lines' of the patch extending outwards in all directions.

Here's the code we use to generate the patches:

function im = generate_gabor(ort, lambda, sigma, phase)

% set image size (cut off after center +/- 3*sigma)
imsize = round(5*[sigma sigma]);

% generate cosine pattern
X = ones(imsize(1),1)*[-(imsize(2)-1)/2:1:(imsize(2)-1)/2];
Y =[-(imsize(1)-1)/2:1:(imsize(1)-1)/2]' * ones(1,imsize(2));

cospattern = cos(2.*pi.*1/lambda.* (cos(deg2rad(ort)).*X ...
+ sin(deg2rad(ort)).*Y) ...
- phase*ones(imsize) );

%cospattern = 1;

% convolve with gaussian
type = 'gaussian';
filt = fspecial(type, imsize, sigma);
filt = filt/max(max(filt));
im = cospattern .* filt;

function r = deg2rad(d)

r = (d/360)*(2*pi);

Could someone please help me with this?

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.