Sign in to follow this  
Followers 0
picadillus

Webcam working in background

6 posts in this topic

#1 ·  Posted (edited)

I'm trying to make a touchscreen using the webcam. I am using infrared light from a TV remote control.My webcam is recordering the screen of my computer, but the webcam has a home-made infrared filter, so it only record the infrared light, My script seek the color of ifrared ligt to move the mouse pointer to the light position.

I'm using 7h331337´s script here is the link but I have a problem, I want that my script work in background or invisible and I don't know how I can do that, because if I put my script invisible de function pixelseach() doesn't work.

Can you help me please? thanks very much

Sorry about my English and Thanks very much

Edited by picadillus

Share this post


Link to post
Share on other sites



I couldn't try that script, because I don't have a webcam. But it appears to me that it creates a "preview window", which is used to get the pixels from.

There's a way you could get the pixels information from that window with it minimized or hidden, like this (you must know the width and height):

$dc = _WinAPI_GetDC ($previewWindow)
$memDc = _WinAPI_CreateCompatibleDC ($dc)
$bitmap = _WinAPI_CreateCompatibleBitmap ($dc, $width, $height)
_WinAPI_SelectObject ($memDc, $bitmap)
_WinAPI_BitBlt ($memDc, 0, 0, $width, $height, $dc, 0, 0, $SRCCOPY)
$bits = DllStructCreate ("dword[" & ($width * $height) & "]")
DllCall ("gdi32", "int", "GetBitmapBits", "ptr", $bitmap, "int", ($width * $height * 4), "ptr", DllStructGetPtr ($bits))oÝ÷ Ù8^*.q©ÚqǬ±«)yÈÊbÅéwöÇ(åG­+ºÚ"µÍÌÍÚ[^H
    ÌÍÞH
    ÌÍÝÚY
H
È  ÌÍÞÌÍØÛÛÜHÝXÝÙ]]H
    ÌÍØ]ËK  ÌÍÚ[^

Because you need to access pixel by pixel, you can't use the PixelSearch function, so you have to do the search yourself. If performance is a problem, you could make an external DLL to do the search. It would be really simple code.


[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Share this post


Link to post
Share on other sites

I actually used a PY script created by Nirav Patel on my XO-OLPC to do something similar.

Lot of links here including links in comments to using a Wiimote and reflective tape on fingers to track movement.

Paint with Color Based Object Tracking on the OLPC XO

Posted Image

Thanks I'm going to read your link about Virtual Machine.

Share this post


Link to post
Share on other sites

I couldn't try that script, because I don't have a webcam. But it appears to me that it creates a "preview window", which is used to get the pixels from.

There's a way you could get the pixels information from that window with it minimized or hidden, like this (you must know the width and height):

$dc = _WinAPI_GetDC ($previewWindow)
$memDc = _WinAPI_CreateCompatibleDC ($dc)
$bitmap = _WinAPI_CreateCompatibleBitmap ($dc, $width, $height)
_WinAPI_SelectObject ($memDc, $bitmap)
_WinAPI_BitBlt ($memDc, 0, 0, $width, $height, $dc, 0, 0, $SRCCOPY)
$bits = DllStructCreate ("dword[" & ($width * $height) & "]")
DllCall ("gdi32", "int", "GetBitmapBits", "ptr", $bitmap, "int", ($width * $height * 4), "ptr", DllStructGetPtr ($bits))oÝ÷ Ù8^*.q©ÚqǬ±«)yÈÊbÅéwöÇ(åG­+ºÚ"µÍÌÍÚ[^H
    ÌÍÞH
    ÌÍÝÚY
H
È  ÌÍÞÌÍØÛÛÜHÝXÝÙ]]H
    ÌÍØ]ËK  ÌÍÚ[^

Because you need to access pixel by pixel, you can't use the PixelSearch function, so you have to do the search yourself. If performance is a problem, you could make an external DLL to do the search. It would be really simple code.

I'm going to used your idea, but I think it will be slowly to pursue the light, I will send you my script. Thanks very much

I actually used a PY script created by Nirav Patel on my XO-OLPC to do something similar.

Lot of links here including links in comments to using a Wiimote and reflective tape on fingers to track movement.

Paint with Color Based Object Tracking on the OLPC XO

Posted Image

The PY Script it's a good idea, I only knowed Wiimote. Thanks

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
Sign in to follow this  
Followers 0