Webcam
Webcam
Hallo hat jemand einen Code mit dem man eine Webcam ausuchen kann die man am PC angeschlossen hat und dann das derzeit Aktuelle Bild Anzeigen kann.(eventuel Film Foto drehen)?
http://www.purearea.net/pb/download/userlibs/Avicap.zip
Ist aber für 3.94 ,muste mal testen ich habe damit noch nicht gearbeitet!
Ist aber für 3.94 ,muste mal testen ich habe damit noch nicht gearbeitet!
Purebasic 5.0 32bit und 64 bit
I'm back from hell
I'm back from hell
-
- Beiträge: 557
- Registriert: 29.11.2005 15:05
in pur 3.94 erstellt und mit der "avicap32.dll" im systemwindowsverzeichnis.
die capture.pb lädt die inc.pb und ab geht die post.
mit dem button schnapp kannste dann ein standbild rechts neben dem videobild darstellen.
die capture.pb lädt die inc.pb und ab geht die post.
mit dem button schnapp kannste dann ein standbild rechts neben dem videobild darstellen.
Code: Alles auswählen
"capture.pb"
; PureBasic Visual Designer v3.92 build 1460
IncludeFile "inc.pb"
#WM_CAP_START = #WM_USER
#WM_CAP_SET_CALLBACK_ERROR = #WM_CAP_START + 2
#WM_CAP_SET_CALLBACK_STATUS = #WM_CAP_START + 3
#WM_CAP_SET_CALLBACK_YIELD = #WM_CAP_START + 4
#WM_CAP_SET_CALLBACK_FRAME = #WM_CAP_START + 5
#WM_CAP_SET_CALLBACK_VIDEOSTREAM = #WM_CAP_START + 6
#WM_CAP_SET_CALLBACK_WAVESTREAM = #WM_CAP_START + 7
#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_DLG_VIDEOFORMAT = #WM_CAP_START + 41
#WM_CAP_DLG_VIDEOSOURCE = #WM_CAP_START + 42
#WM_CAP_DLG_VIDEODISPLAY = #WM_CAP_START + 43
#WM_CAP_SET_PREVIEW = #WM_CAP_START + 50
#WM_CAP_SET_PREVIEWRATE = #WM_CAP_START + 52
#WM_CAP_GET_STATUS = #WM_CAP_START + 54
#WM_CAP_FILE_SAVEDIB = #WM_CAP_START + 25
#WM_CAP_SET_SCALE = #WM_CAP_START + 53
#WM_CAP_SET_CALLBACK_CAPCONTROL = #WM_CAP_START + 85
#WM_CAP_EDIT_COPY = #WM_CAP_START + 30
#WM_CAP_GRAB_FRAME = #WM_CAP_START+60
Open_Window_0()
OpenLibrary(0, "AVICAP32.DLL")
hRobby = CallFunction(0, "capCreateCaptureWindowA", "Test", #WS_VISIBLE + #WS_CHILD, 100, 10, 300, 280, hWnd, 0)
SendMessage_(hRobby, #WM_CAP_DRIVER_CONNECT, 0 , 0)
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindowID() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadgetID() ; Is it a gadget event?
EventType = EventType() ; The event type
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_EventGadget
If GadgetID = #Button_0
Link = GetClipboardData(#PB_ClipboardImage)
If Link <> 0
StartDrawing( WindowOutput() )
DrawImage(Link, 410,10,300, 240)
StopDrawing()
EndIf
EndIf
EndIf
SendMessage_(hRobby, #WM_CAP_GRAB_FRAME, 0 , 0)
SendMessage_(hRobby, #WM_CAP_EDIT_COPY, 0 , 0)
Delay(1)
Until Event = #PB_Event_CloseWindow ; End of the event loop
SendMessage_(hRobby, #WM_CAP_SET_PREVIEW, 0, 0)
SendMessage_(hRobby, #WM_CAP_DRIVER_DISCONNECT, "Test", 0)
CloseWindow(0)
CloseLibrary(0)
End
;
"inc.pb"
;- Window Constants
Global hWnd
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Button_0
EndEnumeration
Procedure Open_Window_0()
hWnd=OpenWindow(#Window_0, 0, 0, 800, 320, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Videocapture")
CreateImage(#Window_0, 710, 320)
If CreateGadgetList(WindowID())
ButtonGadget(#Button_0, 15, 35, 70, 25, "schnapp")
EndIf
EndProcedure
Sieh im Code genau nach...inc.pb geht los ab: "inc.pb"
Code: Alles auswählen
;- Window Constants
Global hWnd
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Button_0
EndEnumeration
Procedure Open_Window_0()
hWnd=OpenWindow(#Window_0, 0, 0, 800, 320, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Videocapture")
CreateImage(#Window_0, 710, 320)
If CreateGadgetList(WindowID())
ButtonGadget(#Button_0, 15, 35, 70, 25, "schnapp")
EndIf
EndProcedure
Siehste! Geht doch....?!
PB*, *4PB, PetriDish, Movie2Image, PictureManager, TrainYourBrain, ...
PB*, *4PB, PetriDish, Movie2Image, PictureManager, TrainYourBrain, ...
Danke
Danke, könnt ihr mir erkären wie man die Aktuallisirungsgeschwindigkeit vergrößert. Und wie man das Foto Speichert.
- Falko
- Admin
- Beiträge: 3535
- Registriert: 29.08.2004 11:27
- Computerausstattung: PC: MSI-Z590-GC; 32GB-DDR4, ICore9; 2TB M2 + 2x3TB-SATA2 HDD; Intel ICore9 @ 3600MHZ (Win11 Pro. 64-Bit),
Acer Aspire E15 (Win11 Home X64). Purebasic LTS 6.11b1
HP255G8 Notebook @AMD Ryzen 5 5500U with Radeon Graphics 2.10 GHz 3.4GHz, 32GB_RAM, 3TB_SSD (Win11 Pro 64-Bit) - Kontaktdaten:
Code: Alles auswählen
SendMessage_(hRobby, #WM_CAP_EDIT_COPY ,0,0); kopiert Bild ins Clipboard
MfG Falko