Thursday, February 28, 2013

Loading large data into Oracle database using SQL* Loader

SQL * Loader is very useful when loading large data, which are very tedious and time consuming task, to the database. Suppose you have a 10000 rows in .csv file and you have to load all the rows to the database. Now what would you do? Would you enter each and every row individually and spends years to do it? obviously not. For this task there is a very useful tool SQL *Loader which load large data file into database in very short time. Here I will give an small example of loading the data which are in .csv file to the ORACLE database located in remote host (same steps can be used to load into local machine).

Wednesday, February 27, 2013

C/C++ program to determine the day of a week

This tutorial is about finding out the corresponding day of the given date. For example, if I want to know which is the corresponding day of date 1991 March 10, then the program returns "Sunday". There are various algorithm proposed for this. The below program is based on and valid for

Source Code

Tuesday, February 19, 2013

Gaussian Filter generation using C/C++

Gaussian filtering is extensively used in Image Processing to reduce the noise of an image. In this article I will generate the 2D Gaussian Kernel that follows the Gaussian Distribution which is given 
Where σ is the standard deviation of distribution, x is the distance from the origin in the horizontal axis, y is the distance from the origin in the vertical axis. The mean is assumed to be at origin O(0,0). The pictorial view of Gaussian Distribution for σ= 0 and mean at origin is

Thursday, February 14, 2013

Median Filter using C++ and OpenCV: Image Processing

Basic Theory

Median filter also reduces the noise in image like low pass filter, but it is better than low pass filter in the sense that it preserves the edges and other details.  The process of calculating the intensity of central pixel is same as that of low pass filtering except instead of averaging all the neighbours, we sort the window and replace the central pixel with median from the sorted window. For example, lets we have a window like this
Now we sort the given window and get the sorted array as [1 1 2 2 3 3 5 6 7]. The median of this array is 4th element i.e 3. Now we replace the central element 7 with 4. That's it.

Source Code

Saturday, February 2, 2013

Calculating a convolution of an Image with C++: Image Processing

In convolution, the calculation performed at a pixel is a weighted sum of grey  levels from a neighbourhood surrounding a pixel. Grey levels taken from the neighbourhood are weighted by coefficients that come from a matrix or convolution kernel. The kernel's dimensions define the size of the neighbourhood in which calculation take place. The most common dimension is 3x3. I am using this size of matrix in this article. During convolution, we take each kernel coefficient in turn and multiply it by a value from the neighbourhood of the image lying under the kernel. We apply the kernel to the image in such a way that the value at the top-left corner of the kernel is multiplied by the value at bottom-right corner of the neighbourhood. This can be expressed by following mathematical expression for kernel of size mxn.