Jump to content

Stargazers Lounge Uses Cookies

Like most websites, SGL uses cookies in order to deliver a secure, personalised service, to provide social media functions and to analyse our traffic. Continued use of SGL indicates your acceptance of our cookie policy.

stargazine_ep24_banner.thumb.jpg.56e65b9c9549c15ed3f06e146fc5f5f1.jpg

gdheib0430

Xbox Livecam Mod (Cliff)

Recommended Posts

Well, have I been having fun with Linux video camera driver software today. Err, no :D

I now have some code that turns off the auto-exposure and sets the exposure time on the camera and it looks ok to me. However, it will just not get on with the Xbox camera, getting timeout after timeout inside the UVC driver code. Pulling that apart eventually suggested to me that there is some sort of significant performance problem in the Xbox camera hardware that means it can't cope with fast sequences of commands and as a last resort I stuck in a one second pause after every single call to change the camera configuration. Tada! It now works almost faultlessly.

"Almost" being the key word :( The V4L2 interface is specifically designed to allow an application to query a camera to find out what options it supports in terms of user configuration, and what ranges those options take. For manual exposure, the data read from the camera says that exposure goes in steps of one unit from a minimum of 0 to a maximum of -1. I have no idea how to interpret that unless there's some sort of sign-extension issue somewhere in the system. As a result I'm now trying lots of possible exposure settings to see what happens. Many of them appear to result in a completely white image even when the sensor is face down on a dark object, so I have no idea what's going on there, but I'll see how it goes as I collect more information.

James

Share this post


Link to post
Share on other sites

Actually, in case anyone thinks I'm being hard on the Xbox camera, the driver for the SPC900 is a pile of steaming ordure. Until the v3.0.0 kernel it doesn't even implement some of the required functionality for V4L2 compliance, so it's utterly useless from the point of view of writing a generalised application under Linux that will run on anything but the very latest distributions :D

James

Share this post


Link to post
Share on other sites

Apologies Cliff, I'm hijacking your thread a bit...

It looks like the UVC driver clamps the requested exposure value to be within the min/max range that the camera says it wants. Since that range appears to make no sense, whatever I request for exposure gets turned into a request for an exposure of -1. I've enquired of the UVC developers mailing list whether there's a way to work around this, otherwise it looks like I'll be hacking the driver myself. Fortunately it's a relatively easy thing to correct in the code, but it causes far more trouble if other people wish to use the application.

James

Share this post


Link to post
Share on other sites

Well, this evening I can report further success. I have hacked the Linux UVC driver to add an extra quirk option that forces the maximum exposure for the Xbox cam to be treated as 255 and my code can now change the exposure settings from my application.

As it happens, my "fish-eye" lens also arrived today. It's taken ages to get here, but to be fair to the chap I bought it from in China it has arrived within the five-day window he gave, so I've got no complaints there. It isn't anything close to a full 180 degrees -- probably not much more than 120 if the truth be told. Hard to be sure without making some proper measurements, but here's an image I just grabbed (using my Linux code) with the camera and new lens from my office window:

post-23533-133877762079_thumb.jpg

If the sky is clear-ish this evening then I'll push the exposure right up to eleven and see what it picks up in the way of stars.

I'm aware that the sensor is very noisy, but should it pick up a decent number of stars I'm wondering if it might be possible to filter the noise in some way. I need to understand more about noise filtering before going there though.

James

Share this post


Link to post
Share on other sites
Well, this evening I can report further success. I have hacked the Linux UVC driver to add an extra quirk option that forces the maximum exposure for the Xbox cam to be treated as 255 and my code can now change the exposure settings from my application.

As it happens, my "fish-eye" lens also arrived today. It's taken ages to get here, but to be fair to the chap I bought it from in China it has arrived within the five-day window he gave, so I've got no complaints there. It isn't anything close to a full 180 degrees -- probably not much more than 120 if the truth be told. Hard to be sure without making some proper measurements, but here's an image I just grabbed (using my Linux code) with the camera and new lens from my office window:

[ATTACH]84868[/ATTACH]

If the sky is clear-ish this evening then I'll push the exposure right up to eleven and see what it picks up in the way of stars.

I'm aware that the sensor is very noisy, but should it pick up a decent number of stars I'm wondering if it might be possible to filter the noise in some way. I need to understand more about noise filtering before going there though.

James

That is pretty awesome possibly may like to try out your software on me laptops sometime which are linux

mind u my laptops old mine are installed on my heavy tank of laptop compaq evo n110 saluki linux and mini laptop is xubuntu.

also pc computers i use all windows xp

I recommend you put that cam outside it work better and it possibly pick up stars will look forward to some pics from your skycam sometime.

thats cool putting fisheye lens on cam.

Share this post


Link to post
Share on other sites

@zaphod.cliff.gina.et al. 1st Zaphod - Wow, that is one seriously good image of mars! really all this is from a xbox webcam? I'm about to do the mod and really have no idea what i'm doing setting and processing wise, If i can capture anything like these pics it would be well worth the effort. V v good job, there. Any advice you think would help - leave a post or point me in the right direction of any usefull info, whatever needs to be done this thread is full of the right genius stargazers to do it! Everyone, this is impressive stuff. Thanks to all of the thread contributors.

J

Edited by Aenima

Share this post


Link to post
Share on other sites

Here is my latest stacked images over 900 images all in 1 from past couple of hours also captured some ufo on top corner with orbit with capella star trail :D

ufo%20stacked%20ok.jpg

Edited by Stargazing_Cliff

Share this post


Link to post
Share on other sites

Sorry for the dumb question but I'm new to this and I was wondering if I could have some assistance. I'm trying out SharpCap for the first time with the Xbox Livecam plugged in unmodified. I notice that in low light (card over lens) there are a number of hot pixels: i.e. bright pixels that retain what appear to be the same value no matter what they should be registering. How are these dealt with? Is this something that registax (or similar) deals with via dark images or do you just have to live with this effect. As the hot pixels are likely to be a constant feature are they corrected for by masks or dark images? I notice that by increasing the resolution to 960 x 720 in SharpCap, one notch up from the native 640 x 480 resolution, the hot pixels are less pronounced (vanish even) though this could be the effect of an averaging between adjacent pixels as the apparent increase in resolution is synthesised.

Share this post


Link to post
Share on other sites

That's a very large can of worms you're opening there :)

There's a chunk of moderately complex maths behind noise reduction in astro imaging and I really don't want to go there at the moment. To a first approximation let's just say that if you're imaging a planet and stacking multiple images then hot pixels will probably get averaged out. The first step of stacking is aligning all the images and it's quite possible you won't have perfect alignment. By aligning the images you're effectively "un-aligning" the hot pixels, and they then should have less contribution to the final image.

I've not tried taking darks for use with Registax when webcam imaging I have to admit, but thus far my tool of choice has been the SPC900, which seems to be pretty good from a noise point of view. Certainly streets ahead of the xbox camera.

As no-one else has mentioned problems with hot pixels, I think I'd give it a go and see how it turns out. If you have sub-pixel tracking then it may be a problem, but otherwise you may well find that it all just comes out in the wash.

James

Share this post


Link to post
Share on other sites

Thanks James. I expect that it will all come out in the wash. For a camera that costs less than £5 then I don't think I have any complaints.

Share this post


Link to post
Share on other sites

As an update to my last post I managed to get SharpCap and RegiStax working on my laptop - the latter was a bit of a struggle due to my working account not being administrator (I have a workaround for that). I haven't done the mod on the camera but I've been experimenting with the software to see if I can do something about the hot pixels. I used SharpCap to record an avi of our toy cat and then did the same for a dark avi with the lens of the web cam covered. Then I stacked the dark avi in RegiStax to produce a dark frame and then subtracted this, again in RegiStax, to produce a corrected stacked bit map from the image avi. The results are pretty promising despite the squiffy colour balance.

raw.bmp

Dark .bmp

processed.bmp

Share this post


Link to post
Share on other sites

Haven't got round to reading the whole thread so forgive me if this has been asked already. I'm planning on ordering an xbox cam this week. Notice on FLO that there are two different webcam nosepiece adaptors, would both of them work on the xbox cam? Or is one preferred over the other?

Thanks in advance.

Share this post


Link to post
Share on other sites

The one that fits the SPC880/900 worked for me, though I did trim off some of the original camera nosepiece to get it to fit.

James

Share this post


Link to post
Share on other sites

Thanks, asked FLO as well and they thought the same. Just a shame it's out of stock at the moment.

Share this post


Link to post
Share on other sites

Just posting these out of interest. Two images taken through my office window with my Xbox cameras at 20:45 this evening. Very, though not completely, dark. Both taken with exactly the same settings -- maximum exposure, maximum colour temperature, zero gain and minimum gamma. Both are plugged into my Aspire 1 laptop and I'm taking sequences of images from them in turn. The first is a standard camera, the second is with the IR filter removed (the "mess" on the top right is the reflection of the hall light outside my office door).

post-23533-133877763867_thumb.jpg

James

post-23533-133877763856_thumb.jpg

Share this post


Link to post
Share on other sites

A few more from the IR cam, with gain settings of 0, 63, 127, 191 and 255 respectively. Taken at 21:27.

post-23533-133877763907_thumb.jpg

post-23533-133877763915_thumb.jpg

post-23533-133877763919_thumb.jpg

James

post-23533-133877763903_thumb.jpg

post-23533-133877763911_thumb.jpg

Share this post


Link to post
Share on other sites

Hi there guys. Have been scanning through this thread, rather impressive by the way - lots of inventive ideas. I have never used a webcam before, and obviously not modded one. Although this thread has much info, i still feel nervous about my lack of knowledge and am reluctant to pull the webcam apart without knowing what i'm doing.

Does anyone mind giving me some basics advice or point me in the direction of a how-to for dummies type thing?

I have the xbox cam and seen the pictures and steps at the start of this thread but still get lost very easily, ie lots of questions. Sorry if this happens a lot, hope its not too annoying.

Any help would be much appreciated,

Thank you.

Share this post


Link to post
Share on other sites

James pretty cool pics.

I just got hold of another xbox cam got from the game store the dude checked back lucky had one in box :) sold me it for 2.99 this cam i shall mod to me newt telescope.

Share this post


Link to post
Share on other sites

Just finished my mod. Took apart a rubbish eyepiece and glued it on. Tape's a bit shabby but you can't have it all :)

Just need a cloud filter now :confused:

AqtFbMcCIAEDtIv.jpg

Share this post


Link to post
Share on other sites

At least it makes it easy to fit a proper IR filter :)

James

Share this post


Link to post
Share on other sites

might be a daft question but will this work with my 150P? just got it today and already have an old xbox cam sat doing noting lol. If it does, do i just need to folllow the steps at the startt and drop it into the focuser/barlow?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.