Apply blur to a 'FrameOval'?

5 visualizaciones (últimos 30 días)
Elric Elias
Elric Elias el 7 de Sept. de 2019
Respondida: Rajani Mishra el 13 de Sept. de 2019
I'm trying to draw an ellipse to a monitor, but I'd like the ellipse to have blurred edges. My current code (below) draws the ellipse to the specified screen, but the edges of the ellipse are sharp. Ideally, I'd like to apply a Gaussian blur to the edges of the ellipse (as imgaussfilt would, except that the target is not an image file).
The first two sections (below) simply prep the screen; no problems there. The last section draws and displays the shape. It is that shape that I'd like to apply a Gaussian blur to. This is for a vision science experiment. Ideas?
%% Prep Screen
gray = [171, 171, 171];
screens=Screen('Screens');
whichScreen=max(Screen('Screens'));
Screen('Preference', 'SkipSyncTests', 0);
[theWindow,theRect]=Screen('OpenWindow',whichScreen, gray, [0 0 800 600]);
[centerX, centerY] = RectCenter(theRect);
%% Screen Locations
wid = 120;
heit = 120;
halfwid = .5*wid;
halfheit = .5*heit;
[XC, YC] = RectCenter(theRect);
Loc1 = [XC-halfwid, YC - halfheit, XC + halfwid, YC + halfheit];
%% Display Shape
Ellipse = Screen('OpenOffScreenWindow',theWindow, gray); %use this
Screen('FrameOval', Ellipse, [130 130 130], [Loc1], 10);
Screen('DrawTexture', theWindow, Ellipse);
Screen('Flip', theWindow);
WaitSecs(1);
close 'all';
sca

Respuestas (1)

Rajani Mishra
Rajani Mishra el 13 de Sept. de 2019
Hi,
Psychtoolbox is an open community that interfaces between MATLAB and the computer hardware. "Screen" is a function of that toolbox. Yes, you cannot apply Gaussian blur on shapes made by "Screen" function, as Gaussian blur is available for images. For blurring the edges you can use a subfunction "DrawTexture" of Screen command in Psychtoolbox with the proper arguments that can help in blurring.
As you also have used that subfunction in your code. I think changing the "FilterMode" argument of that subfunction will help in blurring the edges. FilterMode value will help in drawing the blurred textures.
You can also refer to the following documentation for more information:
Hope this helps!

Categorías

Más información sobre Timing and presenting 2D and 3D stimuli en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by