Wednesday, November 4, 2009

Image Difference

Following Images show the difference of two images in mainwin1














mainwin show the edges of the second image

One of the most common and frequent problem in front of us is to extract the information from the real time data because of real time data is dynamic in nature, so for that there is a need of efficient algorithm which can intelligently interact with your real time data and solve your problem , rather I can say that there is need to train your algorithm by taking the data from the well defined data set and train your system for every possible input for this we can use the different training techniques like ANN but for this post my concern is not about ANN but to solve a problem of detecting the object from the real time data .

in this Post I discuss about to detect the object from the real time data ,for example you want to detect the model of car running on the road so first you click the snap from a particular location without shaking or shivering click another snap of the road from same position without a car .so finally you have two snap one is of road with car and another is of only road now follow the procedure

1)convert both images in to Gray scale, you can use this formula for this
Y = 0.3*R + 0.59*G + 0.11*B
2)after that subtract two images I(Final)= I(Reference) -I(Real-time)
3)classify the pixels in two black or white ,for 8 bit gray scale value > 100 is a white color else it should be black
I=RsterScan(I(Final))
if [value > 100]
I = 255
else
I = 0

4) finally further smoothness will be provided on the basic of neighbour hood
5) Filter the shadow

now after that much thing , now you can extract information like height of car width of car, radius of wheel from the final image and providing this information to ANN and you will come up with a model of car



Tuesday, September 29, 2009

OpenCV Webcam

laziness one of the most common property of IT geeks like me ;) ,who spend 10-12 hrs in front of PC , which leads to problem like RSI , cervical spondylosis .There is some alternative or preventive present to avoid problem accord due to this , but preventive will be taken at the verge :P this is a simple human tendency ,in actually we need a newly designed systems which give's us a comfort at maximum level

for the same problem some project's are going on like handVU,ehci library (google codes) and on the same foot step I start working on gesture recognition ,actually I designed application like simple calculator which is controlled by the particular color(blue) detection .I share my code with you in my upcoming post in this post I give you just a glim's about OpenCV and how to display video from web cam using OpenCV

what is OpenCV ?
Very simple Question and well answered by wikipedia :P

How to Install OpenCV ?
for fedora
$>yum install opencv
and for other distro

after following the above instructions now try this code with appropriate compiler option

#include "cv.h"
#include "highgui.h"
#include

// A Simple Camera Capture Framework
int main() {

CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );

if( !capture ) {
fprintf( stderr, "ERROR: capture is NULL \n" );
getchar();
return -1;
}

// Create a window in which the captured images will be presented
cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );

// Show the image captured from the camera in the window and repeat
while( 1 ) {
// Get one frame
IplImage* frame = cvQueryFrame( capture );
/* if( !frame ) {
fprintf( stderr, "ERROR: frame is null...\n" );
getchar();
break;
}*/

cvShowImage( "mywindow", frame );
// Do not release the frame!

//If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
//remove higher bits using AND operator
if( (cvWaitKey(10) & 255) == 27 ) break;
}

// Release the capture device housekeeping
cvReleaseCapture( &capture );
cvDestroyWindow( "mywindow" );
return 0;
}

if output is ERROR: capture is NULL than it might be possible your camera is incompatible with OpenCV

enjoy :) with OpenCV


Tuesday, June 23, 2009

Change GRUB splash screen

Wow !! itz a amazing experience to change my grub splash screen , for those who don't know about it, I write the procedure to change the grub splash screen

for Changing the grub splash screen you have to follow these steps

1)Download the splash. screen from http://schragehome.de/splash/
2)$ su -
3)Edit the grub file # vi /boot/grub/menu.lst
4)give the proper link for the splash.xpm.gz
5)reboot

now check that your splash screen has changed

:-fat0ss

Wednesday, May 13, 2009

Kill BUG using patch

so, finally i know that how to create a patch :D,this is a beautiful concept to remove a bug by using simple Linux commands . The command 'diff' and 'patch' create a powerful combination and hit the bug from the program :) ,diff command is widely used to get a difference between original file and updated file and this difference is stored in a patch file and through this way other people who have only a original file can change it in to a update file by applying a patch using a patch file.

create  a patch

we create a patch by using diff command , suppose we have to file 'original' and 'updated' the content of original file is "my name is aman" and the content of updated file is "my name is neshu",and we have to conver the original file in to the updated file by applying a patch and patch would be created as,

$>diff original updated > patchfile.patch 

now patchfile.patch conatin a difference of both files

$>cat patchfile.patch

1c1
<
my name is aman

---

>my name is neshu

1c1 denotes that there is some thing to  change at 1st line
similarly 'd' is for delete and 'a' is for add

As you may have noticed, I omitted explaining what the 3 -'s are for. They indicate the end of the lines that should be replaced and the beginning of the lines that should replace them. They separate the old and the new lines.

Applying a patch

Applying a patch is a very simple task , after applying a patch on original file it will convert it in to updated file ,

$>patch original patchfile.patch

patching file original

 original file is now converted in to updated  

--

Happy Patching :)

:-fat0ss