May 2009


Here is a description of some of the most fundamental and easy to use functions in openCV.

This should be a good starting point for beginners ….

Function CvLoadImage – Used to load an image data into an IplImage array

cvLoadImage(const char* fileName, int iscolor)

file name – Name of the image to load
iscolor -  number of channels of the image
If  iscolor > 0 the image loaded will always have 3 channels
If iscolor < 0 the image will be loaded with the number of channels based on the file
If iscolor = 0 the image will always have 1 channel.

Channel : A channel is the number of numbers used to specify a pixel value…
In RGB say each pixel’s color is specified by it’s R, G, B values. Hence, channels = 3.

IplImage *grayScaleImage;

//Create the image…
grayScaleImage = cvCreateImage(cvSize(320,240),8,1);

Function cvCreateImage – Used to create and allocate image data

cvCreateImage(CvSize size, int bitDepth, int channels);

CvSize is a OpenCV basic structure.
typedef struct CvSize
{
int width;
int height;
}

Size – size of the Image
bitDepth – the bitDepth of the image
Bit Depth:  Bit Depth is the number of bits used to store information about an image.
Alternately for the bitDepth one can also use the OpenCV constants like IPL_DEPTH_8U, IPL_DEPTH_16S etc…
channels – Number of channels in the image

//Convert the original image to grayscale
cvCvtColor(originalImage, grayScaleImage, CV_BGR2GRAY);

Function cvCvtColor – Used to convert Images in one color space to another

cvCvtColor(const CvArr* SourceImage, const cvArr* DestinationImage, int code)

“code” – color conversion operation to be performed.
There are numerous conversion operations listed in OpenCV. They include conversion to and from RGB, YCrCb, HSV and Bayer.
CvArr is just a basic structure in OpenCV. It is used only in functions to specify that the parameter accepts more than one kind of array (there are many types of arrays in OpenCV and IplImage is one such type).

// Edge detection
IplImage * edgeImage; //Declare an image for holding the results of the edge detection perfomed on the grayScaleImage.
edgeImage = cvCreateImage(cvSize(320,240), 8, 1); //Create Image

//Perform edge detection using the canny edge detector
cvCanny(grayScaleImage, edgeImage, 0.5, 0.5, 3);


Function cvCanny – Used to perform edge detection with the Canny Operator

cvCanny(const cvArr *Image1, const cvArr *Image2, double threshold1, double threshold2, int kernel_size)

Image1 – Original Image on which edge detection is to be performed.
Image2 – The results of the edge detected image.
threshold1 and threshold2 – Thresholds for the canny detector.
kernel_size – Size of the sobel kernel – Value of 3 gives a 3 X 3 kernel.

//If all goes well we need to save the results of the edge detection.
cvSaveImage(“Resultant.jpg”,edgeImage);

Function cvSaveImage – Used to save an IplImage as a Image

cvSaveImage(const char*  FileName, const CvArr*   Image);

FileName – Name of the save file
Image  – Image to be saved

//Finally release the memory for the images that were created
cvReleaseImage(&edgeImage);
cvReleaseImage(&grayScaleImage);

Function cvReleaseImage – Used to release the image data

cvReleaseImage(IplImage **Image)

Image  – Image to be released

Serena Williams took another step towards capturing her 11th career Grand Slam singles title on Thursday after breezing past Virginia Ruano Pascual in straight sets 6-2, 6-0 at Roland Garros.

Serena struggled in her opening match against Klara Zakopalova but showed no signs of difficulty on Thursday as she needed just 57 minutes to drop Ruano Pascual. Williams collected 23 winners and broke Ruano Pascual’s serve on five of eight opportunities while never having her serve broke.

Williams has achieved a career Grand Slam with four titles at the Australian Open (2003, 2005, 2007, 2009), three titles at the U.S. Open (1999, 2002, 2008), two at Wimbledon (2002, 2003) and a French Open title (2002).

Here is a map of the world showing the distribution of Swine Flu cases and associated deaths.

swineFlu

Public school Eton will close for a week after a pupil tested positive for swine flu, a school spokesman has said.

The Berkshire school, which was attended by princes William and Harry, was informed on Wednesday that a 13-year-old boy had tested positive.

Health authorities advised the school to shut until 7 June.

It comes after health officials announced a further 17 people in the UK were diagnosed with the virus, taking the total number of cases to 203.

Fourteen of the new cases – 13 children and one adult – are part of an outbreak now totalling 64 cases linked to Welford Primary School in Birmingham.

Welford is carrying out a “deep clean” while closed for half-term.

 

Source : BBC News

The “Baghdad Five” case is the UK’s longest-running hostage crisis since Terry Waite and John McCarthy were held in Lebanon a generation ago.

 

http://news.bbc.co.uk/2/hi/uk_news/8071167.stm

The Pakistani Taliban has claimed responsibility for a bomb attack in Lahore which killed at least 26 people.

A deputy to Taliban leader Baitullah Mehsud told the BBC over telephone that the attack was in response to the army’s continuing operation in Swat.

The caller, who identified himself as Hakimullah Mehsud, threatened similar attacks in other cities of Pakistan.

“Residents should leave the cities of Islamabad, Rawalpindi, Lahore and Multan,” he said.

More than 200 people were also injured in Wednesday’s attack.

 

Source : BBC News

Here is the link for the official openCV Yahoo group. Join today to get introduced to extremely large number of useful tips and tricks to get expertise in this field.

 

http://tech.groups.yahoo.com/group/OpenCV/

The story of the Fake IPL Player….FIP for many. 

http://fakeiplplayer.blogspot.com/2009/05/long-and-short-of-it.html

World number one Rafael Nadal powered his way into the third round of the French Open, beating Russian Teimuraz Gabashvili 6-1 6-4 6-1.

After taking the first set comfortably, the Spaniard was made to work harder for the second but still prevailed.

Gabashvili showed spirit but was ultimately powerless to prevent Nadal sealing the match in straight sets.

Seventh seed Gilles Simon is also through after a 7-5 6-0 6-1 win over American Robert Kendrick.

Gabashvili began extremely well, taking the first three points of the match to have three break points, but Nadal quickly refocused and claimed the next five to avert danger.

The top seed may not have had it entirely his own way for the remainder of the set but the power and accuracy of his forehand was simply too much for Gabashvili and Nadal was able to wrap it up for the loss of just one game._45832545_nadal

In the second set Gabashvili produced more than double Nadal’s winners with 12 to five, which goes someway towards explaining his increased competitiveness – represented by four games won – throughout the set.

 

SOURCE : BBC News.

Next Page »