Enter code here...
CvCapture* capture = 0;
capture = cvCaptureFromCAM(-1);
//set camera resolution to low, perform object detection //then set resolution to high, and capture images
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, 640 ); cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, 480 );
if (!capture) printf("error opening capture"); else { printf("Resolution set, entering loop... \r\n"); IplImage* image = cvQueryFrame( capture ); image = cvQueryFrame( capture ); if( !image ) return 0;
printf("Saving Image\n\r"); cvSaveImage("cam.jpg", image); //save the image //start=time(NULL); //get current time in seconds }
I have had similar problems: http://beagleboard.org/project/stacheHas anyone had success using the PS3 Eye with OpenCV on the BeagleBone? I have been able to capture images in 320x240 resolution, but need to take advantage of the PS3 Eye's higher resolution (640x480) and frame rate (60 Hz) for my project. I am brand new to the BeagleBone and embedded linux, but have read that a driver patch is required to use the PS3 Eye at higher resolutions and frame rates. [1] Can anyone confirm whether or not I should be able to capture frames at 640x480 without a patch?
I am using the C++ interface of OpenCV and have tried setting the resolution through VideoCapture::set,
cv::VideoCapture cap(0);
cap.set(CV_CAP_PROP_FRAME_WIDTH,640.0);
cap.set(CV_CAP_PROP_FRAME_HEIGHT,480.0);but this returns the following errors: (the program runs successfully if the resolution is set to 320x240, or the properties are not set at all).
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
select timeout
select timeout
^CI am using a Rev A6a board running the latest BeagleBone image :
root@beaglebone:~# cat /etc/angstrom-version
Angstrom v2012.05 (Core edition)
Built from branch: denzil
Revision: 38faf241f6666527870da99f5560c92ae1b5ee8c
Target system: arm-angstrom-linux-gnueabiAny advice is greatly appreciated!
-Mike[1] http://www.electronsonradio.com/2011/05/openembbeded-linux-kernel-adding-pseye-patched-modules/
As an update, I have dug into the OpenCV source code a little bit and believe that I may have found the source of my problem. In /OpenCV/modules/highgui/src/ there are two files named "cap_v4l.cpp" and "cap_lib_v4l.cpp" that seem to be handling the camera through the Video4Linux API. Both of these files querey the camera's capabilities (including the maximum height/width supported by the camera). It does this by first determining if the device is V4L or V4L2 compatible and then doing something like:
/* Query the newly opened device for its capabilities */
//# if V4L:
ioctl(capture->deviceHandle, VIDIOCGCAP, &capture->capability)
//# if V4L2:
xioctl (capture->deviceHandle, VIDIOC_QUERYCAP, &capture->cap)
And later, the OpenCV code attempts to readjust the resolution to be less than or equal to the maximum supported resolution. (I'm working with version 2.4.2 of OpenCV -- available here: http://sourceforge.net/projects/opencvlibrary/files/?source=navbar)
if (capture==0) return 0;
if (w>capture->capability.maxwidth) {
w=capture->capability.maxwidth;
}
if (h>capture->capability.maxheight) {
h=capture->capability.maxheight;
}
capture->captureWindow.width=w;
capture->captureWindow.height=h;
//# (other stuff)
}
Again, I know that my camera (PS3 Eye) supports 640x480 resolution (and I have confirmed this by invoking "v4l2-ctl -V" in a terminal window on the beagle bone, which reports 320x240 and 640x480 as supported resolutions. This leads me to believe that OpenCV is not querying the camera's resolution correctly. I have tried to comment out the lines that resize the height/width and rebuild OpenCV from source on the BeagleBone using the simple cmake/ make/ make install instructions provided here (http://opencv.willowgarage.com/wiki/InstallGuide_Linux), but end up with some kind of "Out of memory" error about 76% of the way through the build. I have started looking into cross-compiling OpenCV for the BeagleBone, but haven't got a clue what I am doing and have no idea if commenting out these lines would solve my problem anyways.
Can anyone offer any advice on how I should proceed with this? Many thanks to anyone who takes a look at this.
[ 5.277099] PHY 0:01 not found[ 5.289520] ADDRCONF(NETDEV_UP): eth0: link is not ready[ 76.481750] usb 1-1: new high-speed USB device number 2 using musb-hdrc[ 76.624176] usb 1-1: New USB device found, idVendor=1415, idProduct=2000[ 76.624206] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0[ 76.624237] usb 1-1: Product: USB Camera-B4.09.24.1[ 76.624237] usb 1-1: Manufacturer: OmniVision Technologies, Inc.[ 77.393920] gspca_main: v2.14.0 registered[ 77.401489] gspca_main: ov534-2.14.0 probing 1415:2000[ 77.563629] usbcore: registered new interface driver ov534
[ 577.672908] ftdi_sio 1-2.1:1.1: device disconnected
[ 583.768329] usb 1-2: new high-speed USB device number 5 using ehci_hcd
[ 583.903707] usb 1-2: New USB device found, idVendor=1415, idProduct=2000
[ 583.903718] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 583.903725] usb 1-2: Product: USB Camera-B4.09.24.1
[ 583.903732] usb 1-2: Manufacturer: OmniVision Technologies, Inc.
[ 583.985507] gspca_main: v2.14.0 registered
[ 583.990621] gspca_main: ov534-2.14.0 probing 1415:2000
[ 585.594388] usbcore: registered new interface driver snd-usb-audio
[ 585.595905] usbcore: registered new interface driver ov534
VIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argument
VIDIOC_QBUF: Invalid argumentVIDIOC_QBUF: Invalid argumentVIDIOC_QBUF: Invalid argumentVIDIOC_QBUF: Invalid argumentVIDIOC_QBUF: Invalid argumentVIDIOC_QBUF: Invalid argument
CMake Error at CMakeLists.txt:15 (find_package):
Could not find module FindOpenCV.cmake or a configuration file for package
OpenCV.
Adjust CMAKE_MODULE_PATH to find FindOpenCV.cmake or set OpenCV_DIR to the
directory containing a CMake configuration file for OpenCV. The file will
have one of the following names:
OpenCVConfig.cmake
opencv-config.cmakeCapture: capabilities 5000001Capture: channel 0Capture: input 0 ov534 0Capture: format YUYV YUYVCapture: format RGB3 RGB3Capture: format BGR3 BGR3Capture: format YU12 YU12Capture: format YV12 YV12Capture: dimensions 640 x 480Capture: bytes per line 1280Capture: frame rate 30 fpsCapture: 4 buffers allocatedCapture: buffer length 614400Capture: buffer length 614400Capture: buffer length 614400Capture: buffer length 614400Capture 640 x 480 pixels at 30 fpsCapture: select timeoutCapture: select timeout
ubuntu@arm:~/Motion$ motion -c loResMotion.conf[0] Processing thread 0 - config file hiResMotion.conf[0] Motion 3.2.12 Started[0] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478784[0] Thread 1 is from hiResMotion.conf[0] motion-httpd/3.2.12 running, accepting connections[0] motion-httpd: waiting for data on port TCP 8080[1] Thread 1 started[1] cap.driver: "ov534"[1] cap.card: "USB Camera-B4.09.24.1"[1] cap.bus_info: "usb-musb-hdrc.1-1"[1] cap.capabilities=0x05000001[1] - VIDEO_CAPTURE[1] - READWRITE[1] - STREAMING[1] Config palette index 8 (YU12) doesn't work.[1] Supported palettes:[1] 0: YUYV (YUYV)[1] Selected palette YUYV[1] Test palette YUYV (320x240)[1] Using palette YUYV (320x240) bytesperlines 640 sizeimage 153600 colorspace 00000008[1] found control 0x00980900, "Brightness", range 0,255[1] "Brightness", default 0, current 0[1] found control 0x00980901, "Contrast", range 0,255[1] "Contrast", default 32, current 32[1] found control 0x00980911, "Exposure", range 0,255[1] "Exposure", default 120, current 120[1] found control 0x00980912, "Auto Gain", range 0,1[1] "Auto Gain", default 1, current 1[1] found control 0x00980913, "Main Gain", range 0,63[1] "Main Gain", default 20, current 20[1] mmap information:[1] frames=4[1] 0 length=155648[1] 1 length=155648[1] 2 length=155648[1] 3 length=155648[1] Using V4L2[1] Resizing pre_capture buffer to 1 items[1] Started stream webcam server in port 8081[1] File of type 8 saved to: /tmp/motion/01-20130402201014.swf[1] File of type 1 saved to: /tmp/motion/01-20130402201014-00.jpg[1] File of type 1 saved to: /tmp/motion/01-20130402201018-01.jpg[1] File of type 1 saved to: /tmp/motion/01-20130402201019-01.jpg[1] File of type 1 saved to: /tmp/motion/01-20130402201021-00.jpg
ubuntu@arm:~/Motion$ motion -c hiResMotion.conf[0] Processing thread 0 - config file hiResMotion.conf[0] Motion 3.2.12 Started[0] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478784[0] Thread 1 is from hiResMotion.conf[0] motion-httpd/3.2.12 running, accepting connections[0] motion-httpd: waiting for data on port TCP 8080[1] Thread 1 started[1] cap.driver: "ov534"[1] cap.card: "USB Camera-B4.09.24.1"[1] cap.bus_info: "usb-musb-hdrc.1-1"[1] cap.capabilities=0x05000001[1] - VIDEO_CAPTURE[1] - READWRITE[1] - STREAMING[1] Config palette index 8 (YU12) doesn't work.[1] Supported palettes:[1] 0: YUYV (YUYV)[1] Selected palette YUYV[1] Test palette YUYV (640x480)[1] Using palette YUYV (640x480) bytesperlines 1280 sizeimage 614400 colorspace 00000008[1] found control 0x00980900, "Brightness", range 0,255[1] "Brightness", default 0, current 0[1] found control 0x00980901, "Contrast", range 0,255[1] "Contrast", default 32, current 32[1] found control 0x00980911, "Exposure", range 0,255[1] "Exposure", default 120, current 120[1] found control 0x00980912, "Auto Gain", range 0,1[1] "Auto Gain", default 1, current 1[1] found control 0x00980913, "Main Gain", range 0,63[1] "Main Gain", default 20, current 20[1] mmap information:[1] frames=4[1] 0 length=614400[1] 1 length=614400[1] 2 length=614400[1] 3 length=614400[1] Using V4L2[1] Resizing pre_capture buffer to 1 items[1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 0): Input/output error[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] Error capturing first image[1] Started stream webcam server in port 8081[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] Video device fatal error - Closing video device[1] Closing video device /dev/video0[1] Retrying until successful connection with camera[1] cap.driver: "ov534"[1] cap.card: "USB Camera-B4.09.24.1"[1] cap.bus_info: "usb-musb-hdrc.1-1"[1] cap.capabilities=0x05000001[1] - VIDEO_CAPTURE[1] - READWRITE[1] - STREAMING[1] Config palette index 8 (YU12) doesn't work.[1] Supported palettes:[1] 0: YUYV (YUYV)[1] Selected palette YUYV[1] Test palette YUYV (640x480)[1] Using palette YUYV (640x480) bytesperlines 1280 sizeimage 614400 colorspace 00000008[1] found control 0x00980900, "Brightness", range 0,255[1] "Brightness", default 0, current 0[1] found control 0x00980901, "Contrast", range 0,255[1] "Contrast", default 32, current 32[1] found control 0x00980911, "Exposure", range 0,255[1] "Exposure", default 120, current 120[1] found control 0x00980912, "Auto Gain", range 0,1[1] "Auto Gain", default 1, current 1[1] found control 0x00980913, "Main Gain", range 0,63[1] "Main Gain", default 20, current 20[1] mmap information:[1] frames=4[1] 0 length=614400[1] 1 length=614400[1] 2 length=614400[1] 3 length=614400[1] Using V4L2[1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 0): Input/output error[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] Video device fatal error - Closing video device[1] Closing video device /dev/video0^C[0] httpd - Finishing[0] httpd Closing[0] httpd thread exit[1] Thread exiting[0] Motion terminating
--
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?hl=en.
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.
I have three posts on this page starting at May 11 (way towards the bottom of the page). It links to some sloppy code that I put up on GitHub. You might find it useful. I believe I was running the most recent version of Ubuntu for the BeagleBone at the time.If I remember right, the biggest problem was that the standard OpenCV capture code does not adjust the camera framerate like it should (i.e. if you try to set the framerate to 30 fps, the camera actually stays at the default 60 fps setting). I haven't been able to capture 640x480 at 60 fps, (possibly limitations of the board's hardware?) so you have to settle for a lower framerate. To actually set the framerate you have to use a custom piece of capture code that you can compile along with the rest of your project.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/G5Xs2JuwD_4/unsubscribe.
--
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...@googlegroups.com.
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...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
--
--
CvMat cvmat = cvMat(HEIGHT, WIDTH, CV_8UC3, (void*)buffer);
IplImage * img;
img = cvDecodeImage(&cvmat, 1);
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...@googlegroups.com.
--
On Mon, 23 Sep 2013 01:48:18 -0700
Michael Darling <fndrpl...@gmail.com>
wrote:
> I have confirmed that it is indeed possible to grab AND convert
> frames at 640x480 and 30 fps with the BBB and Logitech C920 operating
The ps3 eye could not do this or have you tried yet?
Will you say what the application is? Or at least is it a stationary
camera? Or is it something like for robot vision? Using that Motion
app (mentioned previously) would get higher frame-rate, I think.
Unless Motion is post-processing. I'm sure not all USB cams are
created equal. But I wonder how much can be done via USB.
Seems to me that image substraction (or whatever the correct term)
would probably need to happen at the hardware level to get any
capture rate increase. So maybe there's no way to get a higher
frame rate due to hardware limitations.
>
> Thanks,
> -Mike
>
>
> On Sat, Sep 21, 2013 at 4:48 PM, Matthew Witherwax
> <able...@gmail.com>wrote:
>
> > Jon,
> >
> > I hope you find it useful. I would appreciate any feedback you
> > have to give.
> >
> > Best of luck,
> > Matthew
> >
> >
> > On Sat, Sep 21, 2013 at 4:54 AM, <jescombe-gM/Ye1E23mwN
> > +BqQ9...@public.gmane.org> wrote:
> >
> >> Matthew,
> >>
> >> Thanks! That may be really useful for me. Am messing around with a
> >> PTZ camera at the moment, and lag in the video stream has been a
> >> bit of a problem so far..
> >>
> >> Regards,
> >> Jon
> >>
> >>
> >> On Friday, 20 September 2013 14:01:23 UTC+1, Matthew Witherwax
> >> wrote:
> >>>
> >>> William,
> >>>
> >>> I have posted my streaming code and writeup here
> >>>
> >>>
> >>> --
> >> 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+unsubscribe-/JYPxA39Uh5TLH3MbocFF
> >> +G/Ez6Z...@public.gmane.org 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+unsubscribe-/JYPxA39Uh5TLH3MbocFF
> > +G/Ez6Z...@public.gmane.org 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
> +unsub...@googlegroups.com. For
On Tue, 24 Sep 2013 13:41:14 -0500
Matthew Witherwax <able...@gmail.com>
wrote:
> Richard,
>
> Please see the post
> http://blog.lemoneerlabs.com/post/BBB-webcamsconcerning the PS3Eye,
> C920, and frame rates. I believe it will answer
> your questions.
Ok it seems that OpenCV is the limiter. But the camera is significant.
I like the idea of using a USB camera due to low cost. But I dont like
it due to limited features. However the limitations of cheap USB might
be overcome by using two cameras. Although only to a small degree.
Probably need a camera cape to get at the camera features. And a
feature-full camera. I am thinking of repurposing a video camera
as most have lots of features but are fairly cheap.
Formatting has been corrected.Captured count and processed count variables have been renamed and moved to the top.-o 2 would convert every 2nd or ever other, etc-o 1 would convert every frame-o is not used to indicate which frames to convert to OpenCV Mats and requires an integer argumentMike,Here is the cleaned up one. Here are the differences:
default is 1-p is similar to -o in the original framegrabber. However, it doesn't actually output anything. It just controls if any frames are to be converted.
Testing of your procedure to follow.
On Wed, Sep 25, 2013 at 12:55 PM, Matthew Witherwax wrote:
Mike,Looking over the code in you document, I noticed some formatting was off and I needed to clean up the way I handled processing the subset of the frames. I am cleaning things up and will get you a new version shortly.
On Tue, Sep 24, 2013 at 8:53 PM, Michael Darling wrote:
Thanks! You're absolutely welcome to distribute it freely. I don't have my own website so that's a great way to share the information.Luckily I have most of my CV algorithm done. I have a bit of cleaning up to do but most of my work is implementing hardware from here on out.Thanks again SO much for your help! I look forward to getting feedback on the write up.
-Mike
On Tuesday, September 24, 2013, Matthew Witherwax wrote:
Mike,Great write up. When I have some free time, I will replicate your steps on my BBB running Arch Linux. Not sure if you have a personal website, but would you mind me posting this to my blog once it makes it out of draft?
I look forward to seeing your aircraft in action; on to the CV problems!
On Tue, Sep 24, 2013 at 7:39 PM, Michael Darling wrote:
Hi Richard,Here is a summary of what I ended up doing to get 30 fps out of the BBB. You are right -- it simply came down to taking advantage of NEON hardware acceleration. My little "How-To" guide might be a bit verbose, but you can skip all of the background information and skip right to the steps I took if you like. However reading some of the background information might give you some more insight into what I have already tried with the PS3 Eye (along with many others like Matthew) and what we have learned. Its also chock-full of great references on the topic.Right now, I am considering this a DRAFT as I have not gone back through to make sure that all the commands I pasted will work verbatim. If you're pretty comfortable in Linux, I'm sure this is enough for you to replicate what I have done.I wrote it up in LaTeX, as that was the easiest for me, so here it is in both PDF and HTML format.Best of luck. If you end up taking a look at this, please let me know if you have any comments or suggestions for improvement.-Mike
On Tue, Sep 24, 2013 at 3:52 PM, rh_ wrote:
On Tue, 24 Sep 2013 13:41:14 -0500
Matthew Witherwax
wrote:
> http://blog.lemoneerlabs.com/post/BBB-webcamsconcerning the PS3Eye,
> Richard,
>
> Please see the post
> C920, and frame rates. I believe it will answerOk it seems that OpenCV is the limiter. But the camera is significant.
> your questions.
I like the idea of using a USB camera due to low cost. But I dont like
it due to limited features. However the limitations of cheap USB might
be overcome by using two cameras. Although only to a small degree.
Probably need a camera cape to get at the camera features. And a
feature-full camera. I am thinking of repurposing a video camera
as most have lots of features but are fairly cheap.
--
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+unsubscribe@googlegroups.com.
--
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+unsubscribe@googlegroups.com.
--
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
--
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+unsubscribe@googlegroups.com.
Hi,I'm running Ubuntu 11.10 and I'm trying to develop an application using opencv and a webcam. I'm running into problems whenever I try for resolutions higher than 320x240. I tried using the Ps3Eye (driver is gspca_ov534) and the logitech C260 (driver is uvcvideo). At 320x240 it seems to work fine and I get a saved image with the occasional "select timeout" error.However, when I try to run at 640x480 I get this output (with a black image file):VIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentVIDIOC_QUERYMENU: Invalid argumentResolution set, entering loop...select timeoutselect timeoutSaving ImageAny ideas on how to fix this error? It would be great to be able to save higher resolution images... are there other ways to grab a still from the webcam?Enter code here...CvCapture* capture = 0;capture = cvCaptureFromCAM(-1);//set camera resolution to low, perform object detection//then set resolution to high, and capture imagescvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, 640 );cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, 480 );if (!capture)printf("error opening capture");else{printf("Resolution set, entering loop... \r\n");IplImage* image = cvQueryFrame( capture );image = cvQueryFrame( capture );if( !image )return 0;printf("Saving Image\n\r");cvSaveImage("cam.jpg", image); //save the image//start=time(NULL); //get current time in seconds}
--
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.
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.
--
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.
--
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);}
--
Hi all,I worked on this project a while back - www.ben-dror.com/pinokio I want to get it running on a beagle bone.I have purchased a BBB and a ps3 eye. OpenCV face-tracking seems to run at a very low frame-rate. I guess I am looking for around 15fps.Please any insights would be greatly appreciated.Adam
For more options, visit https://groups.google.com/d/optout.
For my application, it is okay if I only grab frames at 10 Hz, but I need to have the camera operating at high enough of a frame rate that I can eliminate motion blur. I'm not very familiar with Video4Linux or the nitty-gritty of capturing frames from a webcam, so I was wondering if you might be able to provide some guidance. Is there any way to be able to eliminate motion blur with a slow embedded processor and just tolerate dropped frames, or am I pretty much hosed?I am able to set the camera to 15fps and capture frames without select timeout errors, however I end up with significant motion blur due to the low framerate. (Again, I plan to put this system on an airplane, so that won't cut it for me.) I blindly made a couple of adjustments to your code, and am able to get frames with the camera set at 30 fps if I open 3 instances of my program, then close two. (This is what I have to do on my Mac with the 3rd party macam driver for the PS3 Eye -- thats where I got the idea from.) Unfortunately, even at the 30 fps setting, I really am only getting about 10.
Hi Martin,
I'm not sure if you're still interested in helping me, but I did want to let you know that I have finally been able to grab 640x480 frames on my BeagleBone from the PS3 webcam. I did end up using your custom capture code since the framerate setting in OpenCV doesn't work. (Thanks!)
Thanks for any help you can provide.-MikeOn Tue, Apr 2, 2013 at 1:44 PM, Michael Darling <fndrpl...@gmail.com> wrote:sorry just to be clear... the conf file i used was actually called hiResMotion.conf both times. i just changed the resolution between the two instances.
On Tuesday, April 2, 2013 1:19:09 PM UTC-7, Michael Darling wrote:Hi Martin,Sorry it took me so long to get back. I was having problems getting a stable version of Ubuntu installed on my board. A new version was just released and that solved my problems.
I just installed the motion package. I copied the default motion.conf file to my working directory, renamed it, and changed the width and height values to 320 and 240, respectively -- Everything works as expected using the PS3 Eye:ubuntu@arm:~/Motion$ motion -c loResMotion.conf[0] Processing thread 0 - config file hiResMotion.conf[0] Motion 3.2.12 Started[0] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478784[0] Thread 1 is from hiResMotion.conf[0] motion-httpd/3.2.12 running, accepting connections[0] motion-httpd: waiting for data on port TCP 8080[1] Thread 1 started[1] cap.driver: "ov534"[1] cap.card: "USB Camera-B4.09.24.1"[1] cap.bus_info: "usb-musb-hdrc.1-1"[1] cap.capabilities=0x05000001[1] - VIDEO_CAPTURE[1] - READWRITE[1] - STREAMING[1] Config palette index 8 (YU12) doesn't work.[1] Supported palettes:[1] 0: YUYV (YUYV)[1] Selected palette YUYV[1] Test palette YUYV (320x240)[1] Using palette YUYV (320x240) bytesperlines 640 sizeimage 153600 colorspace 00000008[1] found control 0x00980900, "Brightness", range 0,255[1] "Brightness", default 0, current 0[1] found control 0x00980901, "Contrast", range 0,255[1] "Contrast", default 32, current 32[1] found control 0x00980911, "Exposure", range 0,255[1] "Exposure", default 120, current 120[1] found control 0x00980912, "Auto Gain", range 0,1[1] "Auto Gain", default 1, current 1[1] found control 0x00980913, "Main Gain", range 0,63[1] "Main Gain", default 20, current 20[1] mmap information:[1] frames=4[1] 0 length=155648[1] 1 length=155648[1] 2 length=155648[1] 3 length=155648[1] Using V4L2[1] Resizing pre_capture buffer to 1 items[1] Started stream webcam server in port 8081[1] File of type 8 saved to: /tmp/motion/01-20130402201014.swf[1] File of type 1 saved to: /tmp/motion/01-20130402201014-00.jpg[1] File of type 1 saved to: /tmp/motion/01-20130402201018-01.jpg[1] File of type 1 saved to: /tmp/motion/01-20130402201019-01.jpg[1] File of type 1 saved to: /tmp/motion/01-20130402201021-00.jpgBut if I change the height and width in the conf file to 640 and 480, respectively, I get the following:ubuntu@arm:~/Motion$ motion -c hiResMotion.conf[0] Processing thread 0 - config file hiResMotion.conf[0] Motion 3.2.12 Started[0] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478784[0] Thread 1 is from hiResMotion.conf[0] motion-httpd/3.2.12 running, accepting connections[0] motion-httpd: waiting for data on port TCP 8080[1] Thread 1 started[1] cap.driver: "ov534"[1] cap.card: "USB Camera-B4.09.24.1"[1] cap.bus_info: "usb-musb-hdrc.1-1"[1] cap.capabilities=0x05000001[1] - VIDEO_CAPTURE[1] - READWRITE[1] - STREAMING[1] Config palette index 8 (YU12) doesn't work.[1] Supported palettes:[1] 0: YUYV (YUYV)[1] Selected palette YUYV[1] Test palette YUYV (640x480)[1] Using palette YUYV (640x480) bytesperlines 1280 sizeimage 614400 colorspace 00000008[1] found control 0x00980900, "Brightness", range 0,255[1] "Brightness", default 0, current 0[1] found control 0x00980901, "Contrast", range 0,255[1] "Contrast", default 32, current 32[1] found control 0x00980911, "Exposure", range 0,255[1] "Exposure", default 120, current 120[1] found control 0x00980912, "Auto Gain", range 0,1[1] "Auto Gain", default 1, current 1[1] found control 0x00980913, "Main Gain", range 0,63[1] "Main Gain", default 20, current 20[1] mmap information:[1] frames=4[1] 0 length=614400[1] 1 length=614400[1] 2 length=614400[1] 3 length=614400[1] Using V4L2[1] Resizing pre_capture buffer to 1 items[1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 0): Input/output error[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] Error capturing first image[1] Started stream webcam server in port 8081[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] Video device fatal error - Closing video device[1] Closing video device /dev/video0[1] Retrying until successful connection with camera[1] cap.driver: "ov534"[1] cap.card: "USB Camera-B4.09.24.1"[1] cap.bus_info: "usb-musb-hdrc.1-1"[1] cap.capabilities=0x05000001[1] - VIDEO_CAPTURE[1] - READWRITE[1] - STREAMING[1] Config palette index 8 (YU12) doesn't work.[1] Supported palettes:[1] 0: YUYV (YUYV)[1] Selected palette YUYV[1] Test palette YUYV (640x480)[1] Using palette YUYV (640x480) bytesperlines 1280 sizeimage 614400 colorspace 00000008[1] found control 0x00980900, "Brightness", range 0,255[1] "Brightness", default 0, current 0[1] found control 0x00980901, "Contrast", range 0,255[1] "Contrast", default 32, current 32[1] found control 0x00980911, "Exposure", range 0,255[1] "Exposure", default 120, current 120[1] found control 0x00980912, "Auto Gain", range 0,1[1] "Auto Gain", default 1, current 1[1] found control 0x00980913, "Main Gain", range 0,63[1] "Main Gain", default 20, current 20[1] mmap information:[1] frames=4[1] 0 length=614400[1] 1 length=614400[1] 2 length=614400[1] 3 length=614400[1] Using V4L2[1] v4l2_next: VIDIOC_DQBUF: EIO (s->pframe 0): Input/output error[1] v4l2_next: VIDIOC_QBUF: Invalid argument[1] Video device fatal error - Closing video device[1] Closing video device /dev/video0^C[0] httpd - Finishing[0] httpd Closing[0] httpd thread exit[1] Thread exiting[0] Motion terminatingIt looks like the motion package is using Video4Linux, according to the Motion homepage. Besides the fact that I am using a Rev. A6a board, what could possibly be different in my setup compared to yours? I am running the 2013-03-28 Quantal 12.10 version of Ubuntu for BeagleBone.Thanks!
On Wednesday, March 13, 2013 7:57:21 AM UTC-7, Martin wrote:Just out of curiosity:Have you had a look at the "motion" package (http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome)?I am using this on a beaglebone A3 board running ubuntu. Motion can be installed using "sudo apt-get install motion". On my board it can capture 640x480 images without problems.
I am not sure if motion uses OpenCV or how it grabs images from the camera.But maybe worth a look if you can get it to work for your camera and board, and if it works take a look at how it does the capture, I believe there is source code available.Martin
On Tuesday, March 12, 2013 7:57:36 PM UTC, Michael Darling wrote:Update: I set up a simple OpenCV script to capture frames using the tools developed by Martin Fox. 320x240 frames are captured no problems, but no luck at 640x480 -- same select timeout errors. The result was the same for all three cameras I tried:
Capture: capabilities 5000001Capture: channel 0Capture: input 0 ov534 0Capture: format YUYV YUYVCapture: format RGB3 RGB3Capture: format BGR3 BGR3Capture: format YU12 YU12Capture: format YV12 YV12Capture: dimensions 640 x 480Capture: bytes per line 1280Capture: frame rate 30 fpsCapture: 4 buffers allocatedCapture: buffer length 614400Capture: buffer length 614400Capture: buffer length 614400Capture: buffer length 614400Capture 640 x 480 pixels at 30 fpsCapture: select timeoutCapture: select timeoutAny other ideas?
--
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?hl=en.