Preliminary implementation of Python stimulation interface

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.