Getting pictures consuming a lot of resources

Hi

I’m in charge of writing a videoconference software and I’m using videoInput as a Directshow wrapper for DevC++ (which seems to work quite well). The problem is that it needs a lot of computing, and it seems it comes from the grabbing (since after not using other funtions like encoding still needs a lot of resources). That’s what I’m doing write now:

  
  
class CaptureWidget:public QWidget{  
    Q_OBJECT  
      
private:  
   videoInput VI;  
   int device;      
      
public:  
    //CaptureWidget(double intwidth,double intheight, double intfps);  
    CaptureWidget();  
    ~CaptureWidget();  
    IplImage* getCaptured();  
    unsigned char* rgbdata;  
          
public slots:  
    void getNewFrame();  
  
signals:  
    void frameAcquired();  
      
};  
  

  
  
CaptureWidget::CaptureWidget(){  
      
  int device = 0;  
  VI.setupDevice(device,352,288);  
  }  
  
CaptureWidget::~CaptureWidget(void){  
}  
  
  
////////////////////////////////////////  
//SLOTS  
  
void CaptureWidget::getNewFrame(){  
      
    if(VI.isFrameNew(device)) {   
    rgbdata = VI.getPixels(device, true);                            
    emit frameAcquired();  
    }  
}  
  
  

The getNewFrame() function is called every some miliseconds (so that I can control the frame rate) and after that the data found in rgbdata is encoded and sent.

As you can see what I’m doing is very simple and very similar to the examples, but the computer load is so high that in slower computers it won’t get more that 5 or 6 frames per second. When I use it on my laptop (Pentium M 1.8, 1 Gb RAM) even if I don’t encode, the load is around 80%. I really need to reduce that so that I can increase the frame rate to a decent frequency.

Any ideas? Thanks!

hi - that’s strange, I’m not sure that it should be taking so much resources at all to capture.

can you tell us if:

a) you get the same issue when you use the OF videograbber sample application

b) you get the same issue when you use software like “amCap” for capturing

thanks!
zach

[quote author=“zach”]hi - that’s strange, I’m not sure that it should be taking so much resources at all to capture.

can you tell us if:

a) you get the same issue when you use the OF videograbber sample application

b) you get the same issue when you use software like “amCap” for capturing

thanks!
zach[/quote]

That’s the problem. I tried the videograbber sample and the CPU load is around 50-60%, using the same libraries. This has been causing me trouble for a long time, since capturing is pushing the whole thing back.

In case you might have any ideas, just shoot :smiley:

And thanks for the reply