Monday, November 10, 2014

Test OpenCV on BeagleBone Black using Logitech C920

Here are some basic trials in which I tested OpenCV running on my BBB.

The Logitech C920 webcam did some works which I don't know very well so that the loading on the BBB has been reduced significantly. Other webcams might too ``slow'' for the test program to run directly (I remember the terminal returned `select timeout' errors).

[NOTE: the following videos were boring and showed nothing exciting... :-p]
[Sorry for the small view of the videos. I will find how to enlarge them later...]
[I've uploaded the video clips so that you can view them with better resolution.]

The first one was the result shown via VNC. The image stream was laggy, but the processing time showed it was about 100 to 200 ms.

The second one showed the result without cv::imshow() via VNC. The processing time seemed reduced, but not significantly.

The last one showed the result without cv::imshow() via ssh. The processing time was no more than 100ms.

It seemed that the VNC costed most of the computing resource.

The test code was:

#include <stdio.h>
#include "opencv2/opencv.hpp"                                                                         
int main() {                                                                                          
    cv::VideoCapture cap(0);
        return -1;               

    int64 e1,e2;
    double time;
    for(;;) {                                                                                         
        e1 = cv::getTickCount();
        cv::Mat frame;
        cap >> frame;           

        cv::imshow("match result", frame);                                                            

        e2 = cv::getTickCount();
        time = (e2 - e1)/cv::getTickFrequency()*1000.;

        printf("time: %f ms\n", time);
        if(cv::waitKey(30) >= 0) break;                                                               
    return 0;                                                                                         

No comments:

Post a Comment