All you have to do is adapt the frame grabber code for your needs.  I
actually went ahead and rewrote the capture code to be object oriented so
that I could conveniently use it with OpenCV's C++ interface.  You might
find some of my code helpful as an example to work from.  It is in a public
git repo:
https://github.com/mdarling39/LinuxVision/blob/master/

I think you would primarily be interested in taking a look at CamObj.hpp,
CamObj.cpp, and v4l2Cap.h, v4l2Cap.cpp, and/or v4l2_c.h and v4l2_c.c.  As a
word of warning, my code is sloppy and specific for my needs, but it does
what I need it to do.  Feel free to borrow from it and modify it to your
heart's content.

I actually don't remember how all of this stuff works anymore, but you can
look at main_threaded.cpp to see how I am using v4l2_c.h to get frames into
a cv::Mat object.  If I remember right, I had to abandon the
object-oriented approach for some reason so that later so that I could
implement multi-threading using pthreads. I think the magic you are looking
for is in the function v4l2_process_image(cv::Mat, const void), where the
frame buffer is actually decoded and saved to a cv::Mat object. Once you
have that, you're home free and can just deal with OpenCV.

static void v4l2_process_image(cv::Mat &img, const void *p)
{
        cv::Mat buff(img.cols, img.rows, CV_8UC3, (void*)p);
        img = cv::imdecode(buff,CV_LOAD_IMAGE_COLOR);
}


I hope that helps you to get started.  If you need any help, just ask.
 I'll do my best to help where I can.

Good luck,
Mike


On Wed, Jan 29, 2014 at 11:52 AM, Learning Opencv <epsilonor...@gmail.com>wrote:

> I am working with the C920 on an ODroid, similar to the BBB.  I am also
> having a problem capturing more than 15fps in OpenCV, however, I need to
> use OpenCV for doing processing on the video.  Since I am not just grabbing
> frames, I can't do something like framegrabber.  Is there anyone who has
> done this and have a solution.  I have tried changing settings on v4l
> before running my code, but have had no luck.
>
> Thanks.
>
>
> On Monday, November 4, 2013 7:07:58 AM UTC-5, Matthew Witherwax wrote:
>
>> Glad to hear our work is helping others.  Let us know how your endeavors
>> go.
>> -Matthew
>>
>>
>> On Sun, Nov 3, 2013 at 3:22 PM, <josiasina...@gmail.com> wrote:
>>
>>> Excellent, excellent thread! I just purchased my BBB yesterday for a
>>> personal project, and I've been reading for many many hours how and what
>>> would be the best way to stream video from the BBB to a PC over WiFi with
>>> the lowest latency as I could get. This thread, including all the links
>>> that users posted here, were really helpful in understand the steps I
>>> should take.
>>>
>>> I'm just running to the store in a few minutes to buy a C920 and start
>>> trying stuff :) I'm glad I've waited and read a lot before buying the PS3
>>> Eye... Thanks guys. I will update any results I achieve.
>>>
>>> --
>>> For more options, visit http://beagleboard.org/discuss
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "BeagleBoard" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>> topic/beagleboard/G5Xs2JuwD_4/unsubscribe.
>>>  To unsubscribe from this group and all its topics, send an email to
>>> beagleboard...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "BeagleBoard" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/beagleboard/G5Xs2JuwD_4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> beagleboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to