December 20, 2008
Making of the Youtube Video
September 28, 2008
Color Detection by using Color space basics
Ever wondered how can i detect the color ..rather one color from many colors and highlight the same..?
This post is all about it…a quick glimpse about the color detection thing is here and also the method which I have used here is Color space conversion..So If you are a color Enthusiast then you should study this post… (more…)
April 4, 2008
Thresholding Operation in OPENCV
Now lets speak about thresholding Operation in OpenCV.
Basic Idea of thresholding is a cut off or a limit..
As we know we can allow or not allow some pixels to go beyond a certain limit.This Thresholding Operation is very useful in many applications.So let’s discuss..
Here in this program i did not use CvAdaptiveThreshold.Simply because i got what i wanted to do on an image.Now you know the function from Opencv and also your own way to do it.Well your choice..
#include "cv.h"
#include "highgui.h"
#include "stdio.h"
int main() {
int height,width,step,channels;
uchar *data;
int i,j,k;
IplImage* frame=cvLoadImage("lena.jpg",1);
if(frame==NULL){ /*If image not fund then exit.
This is the function of this loop */
printf("the file doesnot exist");
exit(0);
}
height = frame->height;/*height is a member of IPLIMAGE structure
and hence it comes handy like this in such situations,
and same goes with below four statements*/
width = frame->width;
step = frame->widthStep;
channels = frame->nChannels;/*Number of channels in the image*/
data = (uchar *)frame->imageData;/*Image is treated as as unsigned char
data hence we use an unsigned char pointer to point to the same*/
for(i=0;i< =height-1;i++)
for(j=0;j <=width-1;j++)
for(k=0;k < 3;k++;)
if (data[i*step+j*channels+k] >=200)
data[i*step+j*channels+k]=255;
/*Here if the pixel is above the threshold(200) is moved to highest value
and the pixels below the threshold are left as it is*/
cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );/*this statement
will initiate a window named mywindow in autosize mode*/
cvShowImage("mywindow",frame);
/*THis statement will show the image in the window
made by the above statement*/
cvSaveImage("Thresholded_image.jpg",frame);/*This function will save the image */
/*as we can see name of the image is followed by the extension.. and the
second argument "frame" is the image which will be saved .This applies
similarly in the above statement cvShowImage as well.Be careful regarding this.*/
cvDestroyWindow( "mywindow" );/*Destroying the initialized Windows */
return 0;/*This statement is compiler specific and might change.
As i already said that I am using DEV C++ as my compiler*/
/*Now try to do the same program a thresholding Operation
by an OpenCV function called cvThreshold.
Search for this function in the
documentation and use it.Have fun with technology.*/
/*The image will be saved in the same folder
where the program exists*/
}
OpenCV Beginners
Dear friends,
This post speaks about how to make use of , or, in other words how to know where to look for data or the Information which you need.I am a member in the yahoo group of the Open CV and I found many beginner Questions popping up related to the camera settings and very basic questions such as pixel access and some others..
So friends after downloading and installing OPEN CV (more…)
Images in OpenCV
This post will speak about creating an image. A simple 8 bit monochrome image.As weknow monochrome image has a single channel and since it is an 8 bit image it has only 0 to 255(n-1)gray levels to represent.Which means (more…)
March 26, 2008
Seeing Through OpenCV
Before we speak about anything else I’d like to speak about Images first ….Please do not think about an image to be an image.Just take an image to be an array of numbers and just numbers, Integers or whatever.Images are nothing but arrays numbers and
