Professional Documents
Culture Documents
Information Technology.
Hodeidah
:
:
/
-
2010-2009
II
)(200
......
.
III
.
:
/
.
IV
II
III
IV
VIII
IX
XI
-1 :
-1.1
-2.1
-3.1
-4.1
-6.1
3
-2 :
-1.2
-2.2
-3.2
-4.2
-2.4.2 DVR
-3.4.2 DVR
11
-4.4.2 IP Cameras
12
-5.2
14
V
-3 :
-1.3
16
-2.3
16
-3.3
17
-4.3
18
-5.3
19
-6.3
20
-1.6.3
20
-2.6.3
22
-3.6.3 )(Sampling
22
23
-5.6.3
25
-4 :
-1.4
28
-2.4
28
-3.4
35
-1.3.4
35
-2.3.4
37
-5 :
-1.5
40
-2.5
40
-3.5
40
-6 :
-1.6
52
-2.6
52
-3.6
52
VI
53
-4.6
54
56
VII
1.3
18
2.3
18
3.3
19
VIII
1.2
2.2
3.2
DVR
10
4.2
DVR
12
5.2
IP Camera
14
-
1.3
Monochrome
21
2.3
Gray
21
3.3
RGB
21
4.3
22
5.3
24
-
1.4
28
2.4
28
3.4
29
4.4
29
5.4
30
6.4
30
7.4
31
8.4
31
9.4
32
10.4
32
11.4
33
12.4
33
13.4
34
IX
14.4
Gray
36
15.4
38
-
1.5
Login -
40
2.5
Main
41
3.5
General -
42
4.5
Change Password -
43
5.5
Cameras -
43
6.5
Cameras -
44
7.5
Events -
45
8.5
E-Mail Setting -
46
9.5
46
10.5
Map Settings -
47
11.5
About -
48
12.5
Record Viewer -
49
13.5
Map -
50
)
(
.
XI
-1.
-2 .
-3 .
-4 .
-5 .
1.1
.
) : (.....
).(Surveillance Camera
) (
.
2.1
) (.
.
3.1
.
.
.
4.1
:
- 1 :
.
.
DVR .
.
-2 :
Windows XP .
) Microsoft Visual C#.Net
(.
).(Microsoft Word ,Microsoft Power Point
5.1
:
.
:
.
:
.
: .
: .
: .
-1
-2
-3
-4
-5
1.2
.
2.2
) (
(Digital Video Recorder) DVR
[3].
3.2
20
Coaxial
.
(TV Cards) TV
) +(
TV Card
[4].
4.2
-1 .
-2 .DVR
-3 .DVR
-4
[5].IP Cameras
:1.2
:
.
.
DVR
.
Multiplexer
.
:2.2
: .-
:-
2.4.2 DVR
DVR
.DVR
DVR
DVR
DVR
.
DVR :
:3.2 DVR
.-
.
10
3.4.2 DVR
Linux Unix
.
DVR . . .11
. . DVR - .
:4.2 DVR
4.4.2 IP Cameras
IP Cameras
) / /(.
.
IP Camera
.
12
.CCTV
.
IP Camera . . . . . . . IP Camera - .
13
Bandwidth . - .
:5.2 IP Camera
5.2
-.
14
- 1
-2
-3
-4
-5
-6
1.3
-
.
2.3
.
.
.
.
16
3.3
:
1.3.3
) (
.
17
2.3.3
) ( .
:1.3
Total
Count U. Price
Part
Type
490 $
490 $
CPU Core2Due
Ram 2GB
HDD 500 GB
280 $
70 $
Camera
60 $
15 $
Adapter
830 $
PC
Total
4.3
- 1 .
- 2 ) (.
:2.3
) (
) (
) (
18
.
5.3
) ( . :3.3
19
6.3
.
" "
) (Avi
.Online Streaming
.
Frames
.
Motion Detection
.
1.6.3
:
1.1.6.3 Monochrome :
) (1Bit/Pixel 0 1 .
640 x 480 .37.5 kb
20
:1.3 Monochrome
2.1.6.3 Gray
Gray
1Byte 0 255
) (640 x480 .300 kb
:2.3 Gray
3.1.6.3
Pixel 3Byte
) (
.
Blue
Green
Red
:3.3 RGB
21
Color
)(R,G,B
0 255
.
)Color(0-255,0-255,0-255
)Color(R,G,B
:4.3
2.6.3
RGB
Gray .
RGB Gray :
)Gray value= (R* 0.3) + (G *0.59) + (B * 0.11
Gray value= (R + G + B) /3
3.6.3 ) (Sampling
,
.
22
23
:5.3
24
5.6.3
) (Frames
:
:
Gray Gray
) (2.6.3
.Motion Detection Algorithm
: )(
.
25
: ) (Pointers
)
Pixel (
.
) (Pointers
) (RAM
.
26
-1
=2
-3
1.4
65 5 3 (& 1
H, )5G
$ ,=
< : ;$
2.4
65
3 8836 . 1 7 3
&( >$ ,= :
, ; 1.2.4 ) BC A
)(Login
:1.4 Login
2.2.4
&( C D$
IA -
C D$
E ) F &(
"01 .
:2.4 )(Main
28
3.2.4
" &( F
I -
(& 1.
:3.4 )(Options
, ; 4.2.4 $ %< 6 $6
& , $ % 1 7 3< 6 $6.
29
5.2.4
) FG
$ < FG 1 ,
; = &" , ( P<" $
:5.4 )(Cameras
$ C C
6.2.4
SD 5A T U
< $
C C
<
$.
:6.4 )(Options
30
$ &N $F.
7.2.4
< Y
" &(
X1 &( )[$ & ( &N
$ A.
:7.4 )(Events
8.2.4
" $1 $;H
(E-Mail
:8.4 )Mail Setting
31
9.2.4
" ]
^ <&
.
).(Registry
10.2.4
$ "< T83 P E] 6
T83 E] 6= T
] E
$ "< P .T836
11.2.4
<F
" &(
:11.4 )(About
12.2.4
"$ I BC G
13.2.4
"$ T83 E E] 6
Map
.
:13.4 )(Map
34
3.4
1.3.4
! ' %
) 5 ; <6 7 P
F6
$6 "< P) H, (Pixel) )C 1 5
:
)Gray value= (R* 0.3) + (G *0.59) + (B * 0.11
-1 ) .(Gray
-2 . i=0, j=0
-3 *$ i<Img.height
& G 83
- *$ j<Img.width
& G 83
)(i,j)Pix=Img.GetPixel(i,j
Gray=Pix.R*0.3+Pix.G*0.59+Pix.B*0.11
-
< 1 C
)Img.SetPixel(i,j,Gray
j=j+1-
i=i+1
-4 5 H, & Gray T6 $3
35
= H, f * ) ).(14.4
Start
Img=GetImage()
i=0 , j=0
No
i<Img.height?
Yes
i=i+1
j<Img.width?
No
Yes
Pix=Img.GetPixel(i,j)
Gray=Pix.R*0.3+Pix.G*0.59
+ Pic.B*0.11
Img.SetPixel(i,j,Gray)
j=j+1
Return Img
End
Gray :14.4
36
2.3.4
'* %
.
: -1 LastImg Gray .
-2 i=0, j=0, Threshold=20,PixChanged=0,
Height=LastImg.height, Width=LastImg.width
-3 CurrImg Gray
.
-4 *$ )(i<Height
& G 83
- *$ )(i<Width
Height:
& G 83
Width:
Diff>Threshold
j=j+1-5
i=i+1
IA F6
)MotionLevel=PixChanged/(Height*Widht
-6 ; hhC; Yhh $hh
3
>
$ < 83 ] 3 $ <6F 6
37
= H, f * ) ).(15.4
Start
LastImg=GetImage()
LastImg=ToGray(LastImg)
CurrImg=GetImage()
CurrImg=ToGray(CurrImg)
No
i<Height?
i=i+1
j=0
Yes
j<Width?
No
Yes
Diff=CurrImg[i,j]-LastImg[i,j]
(Diff>Threshold)?
Yes
No
j=j+1
MotionLevel=PixChanged/(Height*Width)
MotionLevel>0.15
Yes
is Motion
No
End
:15.4
38
PixChanged+=1
-1
-2
-3
1.5
.
2.5
:
.(CPU:Core2Due,
(
)RAM:2GB, HD:250 ) Windows XP (. . 3.5
1.3.5 )(Login
.
:1.5 Login -
40
2.3.5 )(Main
).(2.5
: View ) (. : Start . : Stop . : Setting . : Viewer : Map . : Exit - .
:2.5 Main
41
4.3.5 )(Setting
/
) (General : ) (BtnChangePassword ).(4.5 : ).(ChkAutoStart ).(ChkOnTop ).(ChkDisableTaskMgr - ).(chkDisableRegistryTools
:3.5 General -
42
)(Cameras ) (Active
.
).(Save Options
:5.5 Cameras
43
)(Options )(View
) (Stop
).(Property
)(Video Compressor
) (Sensitivity ) (Apply
.
:6.5 Options -
44
:7.5 Events -
45
)(E-Mail Settings
.
E-Mail
:8.5 Mail Settings
47
)(About .
)(About
:11.5 About
48
5.2.5 )(Viewer
) (
.
49
6.2.5 ):(Map
Map )
(
.
:13.5 )(Map
50
-1
-2
-3
-4
1.6
.
2.6
) (
) (
.
3.6
-1
.
-2 .
-3 .
-4
) (.
-5
.
52
-6 .
-7
).(E-Mail
-8 .
4.6
:
) (. . - .
53
]) http://www.shamelatec.ly [3
(.
54
55
Detection.cs (Detection Class):
using System;
using System.Timers;
using System.Drawing;
using System.Drawing.Imaging;
using System.Media;
using System.IO;
namespace SSC
{
public class Detection
{
Bitmap
OldFrame = null;
Bitmap
NewFrame = null;
JMDPlayer.JMDPlayer Player;
Camera
Cam = null;
Timer
TmrDetection = null;
SoundPlayer
SndPlayer=new SoundPlayer("Alarm.wav");
float
M_Level;
bool
Runing = false;
cImage
Cimage;
SSCSettings
Settings;
string
SavePath=System.Environment.GetFolderPath(Environment.SpecialFolder.System)+"
\\JMD";
public Detection(JMDPlayer.JMDPlayer player, Camera cam)
{
this.Player = player;
this.Cam = cam;
this.M_Level = cam.MotionLevel;
Cimage = new cImage();
Settings = new SSCSettings();
Settings.GetSetting();
TmrDetection = new Timer(500);
TmrDetection.Elapsed += new
ElapsedEventHandler(TmrDetection_Elapsed);
}
public bool isRuning
{
get { return Runing; }
}
public void StartMotionDetection()
{
OldFrame = Cimage.ToGray3(Player.GetCurrentVideoFrame());
Player.BorderColor = Color.Green;
TmrDetection.Start();
Runing = true;
if(Settings.SaveVideo==true)
Cam.StartTmrChkmotion();
}
56
if (Settings.SendMailActive == true)
{
Mail Mailer = new Mail(Cam.Alias);
Mailer.GetMailSettings();
string ImgFile =SavePath+"\\"+ Cam.Alias + ".Jpg";
Cimage.saveJpeg(ImgFile, Player.GetCurrentVideoFrame(),
80);
Mailer.SendMessage(ImgFile);
}
if (Settings.SaveVideo == true)
{
Player.SignalToStop();
Player.WaitForStop();
Cam.Motion = true;
}
else
{
Player.TextColor = Color.Red;
}
}
}
private bool Motion(Bitmap NewFrame)
57
{
BitmapData bitmapData1 = OldFrame.LockBits(new Rectangle(0, 0,
OldFrame.Width, OldFrame.Height),
ImageLockMode.ReadOnly,
PixelFormat.Format24bppRgb);
BitmapData bitmapData2 = NewFrame.LockBits(new Rectangle(0, 0,
NewFrame.Width, NewFrame.Height),
ImageLockMode.ReadWrite,
PixelFormat.Format24bppRgb);
int a1 = 0, a2 = 0, Pix = 0;
unsafe
{
byte* imagePointer1 = (byte*)bitmapData1.Scan0;
byte* imagePointer2 = (byte*)bitmapData2.Scan0;
for (int i = 0; i < bitmapData1.Height; i++)
{
for (int j = 0; j < bitmapData1.Width; j++)
{
a1 = (imagePointer1[0]);
a2 = (imagePointer2[0]);
if (Math.Abs(a2 - a1) > 15)
{
Pix++;
}
//3 bytes per pixel
imagePointer1 += 3;
imagePointer2 += 3;
}//end for j
imagePointer1 += bitmapData1.Stride (bitmapData1.Width * 3);
imagePointer2 += bitmapData2.Stride (bitmapData2.Width * 3);
}//end for i
}//end unsafe
NewFrame.UnlockBits(bitmapData2);
OldFrame.UnlockBits(bitmapData1);
float MLevel = (float)Pix / (NewFrame.Width * NewFrame.Height);
if (MLevel > M_Level)
return true;
else
return false;
}
}
}
58
59
60
}
public Size FrameSize
{
get { return frameSize; }
set { frameSize = value; }
}
public Control PreviewWindow
{
get { return previewWindow; }
set { previewWindow = value; }
}
public float MotionLevel
{
get { return motionLevel; }
set { motionLevel = value; }
}
public bool IsRecording
{
get { return recording; }//Capture.Capturing; }
}
public void SaveVideo()
{
try
{
Filter Filtervideo = new Filter(MonikerString);
Filter FilterCompress = new Filter(VideoCompress);
capture = new Capture(Filtervideo, null);
capture.VideoCompressor = FilterCompress;
capture.FrameRate = FrameRate;
capture.FrameSize = FrameSize;
capture.Filename = SavePath + "\\" + alias +
string.Format("{0:@dd-MM-yyyy.HH-mm-ss}", DateTime.Now) + ".jmd";
capture.Cue();
capture.PreviewWindow = previewWindow;
capture.Start();
recording = true;
}
catch (Exception ex) {MessageBox.Show(ex.ToString()); }
}
public void StopSave()
{
if (capture != null)
{
capture.PreviewWindow = null;
capture.Stop();
motion = false;
capture.Dispose();
recording = false;
}
}
public void SaveSetting(string Sub)
{
RegistrySSC.SetValue(Sub, "Activated", activated);
RegistrySSC.SetValue(Sub, "Name", name);
RegistrySSC.SetValue(Sub, "MonikerString", monikerString);
RegistrySSC.SetValue(Sub, "Title", title);
RegistrySSC.SetValue(Sub, "Description", description);
RegistrySSC.SetValue(Sub, "VideoCompress", videoCompress);
RegistrySSC.SetValue(Sub, "CompresorName", compresorName);
61
62