Motion detection is application that is used as observer system or protection system in a certain room, for example coffer room of a organization, such as bank, in a certain time this room has to be empty without anyone inside, as protection application can be developed using sms delivery facility to those that is related when detected a movement. This application can also be developed by automatic facility video recorder if detecting a movement in video preview that is capture in camera as protection input system.
The following is the steps in making Motion detection application with Delphi through Video grabber
Insert the component on the table bellow to the design form :
No | Component Name | Properties | Value |
1 | Label1 | Caption | Start Preview |
2 | Button1 | Caption | Start Motion Detection |
3 | Button2 | Caption | Start Preview |
4 | Combobox1 | Text | - |
5 | Memo1 | Text | - |
6 | Memo1 | Text | - |
7 | Shape1 | Brush-Color | clBlack |
8 | Videograbber1 | - | - |
Arrange the component like the picture bellow:
Then type this following source code
No | Component | Event | Source Code |
1 | Form1 | OnCreate | VideoGrabber1. Display_AutoSize := false; // the control will not resize automatically VideoGrabber1. AutoRefreshPreview := true; // the preview will restart automatically when changing device properties (e.g. video size, analog video standard, etc...) combobox1.Text:= (videograbber1.VideoDevices); |
2 | Button1 | OnClick | videograbber1. MotionDetector_Enabled:=true; memo1.Text := VideoGrabber1. MotionDetector_Get2DTextGrid; |
3 | Button2 | OnClick | videograbber1.StartPreview; |
4 | Videograbber1 | OnMotionDetected | var MaxMotionXLocation, MaxMotionYLocation: LongInt; begin shape1.Brush.Color:=ClLime; VideoGrabber1. MotionDetector_CompareRed ; VideoGrabber1. MotionDetector_CompareBlue; VideoGrabber1. MotionDetector_CompareGreen; if VideoGrabber1. MotionDetector_GetCellLocation (MaxMotionCellX, MaxMotionCellY, MaxMotionXLocation, MaxMotionYLocation) then begin memo2.Text := VideoGrabber1. MotionDetector_Get2DTextMotion; end; |
5 | Videograbber1 | OnNot MotionDetected | Shape1.Brush.Color := clBlack; Memo2.Text := VideoGrabber1. MotionDetector_Get2DTextMotion; |
This is the picture of Motion Detection with Delphi through Video Grabber (Share Ware Version) application:
Start previewing the camera
Motion detection Delphi 1
Motion detection Delphi 2
Note:
The video grabber component that is used in this application is shareware version so that it could not work properly (maximal), in limited random time, application will stopped working, besides that application will appear overlay text nagscreen the address of the website is www.datastead.com
I hope this article can give benefit to the visitors, readers, developer and me. Thanks for visiting and availability for sharing this article by pressing
Share this on Facebook |