The Psychophysics Toolbox

Slides:



Advertisements
Similar presentations
Matlab Class 5 Xiaotao Su, Ph.D. Visual Psychophysicist & IT Group Leader Rutgers Center for Cognitive Science (RuCCS)
Advertisements

Lab 12 : Liquid Crystal Displays: Slide 2 Slide 3 Slide 4 Slide 5 Slide 6 Slide 7 DMD Basics : Slide 8 Slide 9 Slide 10 Slide 11 Slide 12 Data Write the.
C HAPTER 20: G ETTING T ECHNICAL – T HE V IDEO S IGNAL.
XWN740 X-Windows Configuring and Using X-Windows & Hardware (Chapter 1: Pages 11-19)‏
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphicsIntroduction Dr. Eng. Farag Elnagahy
OpenGL Brian Farrimond Robina Hetherington. What is OpenGL A specification of a set of functions for drawing graphics –Names of functions –What information.
Computer Monitors B. Konkoth. Types of monitors CRT Cathode Ray Tube LCD Liquid Crystal Display.
Monitors and Sound Systems section 3A This lesson includes the following sections: · Monitors · PC Projectors · Sound Systems.
MAC OS – Unit A Page: 6-7, 8-9 Examining Input Devices Examining Output Devices.
Peripherals The term peripherals refers to all hardware devices that are attached to your computer and are controlled by your computer system Peripherals.
display screens and ergonomics
Lecture No. 3.  Screen resolution  Color  Blank space between the pixels  Intentional image degradation  Brightness  Contrast  Refresh rate  Sensitivity.
Video Monitor Uses raster scanning to display images –Beam of electrons illuminates phosphorus dots on the screen called pixels. Starting at the top of.
Video Monitor CRT: Cathode Ray Tube
Grade 8.  Pixel – Tiny dots that make up a picture shown on a monitor.  Resolution – How sharp and clear an image is. Usual measured by the amount of.
CIS 3.5 Lecture 2.2 More programming with "Processing"
Computer Graphics, KKU. Lecture 41 The Computer Programming Laws Any given program, when running, is obsolete. Any given program costs more and.
Hardware Components Display. 1.Display (Monitor) The screen is made up of thousands of picture elements or pixels Displays can be either CRT (Cathode.
CS-321 Dr. Mark L. Hornick 1 Graphics Displays Video graphics adapter Monitor.
Chapter 2 HAEDWAER.
1.  The primary output device in a graphics system is a video monitor. These monitors are based on Cathode Ray Tube (CRT) design.  CRT is a vacuum tube/electron.
LCD AND LCD INTERFACING. INDEX:-  INTRODUCTION  PIN DISCRIPTION  INITIALIZATION OF LCD  LCD INTERFACING  LCD INTERFACING WITH ATMEGA 32  INTERFACING.
Music and Audio Computing I A Prof. Marcelo M. Wanderley Week 9.
VISUAL DISPLAYS. The Human Eye The eye as an interface Anatomy and Function.
COMP541 Video Monitors Montek Singh Oct 7, 2016.
Hardware: Input / Output Devices
Computer Graphics Lecture 4 Computer Graphics Hardware
Line Drawing Algorithms
Computer Graphics Lecture 13 Graphics Systems Taqdees A
COMP541 Video Monitors Montek Singh Sep 15, 2017.
MOM! Phineas and Ferb are … Aims:
Pixels, Colors and Shapes
User-Written Functions
Computer Graphics Lecture 3 Computer Graphics Hardware
The Psychophysics Toolbox
INFORMATION TECHNOLOGY
Computer Architecture
Last time Cells & Structures Organizing an Experiment
Day 5 review fprintf Matrices as images Let's fire up Matlab.
DIGITAL CALCULATOR USING 8051
Matlab Class 2 Xiaotao Su, Ph. D
Prepared By Sidra Noureen
Overview of Graphics Systems
Introduction to computer
Types of monitors CRT Cathode Ray Tube LCD Liquid Crystal Display.
وحدات الإدخال و الإخراج
Computer Graphics 5: Line Drawing Algorithms
Computer Fundamentals
Program and Graphical User Interface Design
Introduction to Computers
Computer Graphics 5: Line Drawing Algorithms
Matlab Class 6 Xiaotao Su, Ph. D
Computer System Overview
POV-Clients Sync.
Computer Literacy Chapter 2.
Chapter 2 Graphics Programming with C++ and the Dark GDK Library
More programming with "Processing"
Graphics Systems SUBJECT: COMPUTER GRAPHICS LECTURE NO: 02 BATCH: 16BS(INFORMATION TECHNOLOGY) 1/4/
Computer Graphics 5: Line Drawing Algorithms
PERIPHERAL DEVICES. CONTENTS  What is Computer Peripheral  Types of Computer Peripheral  Some Imp. Peripheral devices and their uses  What are not.
COMP541 Video Monitors Montek Singh Feb 6, 2019.
Output Chapter 6.
Chapter 3 Peter Norton’s  Introduction to Computers Interacting with Your Computer.
Chapter 2 Overview of Graphics Systems
Using Script Files and Managing Data
University of Warith AL-Anbiya’a
This lesson includes the following sections:
Graphing linear equations
CIT1100 Fundamentals of Computing
Presentation transcript:

The Psychophysics Toolbox In Matlab

What Is It? Originally created by Brainard (1997) and Pelli (1997). Allows Matlab to control the entire display with microsecond timing. Multiple displays can be controlled at the same time (e.g. for stereoscope setups). Routines implemented to allow response collection. Implements a method for adaptive threshold measurement (i.e. the QUEST procedure). Available from: http://psychtoolbox.org/

The Basics % Ignore synchronization tests Screen('Preference', 'SkipSyncTests', 1); % Open a pointer in video memory ScreenNum = 0; [windowPtr,Rect] = Screen('OpenWindow', ScreenNum); % Make an image [x,y] = meshgrid(1:Rect(3),1:Rect(4)); r = hypot(x-(Rect(3)+1)/2,y-(Rect(4)+1)/2); Img = cos(2*pi*r/20)*128+128; % Writes the image to video memory Screen('PutImage', windowPtr, Img); % Transfers the image from video memory to the monitor Screen('Flip', windowPtr); % Waits for the user to press a key KbWait; % Closes all windows Screen('CloseAll');

Line-By-Line Cathode Ray Tube Liquid Crystal Display Screen('Preference', 'SkipSyncTests', 1); CRT monitors fill in pixels row- wise starting from the top-left and going to the bottom-right. When the bottom-right is reached, the monitor sends a screen refresh signal, letting the computer know it’s ready to start a new image. The psychophysics toolbox has the option of synchronizing images to this signal. LCD monitors draw all pixels at the same time, and do not send synchronization signals. Thus, when using a LCD monitor, this line should be included at the beginning of your code so that the psychophysics toolbox does not try wait for a screen refresh to draw an image.

Line-By-Line ScreenNum = 0; When multiple displays are connected to the video card, they may be used individually, or in combination. The screen number for the displays are as follows: 0 = All available displays combined. 1 = Primary display only. 2 = Secondary display only. ScreenNum = 1; ScreenNum = 2;

Line-By-Line [windowPtr,Rect] = Screen('OpenWindow', ScreenNum); Creates a pointer to space in video memory where images may be written. Returns the pointer (windowPtr) and the size of the screen (Rect = [left top right bottom]).

Line-By-Line [x,y] = meshgrid(1:Rect(3),1:Rect(4)); Creates a Cartesian coordinate system over the image. E.g. 𝑥= 1 2 3 1 2 3 1 2 3 , 𝑦= 1 1 1 2 2 2 3 3 3 . The point (x = 2, y = 1) is indexed using x(1,2), y(1,2).

Line-By-Line r = hypot(x-(Rect(3)+1)/2,y-(Rect(4)+1)/2); Calculate the radius from the center of the image. hypot(x,y) calculates 𝑥 2 + 𝑦 2 Taking x-(Rect(3)+1)/2 and y-Rect(4)+1)/2 centers the coordinate system on the middle of the image. E.g. 𝑥= −1 0 1 −1 0 1 −1 0 1 , 𝑦= −1 −1 −1 0 0 0 1 1 1

Line-By-Line Img = cos(2*pi*r/20)*128+128; Creates an image that is the cosine of the radius, with a period of 20 pixels. Img = cos(2πr/20)×128+128 Period y = cos(x) 1 250 200 0.5 150 100 -0.5 50 90 180 270 360 450 540 630 720 20 40 60 80 100

Line-By-Line Screen('PutImage', windowPtr, Img); Writes the image to video memory Screen('Flip', windowPtr); Transfers the image from video memory to the monitor

Line-By-Line KbWait; Stops the program until the user makes a keypress. Screen('CloseAll'); Clears the monitor and the video memory.

Getting Help With The Psychophysics Toolbox Normal Matlab functions: help imwrite help meshgrid Psychophysics Toolbox functions: Screen CloseAll? Screen OpenWindow? Screen Flip? Start with the word Screen, then a space, then the name of the function, then a question mark.

Listing All Psychophysics Toolbox Functions To list all available Psychophysics Toolbox functions type “Screen” at the command window: Screen

Showing Movies % Ignore synchronization tests Screen('Preference', 'SkipSyncTests', 1); % Open a pointer in video memory ScreenNum = 0; [windowPtr,Rect] = Screen('OpenWindow', ScreenNum); % Prepare some image creation variables [x,y] = meshgrid(1:Rect(3),1:Rect(4)); r = hypot(x-(Rect(3)+1)/2,y-(Rect(4)+1)/2);

Showing Movies (continued) % Generate the frame textures nFrm = 100; Texture = zeros(nFrm,1); for iFrm = 1:nFrm Img = cos(2*pi*r/20 - 2*pi*iFrm/nFrm)*128+128; Texture(iFrm) = Screen('MakeTexture', windowPtr, Img); end Screen('PreloadTextures', windowPtr);

Showing Movies (continued) for iFrm = 1:nFrm % Draw the image in video memory Screen('DrawTexture', windowPtr, Texture(iFrm)); % Transfer the image from video memory to the screen Screen('Flip', windowPtr); end % Close all windows and clear video memory Screen('CloseAll');