Skip to main content

Some notes - opencv

Just quickly throwing a recording app together yesterday I found that the video size wasn't being changed - a little digging suggests that the reliance on icv_SetPropertyCAM_V4L is always going to fail if the change in resolution between the width and height calls result in an unsupported resolution on the first call. Why isn't a simple call to set the video size with both height and width  parameters by exposing icvSetVideoSize supported?

Its not my aim to patch opencv though, so for my purposes I've updated the values for DEFAULT_V4L_WIDTH and DEFAULT_V4L_HEIGHT in highgui/src/cap_v4l.cpp for 1280x720 and rebuilt. Yes its a fudge, and if I remember I'll have to bug it.

But with that fixed I have a little recorder application ready to go with the only issue left to solved being, well, the usual fun games and open source politics. I get the following error when recording :
Corrupt JPEG data: 1 extraneous bytes before marker 0xd0
Reading this http://forums.quickcamteam.net/showthread.php?tid=1439 thread suggests that ffmpegs MJPEG support is broken. There's a patch to fix it, but it will need manually applying. I want to avoid to many custom changes to 3rd party libs hence I'm going to ignore that for now and try and get openCV to use YUYV rather than MJPEG but my initial attempt at that failed. Hoping to get some video recorded while there's some sunshine about hence that's one for later.

Oh an extra note - calls to :

cv.SetCaptureProperty( capture, cv.CV_CAP_PROP_FPS, fps )

appear to work but if I try :

cv.GetCaptureProperty( capture, cv.CV_CAP_PROP_FPS )

I get -1 returned. In addition although the initial set returns without error, if I try to set it too high, because I'm using the same FPS as in the initial set, to set the video FPS, this can result in some funky high speed video recordings.

*sigh*

Of course I could have left well enough alone and just used the defaults which did work fine.

UPDATE: A little more playing reveals that setting WITH_JPEG=OFF in CMakeCache.txt switches off JPEG support (command line switch changed or broken?) and finally we can access the YUYV stream. Sadly though the performance is about 1/2 of that of the MJPEG stream :/

Comments

Popular posts from this blog

I know I should move on and start a new blog but I'm keeping this my temporary home. New project, massive overkill in website creation. I've a simple project to put up a four page website which was already somewhat over specified in being hosted on AWS and S3. This isn't quite ridiculous enough though so I am using puppet to manage an EC2 instance (it will eventually need some server side work) and making it available in multiple regions. That would almost have been enough but I'm currently working on being able to provision an instance either in AWS or Rackspace because...well...Amazon might totally go down one day! Yes, its over-the-top but I needed something simple to help me climb up the devops and cloud learning curve. So off the bat - puppet installation. I've an older 10.04 Ubuntu virtual server which has been somewhat under-taxed so I've set that up as a puppet master. First lesson - always use the latest version from a tarball unless you have kept t

Prototype Hardware Rig

Its late here so I'm a brief post. As I've said, hardware wise there are a lot of options as to where to place the various components for a WGI and a few studies out there have looked at the various components in some depth (TODO refs). However an obvious constraint for this project is available resources (hardware, time, money etc) and when it comes to the act of physically assembling thing, and doing so quickly, for my first build it is almost a matter of just making the best out of things. Hence I present the rigging for O6Sense FG v0.01 which has been inspired by observing the trend towards the wearing of large closed-cup headphones and the opportunities this opens in having a "socially acceptable" wearable prototype. What is it? Its a pair of cheap headphones with the cups cut off and 2 Rode pop-shield mounts fitted into the rear wire loops. I cant help but feel some providence at work here since not only is the rear arm a snug fit the screw holes are the ex