Page 1 of 3
KidsCam - Fun with your webcam!
Posted: Fri Sep 30, 2005 1:57 pm
by Kukulkan
Hi,
I want to announce a new program made with PB.
Play with your webcam! For children and adults a giant fun! Simply connect your webcam and now the program distorts the pictures with five different mirror-effects in realtime. Also there is a funny ghost-effect and a disco-style-effect (try to move wild in front of your camera).
My wife and my children love the program...
Download Setup here:
http://www.x-beliebig.info/Download/KidsCam_Setup.exe (about 300 KB)
By the way - the persons are much more pretty without the program
IMPORTANT: After starting the program, use <Webcam Format> to change the resolution to 320x240 Pixel! Otherwise the effects dont work properly!
The program is only in german, but it is so simple that you sure can use it without understanding any german word.
Hope you enjoy,
Kukulkan
Posted: Fri Sep 30, 2005 2:22 pm
by okasvi
cool app

gonna test it at my mom where is webcam, ive never thought it would be useful for anything

Posted: Sat Oct 01, 2005 3:27 pm
by Nik
Very Cool how did you access the Webcam Picture?
bye Nik
Posted: Sat Oct 01, 2005 4:08 pm
by thefool
wow! Really nice!
I love it!
Posted: Tue Oct 04, 2005 7:02 am
by Kukulkan
@Nik:
Very Cool how did you access the Webcam Picture?
Code: Select all
; initialize webcam
If OpenLibrary(0, "avicap32.dll")
*capAddress = IsFunction(0, "capCreateCaptureWindowA")
hWndC = CallFunctionFast(*capAddress, "My Capture Window", #WS_CHILD | #WS_VISIBLE, 695, 12, 40, 30, WindowID(), 1)
SendMessage_(hWndC, #WM_CAP_DRIVER_CONNECT, KameraID.l, 0) ; connect driver
SendMessage_(hWndC,#WM_CAP_SET_SCALE, #True, 0) ; no stretching
SendMessage_(hWndC, #WM_CAP_SET_PREVIEW, #True, 0) ; start preview
SendMessage_(hWndC, #WM_CAP_SET_PREVIEWRATE, 50, 0) ; set preview-rate (milliseconds)
Else
MessageRequester("Scotty, we have a problem...","Sorry, but I cant find or open avicap32.dll...", #MB_ICONERROR)
EndIf
; retrieve picture
SendMessage_(hWndC, #WM_CAP_EDIT_COPY, 0, 0)
img.l = GetClipboardData(#PB_ClipboardImage)
; render result
StartDrawing(WindowOutput())
DrawImage(img.l, 10, 12, 640, 480)
StopDrawing()
If you search the forums and goole, you surely will find more about...
Kukulkan
Posted: Tue Oct 04, 2005 12:48 pm
by djes
Posted: Tue Oct 04, 2005 1:31 pm
by Nik
Thank you very much but when i try to run your example it says that it can´t find #WM_CAP_DRIVER_CONNECT.
Do I need the Avicap lib and where to get it.
bye
Posted: Tue Oct 04, 2005 1:40 pm
by zikitrake
Nik wrote:Thank you very much but when i try to run your example it says that it can´t find #WM_CAP_DRIVER_CONNECT.
Do I need the Avicap lib and where to get it.
bye
Put at init of code these constant
Code: Select all
#WM_CAP_START = #WM_USER
#WM_CAP_DRIVER_CONNECT = #WM_CAP_START + 10
#WM_CAP_SET_SCALE = #WM_CAP_START + 53
#WM_CAP_SET_PREVIEW = #WM_CAP_START + 50
#WM_CAP_SET_PREVIEWRATE = #WM_CAP_START + 52
#WM_CAP_EDIT_COPY = #WM_CAP_START + 30
; initialize webcam
If OpenLibrary(0, "avicap32.dll")
*capAddress = IsFunction(0, "capCreateCaptureWindowA")
hWndC = CallFunctionFast(*capAddress, "My Capture Window", #WS_CHILD | #WS_VISIBLE, 695, 12, 40, 30, WindowID(), 1)
SendMessage_(hWndC, #WM_CAP_DRIVER_CONNECT, KameraID.l, 0) ; connect driver
SendMessage_(hWndC,#WM_CAP_SET_SCALE, #True, 0) ; no stretching
SendMessage_(hWndC, #WM_CAP_SET_PREVIEW, #True, 0) ; start preview
SendMessage_(hWndC, #WM_CAP_SET_PREVIEWRATE, 50, 0) ; set preview-rate (milliseconds)
Else
MessageRequester("Scotty, we have a problem...","Sorry, but I cant find or open avicap32.dll...", #MB_ICONERROR)
EndIf
; retrieve picture
SendMessage_(hWndC, #WM_CAP_EDIT_COPY, 0, 0)
img.l = GetClipboardData(#PB_ClipboardImage)
; render result
StartDrawing(WindowOutput())
DrawImage(img.l, 10, 12, 640, 480)
StopDrawing()
Posted: Tue Oct 04, 2005 3:08 pm
by Kukulkan
Hi,
@zikitrake:
Thank you for completing the code. I just forgot to complete it with the constants
@Nik:
Yes, zikitrake gave you the right constants for capturing.
There are some more available:
Code: Select all
#WM_CAP_START = #WM_USER
#WM_CAP_UNICODE_START = #WM_USER +100
#WM_CAP_PAL_SAVEA = #WM_CAP_START + 81
#WM_CAP_PAL_SAVEW = #WM_CAP_UNICODE_START + 81
#WM_CAP_UNICODE_END = #WM_CAP_PAL_SAVEW
#WM_CAP_ABORT = #WM_CAP_START + 69
#WM_CAP_DLG_VIDEOCOMPRESSION = #WM_CAP_START + 46
#WM_CAP_DLG_VIDEODISPLAY = #WM_CAP_START + 43
#WM_CAP_DLG_VIDEOFORMAT = #WM_CAP_START + 41
#WM_CAP_DLG_VIDEOSOURCE = #WM_CAP_START + 42
#WM_CAP_DRIVER_CONNECT = #WM_CAP_START + 10
#WM_CAP_DRIVER_DISCONNECT = #WM_CAP_START + 11
#WM_CAP_DRIVER_GET_CAPS = #WM_CAP_START + 14
#WM_CAP_DRIVER_GET_NAMEA = #WM_CAP_START + 12
#WM_CAP_DRIVER_GET_NAMEW = #WM_CAP_UNICODE_START + 12
#WM_CAP_DRIVER_GET_VERSIONA = #WM_CAP_START + 13
#WM_CAP_DRIVER_GET_VERSIONW = #WM_CAP_UNICODE_START + 13
#WM_CAP_EDIT_COPY = #WM_CAP_START + 30
#WM_CAP_END = #WM_CAP_UNICODE_END
#WM_CAP_FILE_ALLOCATE = #WM_CAP_START + 22
#WM_CAP_FILE_GET_CAPTURE_FILEA = #WM_CAP_START + 21
#WM_CAP_FILE_GET_CAPTURE_FILEW = #WM_CAP_UNICODE_START + 21
#WM_CAP_FILE_SAVEASA = #WM_CAP_START + 23
#WM_CAP_FILE_SAVEASW = #WM_CAP_UNICODE_START + 23
#WM_CAP_FILE_SAVEDIBA = #WM_CAP_START + 25
#WM_CAP_FILE_SAVEDIBW = #WM_CAP_UNICODE_START + 25
#WM_CAP_FILE_SET_CAPTURE_FILEA = #WM_CAP_START + 20
#WM_CAP_FILE_SET_CAPTURE_FILEW = #WM_CAP_UNICODE_START + 20
#WM_CAP_FILE_SET_INFOCHUNK = #WM_CAP_START + 24
#WM_CAP_GET_AUDIOFORMAT = #WM_CAP_START + 36
#WM_CAP_GET_CAPSTREAMPTR = #WM_CAP_START + 1
#WM_CAP_GET_MCI_DEVICEA = #WM_CAP_START + 67
#WM_CAP_GET_MCI_DEVICEW = #WM_CAP_UNICODE_START + 67
#WM_CAP_GET_SEQUENCE_SETUP = #WM_CAP_START + 65
#WM_CAP_GET_STATUS = #WM_CAP_START + 54
#WM_CAP_GET_USER_DATA = #WM_CAP_START + 8
#WM_CAP_GET_VIDEOFORMAT = #WM_CAP_START + 44
#WM_CAP_GRAB_FRAME = #WM_CAP_START + 60
#WM_CAP_GRAB_FRAME_NOSTOP = #WM_CAP_START + 61
#WM_CAP_PAL_AUTOCREATE = #WM_CAP_START + 83
#WM_CAP_PAL_MANUALCREATE = #WM_CAP_START + 84
#WM_CAP_PAL_OPENA = #WM_CAP_START + 80
#WM_CAP_PAL_OPENW = #WM_CAP_UNICODE_START + 80
#WM_CAP_PAL_PASTE = #WM_CAP_START + 82
#WM_CAP_SEQUENCE = #WM_CAP_START + 62
#WM_CAP_SEQUENCE_NOFILE = #WM_CAP_START + 63
#WM_CAP_SET_AUDIOFORMAT = #WM_CAP_START + 35
#WM_CAP_SET_CALLBACK_CAPCONTROL = #WM_CAP_START + 85
#WM_CAP_SET_CALLBACK_ERRORA = #WM_CAP_START + 2
#WM_CAP_SET_CALLBACK_ERRORW = #WM_CAP_UNICODE_START + 2
#WM_CAP_SET_CALLBACK_FRAME = #WM_CAP_START + 5
#WM_CAP_SET_CALLBACK_STATUSA = #WM_CAP_START + 3
#WM_CAP_SET_CALLBACK_STATUSW = #WM_CAP_UNICODE_START + 3
#WM_CAP_SET_CALLBACK_VIDEOSTREAM = #WM_CAP_START + 6
#WM_CAP_SET_CALLBACK_WAVESTREAM = #WM_CAP_START + 7
#WM_CAP_SET_CALLBACK_YIELD = #WM_CAP_START + 4
#WM_CAP_SET_MCI_DEVICEA = #WM_CAP_START + 66
#WM_CAP_SET_MCI_DEVICEW = #WM_CAP_UNICODE_START + 66
#WM_CAP_SET_OVERLAY = #WM_CAP_START + 51
#WM_CAP_SET_PREVIEW = #WM_CAP_START + 50
#WM_CAP_SET_PREVIEWRATE = #WM_CAP_START + 52
#WM_CAP_SET_SCALE = #WM_CAP_START + 53
#WM_CAP_SET_SCROLL = #WM_CAP_START + 55
#WM_CAP_SET_SEQUENCE_SETUP = #WM_CAP_START + 64
#WM_CAP_SET_USER_DATA = #WM_CAP_START + 9
#WM_CAP_SET_VIDEOFORMAT = #WM_CAP_START + 45
#WM_CAP_SINGLE_FRAME = #WM_CAP_START + 72
#WM_CAP_SINGLE_FRAME_CLOSE = #WM_CAP_START + 71
#WM_CAP_SINGLE_FRAME_OPEN = #WM_CAP_START + 70
#WM_CAP_STOP = #WM_CAP_START + 68
This list is quite not complete, but should work for the most things.
Also have a look here:
http://msdn.microsoft.com/library/defau ... ssages.asp
Kukulkan
Posted: Tue Oct 04, 2005 3:14 pm
by Nik
Ok but KameraID.l is 0 where do I get the needed number?
Posted: Tue Oct 04, 2005 3:17 pm
by Kukulkan
@nik:
You can enumerate the available cameras in this way (debugger-output):
Code: Select all
OpenLibrary(0, "avicap32.dll")
*capAddress = IsFunction(0, "capGetDriverDescriptionA")
DId.l = 0
Repeat
Name.s = Space(255)
Description.s = Space(255)
Ret.l = CallFunctionFast(*capAddress, DId.l, Name.s, Len(Name.s), Description.s, Len(Description.s))
If Trim(Name.s) <> ""
Debug Str(DId.l) + ":" + Name.s + " - " + Description.s
DId.l = DId.l + 1
EndIf
Until Trim(Name.s) = ""
Kukulkan
Posted: Tue Oct 04, 2005 4:19 pm
by Nik
Ok it isn´t moving but hey its a shot ^^
bye and thank you very much
Posted: Tue Oct 04, 2005 6:56 pm
by Karbon
What planet is your family from? They look a bit funny!

Posted: Wed Oct 05, 2005 6:44 am
by Kukulkan
What planet is your family from? They look a bit funny!
Its called
KidsCamonbert. You can be one of us, if you use KidsCam and send a picture here

Posted: Wed Oct 05, 2005 8:36 am
by zikitrake
Hi
kukulkan, you use
Code: Select all
; retrieve picture
SendMessage_(hWndC, #WM_CAP_EDIT_COPY, 0, 0)
img.l = GetClipboardData(#PB_ClipboardImage)
to copy webcam image to img.l (I use this method too).
The problem is that if I have a previous picture store in the clipboard, this picture is replaced with the webcam pic.
do you know another method for store webcam images (without use #WM_CAP_EDIT_COPY"?
Thank your for this app.