Bayer conversion eating CPU!
Posted: 03 January 2011 05:40 AM   [ Ignore ]
New Member
Rank
Total Posts:  7
Joined  2010-11-03

A simple test - 2 cameras running VGA @ 60fps, dual core e6300 CPU @ 2.5ghz:

1. Basic loop, grabbing frames, using CL_COLOR_RAW - CPU usage: 20%
2. Same loop using CL_BAYER_RAW - CPU usage: 3% CPU usage

Conclusion: bayer conversion is wasting CPU cycles. This is a complex operation, but is it required?

AlexP’s post here suggests that bayer mode is used to transfer from the camera to reduce bus usage.
http://codelaboratories.com/forums/viewthread/168/#489

Would it be possible to let the camera perform the bayer conversion instead? Granted, this would limit the combined FPS of all cameras due to the limits of USB2, but it would allow us to do MUCH more computation between frames.

AlexP, would you consider adding an option to do this? It would be extremely useful!

Thanks smile

Profile
 
 
Posted: 07 January 2011 04:56 AM   [ Ignore ]   [ # 1 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  162
Joined  2009-09-17

I’ll relay this to Alex your title is somewhat confusing is it COLOR_RAW or BAYER_RAW which takes more CPU? From your spects COLOR_RAW takes 20% and BAYER 3% so do you mean COLOR_RAW mode is eating CPU?

Profile
 
 
Posted: 10 January 2011 04:33 AM   [ Ignore ]   [ # 2 ]
New Member
Rank
Total Posts:  7
Joined  2010-11-03

Thanks for your help!

COLOR_RAW takes 20% CPU and BAYER_RAW takes 3%. Bear in mind this is with two cameras. Four cameras would probably use up to 40% CPU!

This is because in both cases the camera is sending bayer encoded information over USB. To get COLOR_RAW, the driver has to perform the bayer conversion, which is very CPU intensive (huge amounts of linear interpolation).

However, I believe the camera can be set up to do the bayer conversion itself and send the RGB data over USB. This requires 3 times the USB bandwidth, but will dramatically cut CPU usage, which is important for real time applications smile  I would much rather spend $60 on a PCIe USB card and have my CPU freed!

So, ideally, I would love there to be an extra command in the cleye sdk, which allows users to request data to be sent in RGB format instead. This would make the SDK far more useful for people making real time applications, where every CPU cycle counts.

Profile
 
 
Posted: 13 February 2011 12:21 PM   [ Ignore ]   [ # 3 ]
New Member
Rank
Total Posts:  7
Joined  2010-11-03

For anyone interested, the best solution I’ve found so far is to use CL_BAYER_RAW and then do the bayer conversion with OpenCV.

With 2 cameras, cleye uses 20% CPU while OpenCV uses a much more healthy 6% CPU on a 2.5ghz dual core processor.

Profile
 
 
 
 


RSS 2.0     Atom Feed