Saturday, August 26, 2006

Background Subtraction - Stauffer & Grimson's Algorithm

Background Subtraction is a technique in which background and foreground are segmented so that we can perform our required algorithms (such as face detection, gender classification etc). The basic approach for background subtraction is to store the background image as the reference image, in which there is no movement and then in every other frame subtract the reference image to extract the alien objects in the scene. The alien objects are captured as foreground and these are used for further applications.
Since the background does not always remain constant (mainly because of light changes or continuous movement of leaves) therefore we need to develop an approach in which we update the background continuously so that minute changes in the background are made part of the background. Stauffer & Grimson’s algorithm is one of the most reliable algorithms to facilitate adaptive background subtraction.
Stauffer & Grimson Algorithm
The algorithm models each pixel with a mixture of Gaussians. At every frame, for each pixel, distance of pixel’s color value is calculated from each of the associated K Gaussian distributions. Every new pixel is checked against all existing distributions. The match is the distribution with Mahalanobis distance less than a threshold. The mean and variance of unmatched distributions remain unchanged. The matched distributions are updated by using alpha blending concept. For the unmatched pixel, the lowest weight Gaussian is replaced by the new Gaussian with mean at the new pixel and an initial estimate of covariance matrix. Then we sum up distributions less than some threshold to decide whether the current pixel is part of the background or foreground.
Reference
"Adaptive Background mixture models for real-time tracking" by Chris Stauffer and W.E.L Grimson (The Artificial Intelligence Laboratory, Massachusetts Institute of Technology)
http://www.ai.mit.edu/projects/vsam/
Overview of the algorithm is given at the following link:
http://www-staff.it.uts.edu.au/~massimo/BackgroundSubtractionReview-Piccardi.pdf
The original paper is available at the following link:
http://www.ai.mit.edu/projects/vsam/Publications/stauffer_cvpr98_track.pdf

Principal Component Analysis

PCA is an approach used for face recognition and it is also enhanced to work for gender classification and skin detection.

Basic Principles of PCA

To decompose face images into a small set of characteristic feature images called Eigenfaces, which may be thought of as the principal components of the original images. These Eigenfaces function as the orthogonal basis vectors of a linear subspace called Face Space. Recognition is performed by projecting a new face image into this face space and then comparing it position in the face space with those of known faces.

Phases of PCA

A - Initialization
Acquisition of training set of face images and calculation of Eigenfaces.

B - RecognitionGiven an image to be recognized, calculate a set of weights of M Eigenfaces by projecting it onto each of the Eigenfaces. Determine if the face image is a face at all by checking if the image is sufficiently close to the face space. If it is a face, classify the weight pattern as either a known person or as unknown. If the same unknown face is seen several times, Eigenfaces and weight patterns are updated by calculating the new face’s characteristic weight and incorporating into the known faces.

for more info:

http://en.wikipedia.org/wiki/Principal_components_analysis

Dreams

A dream is the experience of envisioned images, voices, or other sensations during sleep.Dreams often portray events which are impossible or unlikely in physical reality, and are usually outside the control of the dreamer.
http://en.wikipedia.org/wiki/Dream#Understanding_dreams

To check what does your dreams mean, choose an alphabet:
http://www.findyourfate.com/dreams/dreams.htm

If Pluto is out of solar system

It is kind of strange that I have to update my basics again :) The astronomers have declared Pluto as a dwarf planet....
http://www.cnn.com/2006/TECH/space/08/24/pluto.ap/index.html

It's quite amazing that astrological studies are weakened. There used to be calculations of Pluto's movement on the stars and stuff like that, now I'm thinking many things are going to be affected. May be my future toooo :D

Monday, August 14, 2006

Managed Extensions for C++ Development Scenarios

Starting with Visual C++ .NET, the standard C++ language has been extended to provide support for managed programming. Managed Extensions for C++ comprise of a set of keywords and attributes.
For each file using Managed Extensions, include the following code at the beginning of the file:

#using
using namespace System; // Only include to access the .NET Framework classes
In addition, you must use the /clr (common language runtime compilation) compiler option when compiling the application.


When using the .NET Framework, code that targets the common language runtime is known as managed code, while code that does not target the common language runtime is known as unmanaged code. Managed Extensions for C++ allows you to mix unmanaged and managed code within the same application. New applications written with Managed Extensions can take advantage of unmanaged code features and new managed code features. Existing components can easily be wrapped as .NET Framework components using Managed Extensions, preserving investment in existing code while integrating with the .NET Framework.
Managed Extensions is the best choice for the following development scenarios:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmex/html/vcconFeaturesOfManagedExtensionsForC.asp

Where did the word "Algorithm" come from?

The answer is:
MOHAMMAD BIN MUSA AL-KHAWARIZMI (Died 840 A.D.)
Abu Abdullah Mohammad Ibn Musa al-Khawarizmi was born at Khawarizm (Kheva), south of Aral sea. Very little is known about his early life, except for the fact that his parents had migrated to a place south of Baghdad. The exact dates of his birth and death are also not known, but it is established that he flourished under Al- Mamun at Baghdad through 813-833 and probably died around 840 A.D.
Khawarizmi was a mathematician, astronomer and geographer. He was perhaps one of the greatest mathematicians who ever lived, as, in fact, he was the founder of several branches and basic concepts of mathematics. In the words of Phillip Hitti, he influenced mathematical thought to a greater extent than any other mediaeval writer. His work on algebra was outstanding, as he not only initiated the subject in a systematic form but he also developed it to the extent of giving analytical solutions of linear and quadratic equations, which established him as the founder of Algebra. The very name Algebra has been derived from his famous book Al-Jabr wa-al-Muqabilah. His arithmetic synthesised Greek and Hindu knowledge and also contained his own contribution of fundamental importance to mathematics and science. Thus, he explained the use of zero, a numeral of fundamental importance developed by the Arabs. Similarly, he developed the decimal system so that the overall system of numerals, 'algorithm' or 'algorizm' is named after him. In addition to introducting the Indian system of numerals (now generally known as Arabic numerals), he developed at length several arithmetical procedures, including operations on fractions. It was through his work that the system of numerals was first introduced to Arabs and later to Europe, through its translations in European languages. He developed in detail trigonometric tables containing the sine functions, which were probably extrapolated to tangent functions by Maslama. He also perfected the geometric representation of conic sections and developed the calculus of two errors, which practically led him to the concept of differentiation. He is also reported to have collaborated in the degree measurements ordered by Mamun al-Rashid were aimed at measuring of volume and circumference of the earth.
The development of astronomical tables by him was a significant contribution to the science of astronomy, on which he also wrote a book. The contribution of Khawarizmi to geography is also outstanding, in that not only did he revise Ptolemy's views on geography, but also corrected them in detail as well as his map of the world. His other contributions include original work related to clocks, sun-dials and astrolabes.
Several of his books were translated into Latin in the early 12th century. In fact, his book on arithmetic, Kitab al-Jam'a wal- Tafreeq bil Hisab al-Hindi, was lost in Arabic but survived in a Latin translation. His book on algebra, Al-Maqala fi Hisab-al Jabr wa-al- Muqabilah, was also translated into Latin in the 12th century, and it was this translation which introduced this new science to the West "completely unknown till then". He astronomical tables were also translated into European languages and, later, into Chinese. His geography captioned Kitab Surat-al-Ard, together with its maps, was also translated. In addition, he wrote a book on the Jewish calendar Istikhraj Tarikh al-Yahud, and two books on the astrolabe. He also wrote Kitab al-Tarikh and his book on sun-dials was captioned Kitab al-Rukhmat, but both of them have been lost.
The influence of Khawarizmi on the growth of science, in general, and mathematics, astronomy and geography in particular, is well established in history. Several of his books were readily translated into a number of other languages, and, in fact, constituted the university text-books till the 16th century. His approach was systematic and logical, and not only did he bring together the then prevailing knowledge on various branches of science, particularly mathematics, but also enriched it through his original contribution. No doubt he has been held in high repute throughout the centuries since then.

14th August 2006

)-(appy Independence Day - Pakistan became 59 years old today. God bless my country and help me to do something beneficial for it.(Amen)

Thursday, August 10, 2006

The Coding King

My friend, Mian Haroon Saeed, won "The Coding King" competition. Though I did not know about this kind of competition, but Haroon surfs Microsoft a lot I think :)

Still it is a great achievement, I wish him good luck. Now he has again awakened a challenger in me. Now I'll have to look for these kinds of competitions :D

For more information:
http://blogs.msdn.com/jobsblog/archive/2006/08/08/692567.aspx