The SSVEP-based BCI system requires a stimulating interface, implemented in Python (the main OpenCV) at the PC end, with the following code
ImportCv2ImportNumPy as NPdefUp (Img,flag): forIinchRange (0,100): forJinchRange (206,306): ifFlag:img[i][j]=0Else: Img[i][j]=255defDown (img,flag): forIinchRange (412,512): forJinchRange (206,306): ifFlag:img[i][j]=0Else: Img[i][j]=255defLeft (img,flag): forIinchRange (206,306): forJinchRange (0,100): ifFlag:img[i][j]=0Else: Img[i][j]=255defRight (Img,flag): forIinchRange (206,306): forJinchRange (412,512): ifFlag:img[i][j]=0Else: Img[i][j]=255if __name__=='__main__': IMG=np.zeros ((512,512,3), np.uint8) up (img,0) to (img,0) left (img,0) Right (img,0) cv2.imshow ('Image', img) num=0 while1: Num+=1ifnum>10000000: Num=0 Cv2.waitkey (10) ifnum%5==0:left (Img,num%) ifnum%6==0:down (Img,num/6%2) ifnum%7==0:right (Img,num%) ifnum%8==0:up (Img,num/8%2) Cv2.imshow ('Image', IMG)
The effect is: up and down around four blocks in accordance with a certain frequency flashing, theoretically need to 6.25,8,9,10, where the fine degree of coarse, probably realize the function is OK, consider the code execution time, machine differences, there is need to change.
Preliminary implementation of Python stimulation interface