Image Understanding and Processing (OpenCvSharp)
Lab Exercise 01
Year 4
Semester 1, 2015
1. Introduction to OpenCvSharp
Open source cross platform wrapper of OpenCV for .NET Framework
Library is written in C#
Runs under Linux, Windows and Mac OS X
Optimized and intended for real-time applications
2. How to Setup OpenCvSharp
Step 1: Installing OpenCV
The main OpenCV site is on http://sourceforge.net/projects/opencvlibrary/ and the
most up-to-date source distribution version for windows is opencv-2.4.7.2.exe.
Once you download the libraries must install them.
OpenCV Modules
cv:
Contains image processing, image structure analysis, motion and tracking, pattern
recognition, and camera calibration
cxcore:
Contains data structures, matrix algebra, data transforms, object persistence,
memory management, error handling, and dynamic loading of code as well as
drawing, text and basic math
highgui:
Contains user interface GUI and image/video storage and recall
ml:
Contains many clustering, classification and data analysis functions
Step 2: Creating Visual Studio project
Start Visual Studio 2010. Create a new Windows Forms Application project.
File -> New Project -> Windows Form Application
Step 3: Adding reference of OpenCvSharp.dll
Add a reference of OpenCvSharp.dll to the Solution
Project -> Add Reference, Browse, find DLL
Step 4: Adding Existing Items
Add the following .dlls to the Solution as Existing Items
cv210.dll, cvaux210.dll, cxcore210.dll, highgui210.dll, ml210.dll
Project -> Add Existing Item, Browse, find DLLs
Exercise:
Design the following Graphical User Interface and implement a separate class to
perform the given Image Enhancement techniques.
1. Convert an image to a Negative image.
Use Cv.Not(src, dst) function
2. Convert an image to a Gray Scale image.
Cv.CvtColor(src, dst, ColorConversion.RgbToGray) function
3. Image enhancement using Threshold transformation.
Refer the following function:
double cvThreshold(
CvArr* src,
CvArr* dst,
double threshold,
double max_value,
int threshold_type
);