0

我们正在使用 Matlab 中的 Psychtoolbox 进行实验。我们要做的是将较小的图像(预先指定位置)放在大图像上。问题是,一旦我们尝试将较小的背景图像放在它上面,我们就会丢失背景图像。此外,每个图像始终居中,我们无法弄清楚如何将图像放置在指定位置。

我们已经尝试使用“DrawTextures”和“PutImage”来做到这一点,但到目前为止它失败了。你可以帮我们吗?

这是我们的一些代码:

[w,screenrect]=Screen('OpenWindow',screennr);
Screen(w,'fillrect',background_color);
Screen('Flip', w);

sr = [0 0 s_grootte s_grootte];
dst = CenterRect(sr,screenrect);

nr=max(Screen('Screens'));
Screen('PutImage', w, image); %% image is defined beforehand, ofcourse

%% We want to put smaller images on top of this

for i = 1:n_images:

% coordinates should be picked randomly from beforehand specified matrix
location_number = r(1,i);
coordinates = locations(location_number,:);
x = coordinates(1,1);
y = coordinates(1,2);

%% Now we have selected the coordinates, we want to place the smaller image on 
%% that location

end
4

1 回答 1

0

我发现自己该怎么做。问题是翻转屏幕的时间(将矩阵放在屏幕上)。

刺激的位置必须以这种方式编码:

Screen('DrawTexture',window,ImageArray,[size],[location])

大小和位置按以下顺序编码:[左、上、右、下]。所有计算完成后必须翻转屏幕,否则屏幕将被覆盖。希望我将来可以帮助其他人。

于 2014-06-12T15:22:53.380 回答