12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- function Jcenter = getitemimgallrot(i,sizegaz,resize);
- for k =1:16;
-
- rotlist = linspace(11.25,348.75,16)
- % rotlist=[11.2500000000000
- % 56.2500000000000
- % 101.250000000000
- % 146.250000000000
- % 191.250000000000
- % 236.250000000000
- % 281.250000000000
- % 326.2500000000000];
- % i=1
- % sizegaz=[400 400]
- % resize=2
- % Get the image files for the experiment:
- imageFolder = 'stimuli/';
- imgList = dir(fullfile(imageFolder,['*.' 'jpg']));
- imgList = {imgList(:).name};
- bth=254;% treshold to subtitute for background
- sc_o=(10000/2560)*1.4;
- %Object 1
- file_object_1 = imgList{i};
- img_object_1 = imread(fullfile(imageFolder ,file_object_1));
- img_object_1((img_object_1>=bth))=255;%128; %REMOVING BACKGROUND FOR EACH IMAGE
- % objectDisplay_1 = Screen('MakeTexture', window1, img_object_1);
- % Calculate image position (center of the screen) OBJECT 1
- imageSize_o1 = size(img_object_1)/sc_o;
- % pos_o1 = [(W-imageSize_o1(2))/2 (H-imageSize_o1(1))/2 (W+imageSize_o1(2))/2 (H+imageSize_o1(1))/2];
- J = imresize(img_object_1,imageSize_o1(1:2));
- if resize==1 %if the plot is smaller than the images
-
- n=round(sizegaz/2);
- m=round(size(J)/2);
- point1=m(1)-n(1);
- point2=m(1)+n(1);
- Jcenter=J(point1:point2,point1:point2,:);
- elseif resize==2 %if the plot is bigger than the images
-
- m=round(sizegaz/2);
- n=round(size(J)/2);
- point1=m(1)-n(1);
- point2=m(1)+n(1);
-
- canvas=nan([sizegaz,3]);
- canvas(:,:,:)=256;
- canvas(point1:point2-1,point1:point2-1,:)=J(:,:,:);
- canvas=uint8(canvas);
- Jcenter=canvas;
-
- else
- Jcenter=J;
- end
- JcenterRot=imrotate(Jcenter,rotlist(k),'nearest','crop');
- im=imagesc(JcenterRot);
- % im.AlphaData = 0.35;%min(JcenterRot,[],2);
- alphamap=JcenterRot(:,:,1)~=255;
- alphamap=alphamap.*(1/(k));
- im.AlphaData =alphamap;
- hold on;
- end
- end
|