Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robot task #32

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open

Robot task #32

wants to merge 49 commits into from

Conversation

ADebor
Copy link

@ADebor ADebor commented Jun 2, 2022

No description provided.

@pbellec
Copy link

pbellec commented Jan 16, 2023

@FrancoisPgm @bpinsard please review and merge this, thanks!

obs_tmp = cv2.imdecode(img_raw, cv2.IMREAD_COLOR)
obs_tmp = Image.fromarray(obs_tmp)
if is_color_image:
obs_tmp = obs_tmp.resize((320, 240))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of the resampling / flipping could be done through psychopy (lmageStim params), so as to offload that to the graphics card.

if img_raw.size != 0:
obs_tmp = self.img_decode(img_raw, is_color_image)
self.lock_recv.acquire()
self.obs = (id, obs_tmp.transpose(Image.FLIP_TOP_BOTTOM))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above:
some of the resampling / flipping could be done through psychopy (lmageStim params), so as to offload that to the graphics card.

obs_tmp = cv2.cvtColor(obs_tmp, cv2.COLOR_BGR2RGB) # OpenCV stores images in B G R ordering
obs_tmp = Image.fromarray(obs_tmp)
if is_color_image:
obs_tmp = obs_tmp.resize((320, 240))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of the resampling / flipping could be done through psychopy (lmageStim params), so as to offload that to the graphics card.

self.stream.pix_fmt = "yuvj422p"

self.thread_recv = threading.Thread(target=self.recv_loop)
self.thread_recv.start()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it starts receiving data directly when you instantiate the class. So if you have multiple instances of the class, there will all try to connect to the NUC. If the session script is an iterator then it's ok.
The other issue I see is that you start saving the video when the task object is created, so the mp4 start won't match the scanner start. As you save the frame id shown by psychopy, it should allow cropping the video to the scan onset.

Comment on lines +544 to +546
del self.pressed_keys[
k[0]
] # TODO: can yield problem if twice same key in keyreleasebuffer (happened once)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
del self.pressed_keys[
k[0]
] # TODO: can yield problem if twice same key in keyreleasebuffer (happened once)
if k[0] in self.pressed_keys:
del self.pressed_keys[
k[0]
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants