Pages - Menu

Thursday, April 29, 2010

Google's New looks : Revamps Search UI

For a brief moment yesterday i stepped over the new Google search UI. Well, the logo gets finally cleaned up, but the search has make do with lot of distractions :P...


Images:


Sunday, April 18, 2010

Motorola Droid/Milestone hits Indian Stores

The Android Reign begins in India with launch of Milestone by Motorola. Still packing with Android 2.0, Motorola should consider an update to 2.1 as soon as possible.


Visit:
Motorola Milestone:Official Site


Images:

Friday, April 9, 2010

OpenCV: Augmented Reality - Testing

Ok... So Ive been posting a lot of videos on Augmented Reality, but what have I done???


Here is the answer. Yet another augmented reality program written from scratch. The program is written in C with OpenCV libraries. No libraries like ARTOOLKIT / NyARTOOLKIT / ARTKPlus or even OpenGL are used. I initially thought of implementing it in C/C++ only but complications with handling (jpeg) images and streaming from webcams forced me to use OpenCV.


This is my project for the final year (Bachelor of Engineering). Aditya KP (my classmate) is the other person involved in this project.


Details about the project and a complete explanation shall be put up after more testing and fine tuning.


Sneak Preview of the project!!!
Video:

Friday, April 2, 2010

Microprocessor (8086) Lab Manual

Ok. So you do not understand the programs you have. Try this.
I wrote these programs myself, this actually helped me to get a good grip on the assembly language. I also advice that once you get used to the mnemonics, try to code yourself, you would feel very confident and understand better.


You can download the embedded PDFs directly as shown below:


Or you can also download via Mediafire:


Microprocessor Lab Manual Digital Edition [544 kb]
Microprocessor Lab Manual Print Edition [240 kb]


Note:
Digital Edition-To share and store as an ebook.
Print Edition- Minimal version to print on the paper.


Objects:

Histograms of Color Images using OpenCV

This is another simple example to view Histograms of various channels of an Image

Download:
Download the Project folder and the source code [1.29 Mb].



Source code:
//______________________________________________________________________________________
// OpenCV Histograms of Color Images
// Author: Bharath Prabhuswamy
//______________________________________________________________________________________
//______________________________________________________________________________________

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

int main()
{
    IplImage* img  = cvLoadImage("plastics.jpg");

 /* Always check if the program can find a file */
 if( !img )
   return -1;

 IplImage* channel = cvCreateImage( cvGetSize(img), 8, 1 );
        IplImage *hist_img = cvCreateImage(cvSize(300,240), 8, 3);
 cvSet( hist_img, cvScalarAll(255), 0 );

 CvHistogram *hist_red;
 CvHistogram *hist_green;
 CvHistogram *hist_blue;

    int hist_size = 256;      
    float range[]={0,256};
    float* ranges[] = { range };
    
    float max_value = 0.0;
    float max = 0.0;
    float w_scale = 0.0;

 /* Create a 1-D Arrays to hold the histograms */
 hist_red = cvCreateHist(1, &hist_size, CV_HIST_ARRAY, ranges, 1);
 hist_green = cvCreateHist(1, &hist_size, CV_HIST_ARRAY, ranges, 1);
 hist_blue = cvCreateHist(1, &hist_size, CV_HIST_ARRAY, ranges, 1);

 /* Set image to obtain RED as Channel of Interest (COI) */
  cvSetImageCOI(img,3);
  cvCopy(img,channel);
  cvResetImageROI(img);

 /* Calculate histogram of the Image and store it in the array */
  cvCalcHist( &channel, hist_red, 0, NULL );

 /* Calculate and Plot the histograms Green and Blue channels as well */
 /* Green channel */
  cvSetImageCOI(img,2);
  cvCopy(img,channel);
  cvResetImageROI(img);

  cvCalcHist( &channel, hist_green, 0, NULL );
 
 /* Blue channel */
  cvSetImageCOI(img,1);
  cvCopy(img,channel);
  cvResetImageROI(img);

  cvCalcHist( &channel, hist_blue, 0, NULL );


        /* Find the minimum and maximum values of the histograms */
        cvGetMinMaxHistValue( hist_red, 0, &max_value, 0, 0 );
 cvGetMinMaxHistValue( hist_green, 0, &max, 0, 0 );

 max_value = (max > max_value) ? max : max_value;

 cvGetMinMaxHistValue( hist_blue, 0, &max, 0, 0 );

 max_value = (max > max_value) ? max : max_value;    
                        // The variable max_value has the maximum of the three histograms

 /* Using the maximum value, Scale/Squeeze the histogram (to fit the image) */
        cvScale( hist_red->bins, hist_red->bins, ((float)hist_img->height)/max_value, 0 );
 cvScale( hist_green->bins, hist_green->bins, ((float)hist_img->height)/max_value, 0 );
 cvScale( hist_blue->bins, hist_blue->bins, ((float)hist_img->height)/max_value, 0 );

 printf("Scale: %4.2f pixels per 100 units\n", max_value*100/((float)hist_img->height));                         
                                                   //A scale to estimate the number of pixels

    /* Scale/Squeeze the histogram range to image width */
    w_scale = ((float)hist_img->width)/hist_size;

 /* Plot the Histograms */
    for( int i = 0; i < hist_size; i++ )
    {
      cvRectangle( hist_img, cvPoint((int)i*w_scale , hist_img->height),
        cvPoint((int)(i+1)*w_scale, hist_img->height - cvRound(cvGetReal1D(hist_red->bins,i))),
        CV_RGB(255,0,0), -1, 8, 0 );
      cvRectangle( hist_img, cvPoint((int)i*w_scale , hist_img->height),
       cvPoint((int)(i+1)*w_scale, hist_img->height - cvRound(cvGetReal1D(hist_green->bins,i))),
       CV_RGB(0,255,0), -1, 8, 0 );
      cvRectangle( hist_img, cvPoint((int)i*w_scale , hist_img->height),
       cvPoint((int)(i+1)*w_scale, hist_img->height - cvRound(cvGetReal1D(hist_blue->bins,i))),
       CV_RGB(0,0,255), -1, 8, 0 );
    }

    cvNamedWindow( "Image", 1 );
    cvShowImage( "Image",img);

    /* create a window to show the histogram of the image */
    cvNamedWindow("Histogram", 1);
    cvShowImage( "Histogram", hist_img);

    cvWaitKey(0);

 cvDestroyWindow( "Image" );
 cvDestroyWindow( "Histogram" );
    cvReleaseImage( &img );
    return 0;
}


Image:



Histograms and Histogram Equalization using OpenCV

Here is a simple example to view histograms and equalize them.


Download:
Download the Project folder and the source code [2.02 Mb].





Note:
The project is linked to OpenCV 2.0 libraries. Please change it before compiling , if you are using OpenCV 1.0










Images:






Source Code:


//______________________________________________________________________________________
// OpenCV Histograms of Images
// Author: Bharath Prabhuswamy
//______________________________________________________________________________________
//______________________________________________________________________________________

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

int main()
{
    IplImage* img  = cvLoadImage("plastics.jpg");

    /* Always check if the program can find a file */
    if( !img )
 return -1;

 IplImage* gray = cvCreateImage( cvGetSize(img), 8, 1 );
 IplImage* eq_gray = cvCreateImage( cvGetSize(img), 8, 1 );
        IplImage *hist_img = cvCreateImage(cvSize(300,240), 8, 1);
 cvSet( hist_img, cvScalarAll(255), 0 );
 IplImage *eq_hist_img = cvCreateImage(cvSize(300,240), 8, 1);
 cvSet( eq_hist_img, cvScalarAll(255), 0 );

 CvHistogram *hist;
        int hist_size = 256;      
        float range[]={0,256};
        float* ranges[] = { range };
    
        float max_value = 0.0;
        float w_scale = 0.0;

 /* Convert the image to gray */
 cvCvtColor(img,gray,CV_RGB2GRAY);
 
 /* Create a 1-D Array to hold the histogram */
 hist = cvCreateHist(1, &hist_size, CV_HIST_ARRAY, ranges, 1);

 /* Calculate histogram of the Image and store it in the array */
 cvCalcHist( &gray, hist, 0, NULL );

        /* Find the minimum and maximum values of the histogram */
        cvGetMinMaxHistValue( hist, 0, &max_value, 0, 0 );

 /* Using the maximum value, Scale/Squeeze the histogram (to fit the image) */
        cvScale( hist->bins, hist->bins, ((float)hist_img->height)/max_value, 0 );
 printf("Scale: %4.2f pixels per 100 units\n", max_value*100/((float)hist_img->height));           
                                                  //A scale to estimate the number of pixels


 /* Scale/Squeeze the histogram range to image width */
        w_scale = ((float)hist_img->width)/hist_size;

 /* Plot the Histogram */
        for( int i = 0; i < hist_size; i++ )
          cvRectangle( hist_img, cvPoint((int)i*w_scale , hist_img->height),
             cvPoint((int)(i+1)*w_scale, hist_img->height - cvRound(cvGetReal1D(hist->bins,i))),
             cvScalar(0), -1, 8, 0 );

 /* Equalize the histogram */
 cvEqualizeHist(gray,eq_gray);

 /* Calculate and Plot the equalized histogram in the same way */
 cvCalcHist( &eq_gray, hist, 0, NULL );

 cvGetMinMaxHistValue( hist, 0, &max_value, 0, 0 );
 cvScale( hist->bins, hist->bins, ((float)eq_hist_img->height)/max_value, 0 );
 printf("Scale: %4.2f pixels per 100 units\n", 
                                    max_value*100/((float)eq_hist_img->height));
  
        w_scale = ((float)eq_hist_img->width)/hist_size;

 for( int i = 0; i < hist_size; i++ )
  cvRectangle( eq_hist_img, cvPoint((int)i*w_scale , eq_hist_img->height),
          cvPoint((int)(i+1)*w_scale, eq_hist_img->height - cvRound(cvGetReal1D(hist->bins,i))),
          cvScalar(0), -1, 8, 0 );

    cvNamedWindow( "Image", 1 );
    cvShowImage( "Image",gray);

    cvNamedWindow( "Equalized Image", 1 );
    cvShowImage( "Equalized Image",eq_gray);

    /* create a window to show the histogram of the image */
    cvNamedWindow("Histogram", 1);
    cvShowImage( "Histogram", hist_img);

    /* create a window to show the Equalized histogram of the image */
    cvNamedWindow("Equilized Histogram", 1);
    cvShowImage( "Equilized Histogram", eq_hist_img );

    cvWaitKey(0);

    cvDestroyWindow( "Image" );
    cvDestroyWindow( "Histogram" );
    cvDestroyWindow( "Equilized Histogram" );
    cvReleaseImage( &img );
    return 0;
}

Installing OpenCV 2.0

Time to upgrade! I tried to install OpenCV 2.0 the opencv way and couldn't get anywhere. So i just installed this self compiled installer by Max Grosse. Developed for Visual Studio 2005, it works pretty well with Visual Studio 2008. 


Just download the OpenCV-2.0.0-win32-vc2005.exe from the link below and Install it :
http://ioctl.eu/blog/2009/10/24/opencv2_msvc


Remove all the Paths linking OpenCV 1.0 (if any) and add the new OpenCV directories
Images -







Thursday, April 1, 2010

DeviantART hacked !!!

I just logged in to check for updates.. and guess what i see Pattinson and Lady gaga everywhere...wth!


To,
Team Jacob and Team Seeker
-- In case you guys are celebrating.. HAPPY FOOL'S DAY!!