///////////////////////////////////////////////////////////////
/// MOUSE.H WRITTEN BY RITESH RANJAN
///
/// ******************************************
/// feel free to modify and use it I would to hear from u abt improvements
/// ************************************************
/// ritesh_ranjan007@yahoo.com
//////////////////////////////////////////////////////////////////
#include< dos.h >
unsigned int mousex,mousey,mouseb; // global varialble
void showmouse();
void hidemouse();
void readmouse();
void setmousexy();
void setminmaxx(int ,int);
void setminmaxy(int, int);
//////////////////////////////////////////////////////
void showmouse()
{
_AX=0x1;
geninterrupt(0x33);
}
///////////////////////////////////////////////////////
void hidemouse()
{
_AX=0x2;
geninterrupt(0x33);
}
//////////////////////////////////////////////////////
void readmouse()
{
_AX=0x3;
geninterrupt(0x33);
mouseb=_BX;
mousex=_CX;
mousey=_DX;
}
///////////////// move mouse to x,y /////////////////////
void setmousexy(int x,int y)
{
_AX=0x4;
_CX=x;
_DX=y;
geninterrupt(0x33);
}
/////////////////// set max min x values /////////////////////////////
void setminmaxx(unsigned int min,unsigned int max)
{
_AX=0x7;
_CX=min;
_DX=max;
geninterrupt(0x33);
}
////////////////////// set max min y values /////////////////////////
void setminmaxy(unsigned int min,unsigned int max)
{
_AX=0x8;
_CX=min;
_DX=max;
geninterrupt(0x33);
}
/////////////////////////////////////////////////////////////////
Find tutorials for Image processing algorithms in OpenCV and Matlab, Programming in C, Java-scripts, Tips and Tricks, Hacking and lots more ...
Wednesday, November 4, 2009
Tuesday, November 3, 2009
Image Processing - Code to filter color in MATLAB
In this post we will learn to how filter color in Matlab. Matlab provide very good Image processing tool box with many ready made functions. Here I have illustrated a very basic method to filter color in Matlab. The concept is- in the 3D matrix of RGB color space, if the value at a particular pixel have more value in Red space than blue or Green, and if it is within a tolerance value then consider that pixel Red.
eg -
elseif im(i,j,1)>200 & im(i,j,2)<50 & im(i,j,3)<50
white(i,j)=0;
green(i,j)=0;
blue(i,j)=0;
red(i,j)=1;
Copy this code an save as .m file. then run this file.
% ------------Just copy it save a .m file run in MATLAB 7 or highereg -
elseif im(i,j,1)>200 & im(i,j,2)<50 & im(i,j,3)<50
white(i,j)=0;
green(i,j)=0;
blue(i,j)=0;
red(i,j)=1;
Copy this code an save as .m file. then run this file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ------------------------@author:- RITESH RANJAN
% -------- visit:- http://programing-tutorial.blogspot.com/
% ------I have used a simple method. There are many more complex
%--------------- methods too that I will discuss Later
% ----------------Don't forget to change the name of Image file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;
im=imread('image.jpg'); %put image name here
imtool(im);
sz=size(im);
for i=1:sz(1)
for j=1:sz(2)
if im(i,j,1)>200 & im(i,j,2)>200 & im(i,j,3)>200
white(i,j)=1;
green(i,j)=0;
blue(i,j)=0;
red(i,j)=0;
elseif im(i,j,1)>200 & im(i,j,2)<50 & im(i,j,3)<50
white(i,j)=0;
green(i,j)=0;
blue(i,j)=0;
red(i,j)=1;
elseif im(i,j,1)<50 & im(i,j,2)>200 & im(i,j,3)<50
white(i,j)=0;
green(i,j)=1;
blue(i,j)=0;
red(i,j)=0;
elseif im(i,j,1)<50 & im(i,j,2)<50 & im(i,j,3)>200
white(i,j)=0;
green(i,j)=0;
blue(i,j)=1;
red(i,j)=0;
else
white(i,j)=0;
green(i,j)=0;
blue(i,j)=0;
red(i,j)=0;
end
end
end
imtool(white);
imtool(green);
imtool(blue);
imtool(red);
Image Proseesing - Extacting Shapes using OpenCV
// This is a program to find SQUARE shape and Circle shape
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include < math.h >
int main(int argc, char* argv[])
{
IplImage* img=0;
IplImage* gray=0;
CvMemStorage* storage = cvCreateMemStorage(0);
CvSeq* contours;
img=cvLoadImage("shape.jpg");
if(img==NULL)
{
printf("Error in opening image\n");
return -1;
}
cvNamedWindow("win1",1);
cvNamedWindow("win2",1);
gray = cvCreateImage( cvSize(img->width, img->height), IPL_DEPTH_8U, 1 );
cvCvtColor(img,gray,CV_BGR2GRAY );
uchar *data;
data=(uchar* )img->imageData;
uchar *data_gray;
data_gray=(uchar* )gray->imageData;
int step_g=gray->widthStep;
int step=img->widthStep;
int channels=img->nChannels;
for(int i=0;iheight;i=i++)
{
for(int j=0;jwidth;j++)
{
/////////////exracting white
if( (data[i*step+j*channels+0]>200) && (data[i*step+j*channels+1]>200) && (data[i*step+j*channels+2]>220) )
data_gray[i*step_g+j] = 255;
else
data_gray[i*step_g+j] = 0;
}
}
// find counters in the gray image - object detection
cvFindContours( gray, storage, &contours, sizeof(CvContour),
CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE , cvPoint(0,0) );
double area;
double p;
double metric_s,metric_c;
// loop through all counturs
for( ; contours != 0; contours = contours->h_next )
{
area=fabs( cvContourArea(contours,CV_WHOLE_SEQ ) );
p=fabs( cvArcLength( contours, CV_WHOLE_SEQ, -1) );
// determine metric for circle
metric_c=area*4*3.14/(p*p);
metric_s=area*16/(p*p);
if(metric_c > 0.75f && metric_s > 1.0f)
printf(" circle \n");
else if(metric_s > 0.9f && metric_c < 0.8f )
printf(" square \n");
else
printf(" nothing ");
printf("area = %lf perimeter=%lf metric_c=%lf metric_s=%lf\n",p,area,metric_c,metric_s);
}
cvShowImage("win1",img);
cvShowImage("win2",gray);
cvWaitKey(0);
cvDestroyWindow("win1");
cvDestroyWindow("win2");
cvReleaseImage(&img);
cvReleaseImage(&gray);
//printf("Hello World!\n");
return 0;
}
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include < math.h >
int main(int argc, char* argv[])
{
IplImage* img=0;
IplImage* gray=0;
CvMemStorage* storage = cvCreateMemStorage(0);
CvSeq* contours;
img=cvLoadImage("shape.jpg");
if(img==NULL)
{
printf("Error in opening image\n");
return -1;
}
cvNamedWindow("win1",1);
cvNamedWindow("win2",1);
gray = cvCreateImage( cvSize(img->width, img->height), IPL_DEPTH_8U, 1 );
cvCvtColor(img,gray,CV_BGR2GRAY );
uchar *data;
data=(uchar* )img->imageData;
uchar *data_gray;
data_gray=(uchar* )gray->imageData;
int step_g=gray->widthStep;
int step=img->widthStep;
int channels=img->nChannels;
for(int i=0;i
{
for(int j=0;j
{
/////////////exracting white
if( (data[i*step+j*channels+0]>200) && (data[i*step+j*channels+1]>200) && (data[i*step+j*channels+2]>220) )
data_gray[i*step_g+j] = 255;
else
data_gray[i*step_g+j] = 0;
}
}
// find counters in the gray image - object detection
cvFindContours( gray, storage, &contours, sizeof(CvContour),
CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE , cvPoint(0,0) );
double area;
double p;
double metric_s,metric_c;
// loop through all counturs
for( ; contours != 0; contours = contours->h_next )
{
area=fabs( cvContourArea(contours,CV_WHOLE_SEQ ) );
p=fabs( cvArcLength( contours, CV_WHOLE_SEQ, -1) );
// determine metric for circle
metric_c=area*4*3.14/(p*p);
metric_s=area*16/(p*p);
if(metric_c > 0.75f && metric_s > 1.0f)
printf(" circle \n");
else if(metric_s > 0.9f && metric_c < 0.8f )
printf(" square \n");
else
printf(" nothing ");
printf("area = %lf perimeter=%lf metric_c=%lf metric_s=%lf\n",p,area,metric_c,metric_s);
}
cvShowImage("win1",img);
cvShowImage("win2",gray);
cvWaitKey(0);
cvDestroyWindow("win1");
cvDestroyWindow("win2");
cvReleaseImage(&img);
cvReleaseImage(&gray);
//printf("Hello World!\n");
return 0;
}
Sunday, November 1, 2009
Anti virus for free
There are so many people on the net trying to find a final solution to the biggest problem on earth for Window user -- VIRUS. The solution lies in installing a antivirus because of course windows is too lame to protect it self.
Now the biggest problem is which is the best anti-virus.According to the PCWorld the Kaspersky anti-virus stood third on the list of best anti virus. So without wasting any time lets see how we can install Kaspersky anti-virus for free. The biggest problem with the hacked version or craked version is you cannot Update your anti virus .
But using this trick you can not only have a free anti virus but also you can update it and protect your computer.For this we will use KASPERSKY -> Kaspersky 6.0.1.411 becoz it works only in this version. So you will have to down load it form http://kaspersky-antivirus.brothersoft.com/kaspersky-antivirus6.0.1.411
1- go To ( Start ) then ( Run )
2- Type ( regedit ) and press ( OK )
3- Go To ( HKEY_LOCAL_MACHINE\SOFTWARE\KasperskyLab\AVP6\Data ) & Right Click On ( Data ) & Choose ( Permissions )
4- Choose ( Advanced ) From The ( Permissions For Data ) New Window Opened
5- In ( Advanced Security Settings for Data ) Window .. There is a sentence which begin with ( Inherit from parent ... ) click on the nike or check mark to remove it
6- After Removing the check or nike mark you will get a new message .. choose from it ( Remove )
7- Then in ( Advanced Security Settings for Data ) click on ( Apply )
8- After Clicking Apply you will get a new message choose ( Yes )
9- After That Press ( OK ) In ( Advanced Security Settings for Data )
10- After That .. Press ( OK ) In ( Permissions For Data )
11- After That Make An ( Exit ) For ( KasperSky ) .. & Run It Again
12- You Will Notice That The Kaspersky Icon Is Not ( RED ) But Its ( GRAY ) Which means that the program is not activated
13- But if you opened it you will see all things are working perfect 100% Working.
What Happened To The Program After These Steps ?
- You Will update the kaspersky database manually ... no automatic updates.
- The windows security center will tell you that the firewall or\and antivirus is not working ... becoz you made the kaspersky seemed unactiviated. Actually the registry key you have edited stores the information about activation keys and all that. You actually not delected the key but you have prevented the kaspersky form reading it by denying permissions.
Note:- To uninstall you have to undo the steps above. To have to grand all permision to the key above. Also After installing you have to update the Kaspersky before you continue. Because Kaspersky 6 is petty old an you must have a updated version for complete virus protection.
Now the biggest problem is which is the best anti-virus.According to the PCWorld the Kaspersky anti-virus stood third on the list of best anti virus. So without wasting any time lets see how we can install Kaspersky anti-virus for free. The biggest problem with the hacked version or craked version is you cannot Update your anti virus .
But using this trick you can not only have a free anti virus but also you can update it and protect your computer.For this we will use KASPERSKY -> Kaspersky 6.0.1.411 becoz it works only in this version. So you will have to down load it form http://kaspersky-antivirus.brothersoft.com/kaspersky-antivirus6.0.1.411
1- go To ( Start ) then ( Run )
2- Type ( regedit ) and press ( OK )
3- Go To ( HKEY_LOCAL_MACHINE\SOFTWARE\KasperskyLab\AVP6\Data ) & Right Click On ( Data ) & Choose ( Permissions )
4- Choose ( Advanced ) From The ( Permissions For Data ) New Window Opened
5- In ( Advanced Security Settings for Data ) Window .. There is a sentence which begin with ( Inherit from parent ... ) click on the nike or check mark to remove it
6- After Removing the check or nike mark you will get a new message .. choose from it ( Remove )
7- Then in ( Advanced Security Settings for Data ) click on ( Apply )
8- After Clicking Apply you will get a new message choose ( Yes )
9- After That Press ( OK ) In ( Advanced Security Settings for Data )
10- After That .. Press ( OK ) In ( Permissions For Data )
11- After That Make An ( Exit ) For ( KasperSky ) .. & Run It Again
12- You Will Notice That The Kaspersky Icon Is Not ( RED ) But Its ( GRAY ) Which means that the program is not activated
13- But if you opened it you will see all things are working perfect 100% Working.
What Happened To The Program After These Steps ?
- You Will update the kaspersky database manually ... no automatic updates.
- The windows security center will tell you that the firewall or\and antivirus is not working ... becoz you made the kaspersky seemed unactiviated. Actually the registry key you have edited stores the information about activation keys and all that. You actually not delected the key but you have prevented the kaspersky form reading it by denying permissions.
Note:- To uninstall you have to undo the steps above. To have to grand all permision to the key above. Also After installing you have to update the Kaspersky before you continue. Because Kaspersky 6 is petty old an you must have a updated version for complete virus protection.
Play Video in Ms Paint, Photoshop, and in MSWord
Yes you can really Play video in Ms paint. But that doesn't mean that MsPaint have a built in player.
This is just a trick that can be played by using VLC. First you have to enable wallpaper mode in VLC .
Just follow these steps http://programing-tutorial.blogspot.com/2009/10/set-any-video-as-your-desktop-wallpaper.html
Now what you have to do is to press "Print SysRq" to print System Screen.
Now open MsPaint , select new file and press crt+v to paste the clipboard content in msPaint.
---- Now you will see a video playing in the paint.
---DO the same for PHOTOSHOP , select a new file and take a PrintScreen and press crt+v.
-- The same applies for MSWord too. Even where ever you can paste a picture you will see video running.
:) njoy
This is just a trick that can be played by using VLC. First you have to enable wallpaper mode in VLC .
Just follow these steps http://programing-tutorial.blogspot.com/2009/10/set-any-video-as-your-desktop-wallpaper.html
Now what you have to do is to press "Print SysRq" to print System Screen.
Now open MsPaint , select new file and press crt+v to paste the clipboard content in msPaint.
---- Now you will see a video playing in the paint.
---DO the same for PHOTOSHOP , select a new file and take a PrintScreen and press crt+v.
-- The same applies for MSWord too. Even where ever you can paste a picture you will see video running.
:) njoy
Subscribe to:
Posts (Atom)