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

TypeError: 'pyrealsense2.pyrealsense2.config' object is not subscriptable #10020

Closed
vigkrish123 opened this issue Dec 1, 2021 · 5 comments
Closed

Comments

@vigkrish123
Copy link

vigkrish123 commented Dec 1, 2021

Required Info
Camera Model D435i
Operating System & Version windows 10
Platform Laptop
Language {python/opencv}

I am currently using Realsense D435i camera for my project. I am using the pyrealsense2 library for getting the stream but I am facing the error "TypeError: 'pyrealsense2.pyrealsense2.config' object is not subscriptable" every time I try to access the frames from the camera for detection purpose.

If I use my laptop webcam as the source of stream, it works but If i use pyrealsense and realsense camera, I face this issue. Kindly provide me with some insight on what I can do or why its not able to access the frames.

@MartyG-RealSense
Copy link
Collaborator

Hi @vigkrish123 Your pipeline setup and config code looks okay. As a starting point in investigating your case, I note that you have placed your colorwriter instruction directly after the pipe start instruction, whilst a similar .avi saving line in #2731 (comment) places it immediately before the pipe start line.

Please try moving the colorwriter instruction to the line before pipe start in order to eliminate it as a possible cause of your problem.

colorwriter = cv2.VideoWriter('output_realsense.avi', cv2.VideoWriter_fourcc(*'XVID'), 30, (640, 480), 1)
pipeline.start(config)

@vigkrish123
Copy link
Author

I tried moving the pipeline start line but I still get the same error. I don't understand why it says 'pyrealsense2.pyrealsense2.config' object is not subscriptable because normal rgb streaming and saving works fine but when it reaches batch_boxes, it stops

@MartyG-RealSense
Copy link
Collaborator

I have not seen a script like this before. Since the program is apparently failing at the batch_boxes line though, I wonder whether the error message is referring to having problems with the config['model'] part of that line (the config values from the config file containing box dimensions) and not the camera stream config.

@vigkrish123
Copy link
Author

I kinda fixed the issue. I used rs.align and align.process and it somehow worked. But facing issue with saving the stream though. Anyways I will close the issue. Thanks a lot for your quick response.

@MartyG-RealSense
Copy link
Collaborator

You are very welcome, @vigkrish123 - it's great to hear that you made progress!

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

No branches or pull requests

2 participants