region of interest mouse click response and if statements using psychtoolbox-3

조회 수: 5 (최근 30일)
Hi All,
I'm wondering how I can specify a region of interest on an image using Psychtoolbox-3. I need the ROI to be invisible to the user. I would like the user to make a left mouse click and then use an if statement (that depends on whether they clicked inside or outside of the ROI) to determine what happens next. PLEASE HELP!!
I currently have this, but it's not working (i'm not even sure if the load function is calling the roi back):
%I used drawrectangle to make an roi on an image and then saved it to roi.mat
load('roi.mat')
[clicks,x,y,WhichButton] = GetClicks;
if inROI(roi,x,y)
texture = Screen('MakeTexture', windowPtr, YouWon);
Screen('DrawTexture', windowPtr, texture);
Screen('Flip', windowPtr);
WaitSecs(1);
else
texture = Screen('MakeTexture', windowPtr, TryAgain);
Screen('DrawTexture', windowPtr, texture);
Screen('Flip', windowPtr);
WaitSecs(1);
end

답변 (1개)

Srimouli Rukmabhatla
Srimouli Rukmabhatla 2020년 3월 26일
Hi Rubina,
Please do ensure that the required variables are loaded in ‘roi.mat’ file . inROI function is to check the given co-ordinates are within the Region Of Interest, If co-ordinates are within the ROI it return 1 else it return 0 .Please do refer the inROI doucumentaion link https://www.mathworks.com/help/images/ref/inroi.html.

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by