English
Source / code snippets

Bewegungsmelder Webcam Kamera escapi.dll prospeed.dll

 

Walter
One Bewegungsmelder over Webcam, einbaubar in Own Applications.
Base is  [...] 
and the Why stay in  [...]  or.  [...]  , prospeed.dll for comparison the Webcam-Images To use.
 $H windows.ph
' Bewegungsmelder
' Walter, 29.4.2023
' The Bewegungsmelder shows on screen in the Sekundentakt Images from the Laptop-Kamera to control/attitude the Empfindlichkeit.
' the jeweilige Image on Changes to that vorigen Image examined (tolerance for Änderung / Number of modified Pixel).
' becomes with More as the tuned amount Pixeln The tuned tolerance overstepped, results a Message.
'
' ex the pressing of Button START go with eachone erkannten Veränderung
' Image-Nr, Date and Uhrzeit in that Image written and the photo in the Programmordner stored.
' (The Images go not automatically deleted, however at next Start the program überschrieben).
' (the everything can itself naturally on The own Opportunities adjust - moreover Yes The Source :+D--).
' here's tuned 1 Image per second, wide/Höhe 640*480
'
' Base is "https://XProfan.net/intl/de/quelltexte/webcam-laptop-kamera-snapshot-escapi-dll/"
' and the Why stay in "https://XProfan.net/intl/de/cafe/bewegungsmelder-program-mithilfe-of/ one-webcam/" or. "https://XProfan.net/intl/de/Applications/webcam-bewegungsmelder/",
' prospeed.dll for comparison the Webcam-Images To use.
'
' needs Escapi.dll V3 Win32
'          windows.ph
'          is used
'
declare dll1&,AnzCam%,capture#,a%,b%,name$
declare dll2&,ZweitesBild#, x&,AnzBy&,Tol&
declare b1%,b2%,t%,ed1%,ed2%,m%
declare hBMP%,BildBuffer#
declare way$,i%,Startverzögerung%,end%,runs%, motions%,time!,duration!,HiebeProBew%
'
pfad$=$ GetDir("")
Startverzögerung%=3
'
'
' Bildbuffer
AnzBy&=1228800
dim BildBuffer#,AnzBy&' 640*480*4 byte
dim ZweitesBild#,AnzBy&
'
' Schnittstellenstruktur for escapi.dll
struct Image=buff%%,mWidth&,mHeight&' Pointer on the Image-Buffer, Bildbreite, Bildhöhe
dim capture#,Image
capture#.buff%%=addr(BildBuffer#)
capture#.mWidth&=640
capture#.mHeight&=480
'
' Escapi.dll
Def ESCAPIDLLVersion(0) !"escapi","ESCAPIDLLVersion"
Def countCaptureDevices(0) !"escapi","countCaptureDevices"
Def deinitCapture(1) !"escapi","deinitCapture"
Def doCapture(1) !"escapi","doCapture"
Def getCaptureDeviceName(3) !"escapi","getCaptureDeviceName"
Def initCOM(0) !"escapi","initCOM"
Def initCapture(2) !"escapi","initCapture"
Def isCaptureDone(1) !"escapi","isCaptureDone"
dll1&=usedll("Escapi.dll")
'
' Prospeed.dll
 $I Prospeed_Funktionen.inc
dll2&=usedll("prospeed.dll")
'
'
'
'
'-------------------------------------------
Window Title "Bewegungsmelder"
window 700,700
CLS ~GETSYSCOLOR(15)
'
' tolerance
create("Text",%hwnd,"Toleranz for changed Pixel",20,503,200,25)
ed1%=Create("Edit",%hwnd,"200",220,500,40,20)
Create("Tooltip",%hwnd,ed1%,"Etwa 200...300 is by me a good worth.")
create("Text",%hwnd,"Anzahl veränderter Pixel outside Toleranz",300,503,300,25)
ed2%=Create("Edit",%hwnd,"100",620,500,40,20)
Create("Tooltip",%hwnd,ed2%,"Etwa 100 is by me a good worth.")
t%=create("Text",%hwnd,"",20,550,400,25)
'
b2%=create("Button",%hwnd,"Start",450,550,80,25)
Create("Tooltip",%hwnd,b2%,"Ab START becomes with eachone erkannten movement one Image stored..")
'
b1%=create("Button",%hwnd,"Ende",580,550,80,25)
m%=create("Text",%hwnd,"",20,600,400,20)
'
UseFont "Arial",12,0,0,0,0
'
'
' Kamera on (escapi.dll)
' messagebox(st$(ESCAPIDLLVersion()),"Escapi Version",0)
AnzCam%=countCaptureDevices()
name$=space$(1024)
' messagebox("Anzahl cameras found: "+st$(AnzCam%),"Anzahl",0)
getCaptureDeviceName(0,addr(name$),1024)' Kamera Nr. 0
' messagebox(name$,"Kamera gewählt",0)
a%=initCapture(0, addr(capture#))
'
'
'
läuft%=0
ende%=0
Bewegungen%=0
i%=1
Settimer 1000' Sekundentakt
User Messages $10' discontinue over windows-Cross
'
'

whilenot end%

    waitinput

    if %UMessage = $10' discontinue over windows-Cross

        end% = 1

    elseif %wmtimer

        settext m%,""

        if i%>1

            ' the vorige Image in ZweitesBild# Pinned
            ZweitesBild#=BildBuffer#

        endif

        if a%>0

            b%=doCapture(0)

        endif

        if b%>0

            while isCaptureDone(0)=0

            wend

        endif

        hBMP% = ~CreateBitmap(capture#.mWidth&, capture#.mHeight& , 1 , 32 , BildBuffer#)' Bitmap whom Bufferdaten produce
        DrawPic hBMP%, 20, 0; 0' Kontrollbild on screen
        tol&=val(gettext$(ed1%))'tolerance reading

        if i%>Startverzögerung%' tuned are 3 sec, then becomes 1 x per second compared

            '  Altes Image with new compared
            '  prospeed.dll: CompareBytes (B1,B2,A,T)
            x&=compareBytes(ZweitesBild#,BildBuffer#,AnzBy&,tol&)
            ' Auswertung

            if  x&>val(gettext$(ed2%))' amount Bytes outside the tolerance

                beep
                settext m%,"Bewegung recognized: "+st$(x&)+" Pixel are changed."

                if runs%=1

                    inc motions%
                    BildBeschriftenSpeichern

                endif

            endif

        endif

        sleep 10
        ~DeleteObject(hBMP%)'memory of Bitmap enable
        inc i%

    elseif clicked(b1%)' discontinue-Button

        end%=1

    elseif clicked(b2%)' Start pressed

        runs%=1
        settext t%,"Bei eachone erkannten movement becomes one Image stored."

    endif

Wend

enable
end
'
'
'-------------------------------

proc BildBeschriftenSpeichern

    '-------------------------------
    ' Image Nr, Date and Time in that Image write
    ' Image Save
    ' Nr, Date and Uhrzeit in that Image write
    startpaint hBMP%
    drawtext 0, 0, "Nr. "+st$(motions%) + "  " + dt("getDate",0)+"  "+dt("getTime", 2)
    endpaint
    ' Image Save
    savepic way$+"\\Bew."+stature$("000.",motions%)+".jpg",hBMP%,75

endproc' BildBeschriftenSpeichern

'
'
'-------------------

proc enable

    '-------------------
    killtimer
    deinitCapture(0)
    dispose capture#, Bildbuffer#, ZweitesBild#
    freedll dll1&
    freedll dll2&
    ~DeleteObject(hBMP%)

endproc' enable

 
04/30/23  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.003 Views

Untitledvor 0 min.
H.Brill08/04/24
Heiko Dix10/30/23
Sven Bader08/11/23
Walter07/12/23
More...

Themeninformationen

this Topic has 1 subscriber:

Walter (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie