You are on page 1of 26

Prince of Songkhla University Department of Computer Engineering

OpenVSS
Open Source Video Surveillance System

Intelligent Systems
Research Team
http://code.google.com/p/openvss
Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss
Prince of Songkhla University Department of Computer Engineering

OpenVSS
Open Source Video Surveillance System

OpenVSS
Open Source Video Surveillance System

VsAnalyzer SDK
Built an analyzer plug-in!
Nikom SUVONVORN

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• File “VsAnalyzerSDK.rar”
• Decompress…

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• In “VsAnalyzerSDK” directory
• Execute “VsAnalyzeSDK.exe”

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• Accept “license condition”…

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• Define “project name” and number of “parameter”.

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• Define parameter details.

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• Just create it!!!

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• If you have Visual Studio 2008, the code project will


be opened automatically.
•E

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• Built it!
• Build -> Build Solution F6
• Result in “VsResultBin”
• “Vs.Analyzer.myAnalyze.dll
• “Vs.Analyzer.myAnalyzeOpenCV.dll
• Copy to directory “VsServer”…
Copy

Built it!

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• Test the new plug-in


• Execute “VsMonitor.exe”…
• Add new analyze.. Here

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• Define analyzer name “MyAnalyzer”


• Select provider “Local capture device” (webcam)
• Select analyzer “myAnalyze” (our plug-in)

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Built an analyzer plug-in! Open Source Video Surveillance System

• Drug “MyAnalyzer” on a viewer


• Click button to analyze video
• Click button to show the analyzer result
• What is a default filter?
• Click button to show parameters dialog box

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Open Source Video Surveillance System

OpenVSS
Open Source Video Surveillance System

VsAnalyzer SDK
look inside source code!!!
Nikom SUVONVORN

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Source code project Open Source Video Surveillance System

• There two projects


• myAnalyze : C# project
• Communication layer of
OpenVSS framework
• myAnalyzeOpenCV : C++ project
• “VsCvmyAnalyze.h” is our
“Hello World!”…

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Class VsCvmyAnalyze Open Source Video Surveillance System

• VsCvmyAnalyze is “Hello World!” class…


–VsCreate()
•Allocate memory here
•Executed only one time
–VsRelease()
•Release memory here
•Executed only one time
–VsInit()
•Initial variable value here
•Executed only one time
–VsProcess()
•Put what you want to be process
•Re-Executed ever ? fps
Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss
Prince of Songkhla University Department of Computer Engineering

OpenVSS
Class VsCvmyAnalyze Open Source Video Surveillance System

public ref class VsCvmyAnalyze : public VsCvImage


{
private:

int Parameter0;
int Parameter1;

// TODO : add variables


IplImage *imgray;

void VsCreate()
{
VsCvImage::VsCreate();

// TODO : memory allocation


imgray = cvCreateImage(cvSize(Width, Height), IPL_DEPTH_8U, 1);

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Class VsCvmyAnalyze Open Source Video Surveillance System

void VsInit()
{
VsCvImage::VsInit();

// TODO : initial or re-initial


}

void VsRelease()
{
VsCvImage::VsRelease();

// TODO : release memory


IplImage* ptr; ptr = imgray; cvReleaseImage(&ptr);
}

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Class VsCvmyAnalyze Open Source Video Surveillance System

Bitmap^ VsProcess(Bitmap^ srcImage1)


{
VsCvImage::LoadImage(srcImage1, 1);

// Input image -> image1


// TODO : process "image1"
cvCvtColor(image1, imgray, CV_BGR2GRAY);
cvCanny(imgray, imgray, 100, 200, 3);

What this code done? // Output image -> imageout


// TODO : save output to "imageout"
cvZero(imageout);
cvCopy(image1, imageout, imgray);

// TODO : activate notification


//VsNotify();
// TODO : log infomation or meta-data
//VsLoginfo("some thing...");
return VsCvImage::SaveImage(1);
}
Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss
Prince of Songkhla University Department of Computer Engineering

OpenVSS
VsProcess : Parameters Open Source Video Surveillance System

Bitmap^ VsProcess(Bitmap^ srcImage1)


{
VsCvImage::LoadImage(srcImage1, 1);

// Input image -> image1


// TODO : process "image1"
•Change code this line cvCvtColor(image1, imgray, CV_BGR2GRAY);
•Rebuilt the project cvCanny(imgray, imgray, Parameter0, Parameter1, 3);
•Copy plug-in to VsServer // Output image -> imageout
•Analyzer it // TODO : save output to "imageout"
•Change parameters cvZero(imageout);
cvCopy(image1, imageout, imgray);
•What you will see
the results? // TODO : activate notification
//VsNotify();

// TODO : log infomation or meta-data


//VsLoginfo("some thing...");
return VsCvImage::SaveImage(1);
}
Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss
Prince of Songkhla University Department of Computer Engineering

OpenVSS
VsProcess : VsNotify & VsLoginfo Open Source Video Surveillance System

Bitmap^ VsProcess(Bitmap^ srcImage1)


{
VsCvImage::LoadImage(srcImage1, 1);

// Input image -> image1


// TODO : process "image1"
cvCvtColor(image1, imgray, CV_BGR2GRAY);
•VsNotify() cvCanny(imgray, imgray, Parameter0, Parameter1, 3);
–To active recorder
•VsLogin() // Output image -> imageout
// TODO : save output to "imageout"
–To log meta-data to cvZero(imageout);
database cvCopy(image1, imageout, imgray);

// TODO : activate notification


VsNotify();
// TODO : log infomation or meta-data
VsLoginfo("some thing...");
return VsCvImage::SaveImage(1);
}
Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss
Prince of Songkhla University Department of Computer Engineering

OpenVSS
VsProcess : VsNotify & VsLoginfo Open Source Video Surveillance System

• Use “cvCountNonZero” on imgray (edge area)


–If edge area is less than 1% of image : do
•Notify
•Loginfo

CountNonZero
Counts non-zero array elements
int cvCountNonZero( const CvArr* A );

The function cvCountNonZero returns the number of non-zero


elements in A:

result = sumI A(I)!=0

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
VsProcess : VsNotify & VsLoginfo Open Source Video Surveillance System

int num = cvCountNonZero(imgray);


if(num > (imgray->width*imgray->height)*(1/100))
{
// TODO : activate notification
VsNotify();

// TODO : log infomation or meta-data


VsLoginfo("...edge...");
}

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Open Source Video Surveillance System

OpenVSS
Open Source Video Surveillance System

VsAnalyzer SDK - Lab


face detection !!!
Nikom SUVONVORN

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Face detection with Haar-like Open Source Video Surveillance System

• Regenerate plug-in
• From “VsLab.rar”
–Re-code “facedetection.c” to
•VsInit()
•VsCreate()
•VsRelease()
•VsProcess()
• Test it!

Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss


Prince of Songkhla University Department of Computer Engineering

OpenVSS
Open Source Video Surveillance System

Intelligent Systems
Research Team
http://code.google.com/p/openvss
Nikom SUVONVORN – 01/07/53 http://code.google.com/p/openvss

You might also like