|
Introduction to Computer Vision with the OpenCV Library on Linux |
|
Author: Lubos Rendek
Abstract
The purpose of this document is to help a reader to get started with
Computer Vision library OpenCV on Linux system. OpencCV is a
multi-platform library, but this article will be focused only on
OpenCV using Linux operating system ( although, just the installation of the OpenCV library and video camera is platform-specific, all examples in this article should compile on any platform where OpenCV is properly installed such as Mac OS, MS Windows and etc.). Reader will be guided through a
step-by-step guide on how to install and use some of the basic
functions of OpenCV library such as displaying images, playing a video
or using a video camera to process a video input stream. Conventions used in this article: - $ - execution on the command line by a non-privileged user
- # - execution on the command line by a superuser
- the actual command to be executed on the command line or code of program to be compiled
- OUTPUT: output produced on the command line by command execution
- NOTE: general notes and additional information
Introduction In
simple words a Computer Vision is a scientific field which attempts to provide a sight to the machine. This scientific field has expanded rapidly in
recent years. Among researchers this growth is because of many improvements
of vision algorithms and among the computer vision hobbyists this is
due to the cheaper hardware components and processing power. OpenCV
library plays a great role in the Computer Vision field as it helps
greatly to reduce cost and preparation time of computer vision research
environment needed by university students, hobbyists and professionals.
OpenCV also provides a simple to use functions to get the work done in
a simple, effective and elegant manner. OpenCV was started by Intel,
and later it was transformed to an open source project now available on SourceForge.net.
OpenCV library has multi-platform availability, and it is partially
written in C++ and C language. Despite the fact that this library is
available on many Linux distributions from its relevant package
repositories, in this article we will attempt to install and use OpenCV
library compiled from a source code downloaded from SourceForge.net web site.
The reasons for compiling a source code may include:
- new version 2.0.0 recently released and more features available
- some bugs fixed which affected Linux OpenCV 1.0.0 versions ( such as cvGetCaptureProperty() etc. )
- more support is available for OpenCV 2.0.0 version than for former 1.0.0 version
This
article will start with installation of OpenCV on Debian 5.0 ( Lenny ).
Later a reader will be guided through a number of examples on how to
use OpenCV to display an image, play a video and use camera to capture
the video input stream.
|
|
Read more...
|
|
C++ : Understanding pointers |
|
Author: Lubos Rendek
Date: 10.09.2009
Update: 04.03.2010 - Section 7.2 created clarify relation between Pointers and Arrays in C++
Introduction
This article is intended to all programing enthusiasts on all levels who do wish to understand pointers in C++ language. All code presented here is not a compiler specific and all examples will be written in plain ANSI C++. Debate about pointers can stretch for miles, and you would need to go really far to master it all. If you really want to run that far, this article gives you a clear understanding of fundamental concepts about pointers and prepares you for that journey. However, those who are new to C++ programming make sure that you are able to write and run your own C++ “hello world” program, and also it is recommended that you have a basic understanding of C++ functions and classes. If you need to refresh your knowledge about how to compile and run C++ program, use functions and classes, please read an appendix at the end of this document before you continue reading this article.
What is a Pointer?
Pointer is a variable that stores a memory address. OK, that is simple ! But, what is a memory address then? Every variable is located under unique location within a computer's memory and this unique location has its own unique address, the memory address. Normally, variables hold values such as 5 or “hello” and these values are stored under specific location within computer memory. However, pointer is a different beast, because it holds the memory address as its value and has an ability to “point” ( hence pointer ) to certain value within a memory, by use of its associated memory address.
Retrieving a Variable's Memory Address
OK, enough talking and let's get down to the pointer business. To retrieve a variable's memory address, we need to use address-of operator &.
#include <iostream> int main() { using namespace std; // Declare an integer variable and initialize it with 99 unsigned short int myInt = 99; // Print out value of myInt cout << myInt << endl; // Use address-of operator & to print out // a memory address of myInt cout << &myInt << endl;
return 0; }
OUTPUT:
99 0xbff26312
The first line of the output contains an integer value 99 and on the second line, there is a memory address of myInt printed out. Please note that your output will be different.
Assigning a Variable's Memory Address to a Pointer
Before we can assign a memory address to a pointer, we need to declare one. Declaring a pointer in C++ is as simple as to declare any other variable with one single difference. Asterix symbol " * " needs to be add and located after variable type and before a variable name. One rule has to be followed when assigning memory address to a pointer: pointer type has to match with variable type it will point to. One exception is a pointer to void, which can handle different types of variables it will point to. To declare a pointer pMark of type unsigned short int a following syntax is to be used:
#include <iostream>
int main() { using namespace std;
// Declare and initialize a pointer. unsigned short int * pPointer = 0; // Declare an integer variable and initialize it with 35698 unsigned short int twoInt = 35698; // Declare an integer variable and initialize it with 77 unsigned short int oneInt = 77; // Use address-of operator & to assign a memory address of twoInt to a pointer pPointer = &twoInt; // Pointer pPointer now holds a memory address of twoInt
// Print out associated memory addresses and its values cout << "pPointer's memory address:\t\t" << &pPointer << endl; cout << "Integer's oneInt memory address:\t" << &oneInt << "\tInteger value:\t" << oneInt << endl; cout << "Integer's twoInt memory address:\t" << &twoInt << "\tInteger value:\t" << twoInt << endl; cout << "pPointer is pointing to memory address:\t" << pPointer << "\tInteger value:\t" << *pPointer << endl;
return 0; }
OUTPUT:
pPointer's memory address: 0xbff43314 Integer's oneInt memory address: 0xbff43318 Integer value: 77 Integer's twoInt memory address: 0xbff4331a Integer value: 35698 pPointer is pointing to memory address: 0xbff4331a Integer value: 35698

The diagram above is a high level visual abstraction of how are variables stored within a computer memory. Pointer pPointer starts at memory address 0xbff43314 and takes 4 bytes. Pointer pPointer holds as a value a memory address of a short int twoInt ( 2 bytes ) which is 0xbff4331a. This address is stored as a binary data within a pointer's memory space allocation. Therefore, dereferencing a pointer with a memory address 0xbff4331a will indirectly access a value of twoInt which is in this case a positive integer 36698.
|
|
Read more...
|
|
APACHE web server and SSL authentication |
|
Author: Jaroslav Imrich
This article describes configuration techniques of module mod_ssl, which extends a functionality of Apache HTTPD to support SSL protocol. The article will deal with authentication of server (One-way SSL authentication), as well as it will also include authentication of clients by using certificates (Two-way SSL authentication).
Introduction
If you have decided to enable a SSL ( Secure Sockets Layer ) protocol on your web server it may be because you would like to extend its functionality to achieve an integrity and confidentiality for a data transferred on unsecured networks. However, this protocol with the combination of PKI ( Public Key Infrastructure ) principles can also along the side of integrity and confidentiality provide authentication between both sides involved in the client-server communication.
One-way SSL authentication allows a SSL client to confirm an identity of SSL server. However, SSL server cannot confirm an identity of SSL client. This kind of SSL authentication is used by HTTPS protocol and many public servers around the world this way provides services such as webmail or Internet banking. The SSL client authentication is done on a “application layer” of OSI model by the client entering an authentication credentials such as username and password or by using a grid card.
Two-way SSL authentication also known as mutual SSL authentication allows SSL client to confirm an identity of SSL server and SSL server can also confirm an identity of the SSL client. This type of authentication is called client authentication because SSL client shows its identity to SSL server with a use of the client certificate. Client authentication with a certificate can add yet another layer of security or even completely replace authentication method such us user name and password.
In this document, we will discuss configuration of both types of SSL authentication one-way SSL authentication and two-way SSL authentication.
|
|
Read more...
|
|
Choosing the right Linux File System Layout using a Top-Bottom Process |
|
Author: Pierre Vignéras Contact: pierre@vigneras.name Submited: 31.07.2009
As you may probably know, Linux supports various filesystems such as ext2, ext3, ext4, xfs, reiserfs, jfs among others. Few users really consider this part of a system, selecting default options of their distribution's installer. In this article, I will give some reasons for a better consideration of the file-system and of its layout. I will suggest a top-bottom process for the design of a ``smart'' layout that remains as stable as possible over time for a given computer usage.
Introduction The first question that you may ask is why are there so many file-systems, and what are their differences if any? To make it short (see wikipedia for details): - ext2: it is THE Linux fs, I mean, the one that was specifically designed for linux (influenced by ext and Berkeley FFS). Pro: fast; Cons: not journalized (long fsck).
- ext3: the natural ext2 extension. Pro: compatible with ext2, journalized; Cons: slower than ext2, as many competitors, obsolete today.
- ext4: the last extension of the ext family. Pro: ascending-compatibility with ext3, big size; good read performance; cons: a bit too recent to know?
- jfs: IBM AIX FS ported to Linux. Pro: mature, fast, light and reliable, big size; Cons: still developed?
- xfs: SGI IRIX FS ported to Linux. Pro: very mature and reliable, good average performance, big size, many tools (such as a defragmenter); Cons: none as far as I know.
- reiserfs: alternative to ext2/3 file-system on linux. Pro: fast for small files; Cons: still developed?
There are other file-systems, in particular new ones such as btrfs, zfs and nilfs2 that may sound very interesting too. We will deal with them later on in this article (see 5). So now the question is: which file-system is the most suitable for your particular situation? The answer is not simple. But if you don't really know, if you have any doubt, I would recommend XFS for various reasons:
|
|
Read more...
|
|