-
Notifications
You must be signed in to change notification settings - Fork 16
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
base: master
Are you sure you want to change the base?
Robot task #32
Conversation
…minal, not in script)
Cleaning
@FrancoisPgm @bpinsard please review and merge this, thanks! |
src/tasks/robot.py
Outdated
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)) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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.
src/tasks/robot.py
Outdated
self.stream.pix_fmt = "yuvj422p" | ||
|
||
self.thread_recv = threading.Thread(target=self.recv_loop) | ||
self.thread_recv.start() |
There was a problem hiding this comment.
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.
del self.pressed_keys[ | ||
k[0] | ||
] # TODO: can yield problem if twice same key in keyreleasebuffer (happened once) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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] | |
] |
No description provided.