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