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

2 ビュー (過去 30 日間)
Rubina Malik
Rubina Malik 2020 年 1 月 27 日
回答済み: Srimouli Rukmabhatla 2020 年 3 月 26 日
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 Center および File ExchangeImage display and manipulation についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by