! BLUR EXPERIMENT ! This program presents 24 .jpg images plus a mask image saved in the same folder ! The name of the images should be "blur-" followed by a number ranging from 1 to 24, followed by ".jpg" ! Images from 1 to 8 are the Bella Principessa pictures with 8 levels of blur ! Images from 9 to 16 are the Mona Lisa pictures with 8 levels of blur ! Images from 17 to 24 are the Young Woman pictures with 8 levels of blur PUBLIC nome$ CALL myopenfile (#1) DIM vettrand(1) LET nimages = 24 LET waitprincess = 2 MAT REDIM vettrand(nimages) CLEAR ASK PIXELS px,py SET WINDOW 1,px,1,py LET cx=int(px/2) LET cy=int(py/2) CALL urn (nimages,vettrand(),nimages) SET BACK "black" SET COLOR "white" PRINT "YOU ARE REQUIRED TO INSPECT AN IMAGE THAT MIGHT BE BLURRED." PRINT "PLEASE RATE THE LEVEL OF RESPONSIVENESS WITH A NUMBER RANGING FROM 1 (NO CONTENT) TO 7 (VERY MUCH CONTENT)" PRINT "PRESS ANY KEY TO START" GET KEY AAAA CLEAR FOR i = 1 to nimages LET im$ = "blur-" & str$(vettrand(i))& ".jpg" CALL Read_Image("JPEG",imagedata$,im$) BOX SHOW imagedata$ at 350,0 LET answer= 0 DO GET KEY answer LOOP until answer>48 and answer <56 IF vettrand (i)<9 then LET pict$="Bella" LET ans= vettrand(i) ELSE IF vettrand(i)>8 and vettrand (i)<17 then LET pict$= "Monalisa" LET ans= vettrand(i)-8 ELSE IF vettrand (i) >16 then LET pict$="Pollaiolo" LET ans= vettrand(i)-16 END IF CLEAR CALL savedata (#1,str$(ans),pict$, chr$(answer)) CALL Read_Image("JPEG",mask$,"mask.jpg") BOX SHOW mask$ at 10,0 PAUSE waitprincess CLEAR NEXT i CLOSE #1 PRINT "THANK YOU, END OF THE EXPERIMENT" END !##################################################################### SUB savedata (#1,cond$, p$, ans$) PRINT#1: cond$,p$, ans$ END SUB !##################################################################### SUB myopenfile(#1) DECLARE PUBLIC nome$ INPUT prompt "Please, write your initials and press enter ":nome$ CLEAR OPEN#1:name nome$&"-BLUR.txt",org text,create newold !per singolo sogg RESET#1:end SET #1 : MARGIN 150 SET #1 : ZONEWIDTH 22 PRINT#1:"BLUR LEVEL","PICTURE","ANSWER" END SUB !************************************************************* SUB urn(k, pp(),n) DIM qq(1) MAT redim qq(n) ! estrae a caso k elementi da un array di n RANDOMIZE FOR i= 1 to n LET qq(i)= i !vettore qq posizione i NEXT i FOR i= 1 to k LET kk= int(rnd*(n-i+1))+1 !rnd una funzione che va da 0 a 0.99, aggiungo 1 LET pp(i)= qq(kk) LET qq(kk)= qq(n+1-i) NEXT i END SUB