Hi Michael,

A few tips to get better video capture quality in highly dynamic motion 
situations:

* Motion blur is not caused by low frame rate, it is caused by:
    * rolling shutters - global shutters exhibit much better motion capture
    * poor dynamic range - most sub $60 web cams have narrow dynamic 
ranges, so the shutter speed is often long
    * Insufficient light capture - between cheap optics and small CMOS 
chips, lower end cameras tend to do gather little light and thus, again, 
have long shutter times.
* Note that megapixels has almost nothing to do with the above, other than 
that larger CMOS chips usually have higher MP.  People need to stop 
worrying so much about resolution and demand better quality for any given 
resolution.  </soapbox> <!-- your OCD wishes I had the other tag... now I'm 
not even going to finish this comment tag.  ;-)
* If you are paying less than $100 for a given camera, it is almost 
certainly a rolling shutter camera.  If you find a good global shutter, 
high-dynamic range camera for < $100, please let us all know.

Good luck,

-Nate

On Sunday, May 12, 2013 at 11:28:09 PM UTC-6, Michael Darling wrote:
>
>
> 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!)
>
> 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.
>
> 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?
>
> Thanks for any help you can provide.
> -Mike
>
>
> On Tue, Apr 2, 2013 at 1:44 PM, Michael Darling <[email protected] 
> <javascript:>> 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.jpg
>>>
>>>
>>>
>>> But 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 terminating
>>>
>>>
>>> It 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 5000001
>>>>> Capture: channel 0
>>>>> Capture: input 0 ov534 0
>>>>> Capture: format YUYV YUYV
>>>>> Capture: format RGB3 RGB3
>>>>> Capture: format BGR3 BGR3
>>>>> Capture: format YU12 YU12
>>>>> Capture: format YV12 YV12
>>>>> Capture: dimensions 640 x 480
>>>>> Capture: bytes per line 1280
>>>>> Capture: frame rate 30 fps
>>>>> Capture: 4 buffers allocated
>>>>> Capture: buffer length 614400
>>>>> Capture: buffer length 614400
>>>>> Capture: buffer length 614400
>>>>> Capture: buffer length 614400
>>>>> Capture 640 x 480 pixels at 30 fps
>>>>> Capture: select timeout
>>>>> Capture: select timeout
>>>>>
>>>>>
>>>>> Any 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
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected] <javascript:>.
>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to