Improve PoE performance by introducing MJPEG encoding for streams - #433
Conversation
|
@VanDavv looking good. And just as a cross check, try retesting with a known 1Gbit connection between the device and host to maybe lay out some expected performance numbers which could be added to readme, etc.. |
|
@themarpe callbacks receive decoded frames, in preview manager the frames are decoded as soon as they arrive so access to raw mjpeg frames is limited (although if we'd like to e.g. add a functionality to redirect encoded frames to file, we are still able to add this feature) And will experiment with my setup to test gigabit connection and speeds |
themarpe
left a comment
There was a problem hiding this comment.
LGTM apart from some performance comments as to what to expect in "optimal scenario" for different cases
|
Sweet, thanks both! |
|
Working well for me. So we may want to make the POE default to not show depth until we get that working via an encoded method. That way the framerate will not be reduced by the unencoded depth. We could just show say disparity instead, or just the RGB with physical location. Thoughts? |
|
A quick note @VanDavv - the overlay of depth information for the color stream is quite small: That said, I think we should merge, and refine over time. |
|
One possible improvement for later (general, not related to this PR): the text drawn may not be easy (or not possible) to read, depending on the background image color. And filling solid color rectangles to draw over isn't that nice: We could implement this trick of outlining the text, by double-drawing, first with a larger thickness (that would create the outline), and then the same text again with a smaller thickness and different color: |
|
Yes, great idea - thanks for bringing that up. We should totally do that for all text @VanDavv as that makes it easy to read no matter the background (black or white, or anything in-between). |
|
Yes, that's a great idea! Will merge this PR since it helps in PoE usage and open a new one that addresses the comments above |
|
Introduces the fixes / tweaks here - #434 CC @alex-luxonis @Luxonis-Brandon |




This PR introduces performance improvements by using MJPEG encoding before sending the frames over XLink and then decoding them on the host using OpenCV
imdecodemethod.Due to the current encoder limitations, not all of the preview streams have the encoding enabled:
nn_input(thepassthroughoutput from the nn)colorleftrightrectified_leftrectified_rightdepth_rawdepthdisparitydisparity_colorOne important change that had to be introduced is that now the
colorstream is taken from ColorCameravideooutput instead ofpreview(since onlyvideooutput can be MJPEG encoded at the moment). Using this output, the preview window is not cropped and scaled to meet the nn input size, being full FOV instead - but we wanted to introduce this feature anyway in #422. Issues reported in that PR will probably affect this PR also, but I think we can merge this PR and address them afterward, just so the demo is usable with PoE devices. CC @Luxonis-BrandonPerformance on a single stream can reach up to 28 FPS over ethernet (tested on


-s left)The more streams we request, the slower they will perform. At most, we can request up to 4 encoded streams, at which the performance is 10-12 FPS over Ethernet (tested on
-s left right color disparity disparity_color)Since
disparity_coloranddepthare in fact the transformed versions ofdisparityanddepth_rawrespectively, they do not require a dedicated encoder and therefore can be used without increasing the resources usage on device - so running-s disparity disparity_colorwill use the same amount of resources as-s disparity, as all transformations are performed on host