|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Error while processing images through OpenCV pipeline
TLDR: ERROR: serve_Tracking: Too many simultaneous client streams (MjpegServerImpl.cpp:403) While viewing the image in smart dashboard and I believe it halts processing.
Team 1245 head programmer here! Our team has decided to go along with robot vision and has had varied success for the past week or so. I managed to get our pipeline to read the images, and find the pixel height of the two rectangles (Code below) but whenever we try to view the processed image in Smart Dashboard we get the error above. This also seems to happen in the background after a few seconds causing the pipeline to halt (for some reason) and stop processing the images. I must be missing something (could be memory overload) but there weren't any google results when searching this error. Have any of you had this or know what the issue is and how to fix it? Thanks! Code: https://gist.github.com/SnowCrystalz...75f1f4c9971188 - Team 1245 Programming |
|
#2
|
|||
|
|||
|
Re: Error while processing images through OpenCV pipeline
This error occurs when you have opened 10 or more output streams, which you are presumably not trying to do. However, because you put the code that opens an output stream in the vision thread, and start the vision thread each time you run the constructor of this command, it is possible that this code will run multiple times and open a new stream each time. To remedy this you should probably create a single instance of the output stream and access it through the RobotMap instead of creating one each time you construct this command. Hope this helps.
|
|
#3
|
||||
|
||||
|
Re: Error while processing images through OpenCV pipeline
There are a lot of problems with this code.
|
|
#4
|
|||
|
|||
|
Re: Error while processing images through OpenCV pipeline
Thanks for the responses guys!
Regarding the 15 second thread sleep: Fromhttps://wpilib.screenstepslive.com/s/4485/m/24194/l/288984-camera-settings "To custom-calibrate the white balance, place a known neutral object in front of the camera. A sheet of white paper is a reasonable object to start with. Set the white balance setting to auto, wait for the camera to update its filters (ten seconds or so), and switch the white balance to hold." I'll move the code that creates the stream and server outside of the command and put it into RobotMap. I'll also try to move the thread outside of the constructor to see if that works. Thanks for the help, I'll respond back if any of these end up not working or if a new issue arises due to this! - Team 1245 Programming |
|
#5
|
||||
|
||||
|
Re: Error while processing images through OpenCV pipeline
The problem with a call to Thread.sleep() is that the entire program runs on one thread. You're basically freezing the entire robot for 15 seconds to do the calibration.
You also only really need to the calibration once per event. |
|
#6
|
|||
|
|||
|
Re: Error while processing images through OpenCV pipeline
Alright, I've moved everything to a more proper programming structure, here's the relevant code for reference. https://gist.github.com/SnowCrystalz...12f0023b932695
There's still the error, however it occurs when grabbing the frame. It doesn't seem to get further than the if statement. It doesn't even fail it just stalls with the "too many streams" error during the cvSink.grabFrame(mat). I've moved the stream to RobotMap, and as far as I can tell it's the only one that is ever made. That also doesn't explain why it halts during grabFrame. To me it seems as though the cvSink is never created, or there isn't an open stream for it to put the frame into but there clearly is in RobotMap. I am lost. Thanks for the help guys, - Evan : 1245 Programming |
|
#7
|
||||
|
||||
|
Re: Error while processing images through OpenCV pipeline
Too many streams may be caused by the SmartDashboard.
|
|
#8
|
|||
|
|||
|
Re: Error while processing images through OpenCV pipeline
I would say you're correct, but that wouldn't explain why it doesn't run anything after the grabFrame. Even if I start with running the tracking the error still happens after grabFrame. I've had it print a warning to the DriverStation "Grabbed Frame" after and it never printed it out, while it would print something before the grab frame event.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|