Archive for July, 2012

ASCII ART!!! (-_-) [-_-]

Posted: July 21, 2012 in Kreeps
Tags: , , ,

A picture is a poem without words.
– Horace

A picture is worth a thousand words.
-Napoleon Bonaparte

If a picture (image) can worth so many words, why can’t it be made of words (mere ASCII character). Thus, to add little fun to my work i decided to write a program to turn any image into an ASCII art.

Technically making an image from standard symbols and characters is ascii art.

example :

          * 
         / 
       HH 
     SSSSSS
    SSSSSSSS
    S )))) S 
   SS -  - SS
  SSS o  o SSS
 SSSS  6   SSSS
  SSS  __  SSS
   SSS    SSS
      W   W
     WW  WWW
   WWWW  WWWW 
   WWWWWWWWWW
        XXXXXXXXX
      XXXXXXXXXXXXX
    XXXXXXXXXXXXXXXX 
   (__________)XXXXXX 
    ( ___  ___ XXXXXX
       o/   o   XXXXX 
    (  /        XXXXX
      /___)     XXXXX
   (             XXXX
  (     ____    ) XXX
   (               XX
    (          )    X
     (       )      *
       (    )      ***
                    *
1962 book, “Art Typing”

Developing a real ASCII art by typing in each character is really a talent. But for a coder its merely few line of code to convert any image into ASCII file.

This is how i did using openCV library:

  • Open the image and perform little Gaussian smoothing

Mat image = imread(“7.jpg”);
GaussianBlur(image,image, Size(5,5),0);

  • Convert image into Gray Image

Mat grayImage = Mat(image.size(), CV_32FC1);
cvtColor(image, grayImage, CV_BGR2GRAY);

  • for each pixel of image depending on the pixel value write into a text file an ascii character

ofstream f (“file.txt”);
for(int i =0 ; i<grayImage.rows; ++i)
{
for(int j=0;j<grayImage.cols;++j)
{
if(grayImage.at<uchar>(i,j)>230)
f<<“`”;
else if(grayImage.at<uchar>(i,j)>200)
f<<“‘”;
else if(grayImage.at<uchar>(i,j)>160)
f<<“;”;
else if(grayImage.at<uchar>(i,j)>120)
f<<“O”;
else if(grayImage.at<uchar>(i,j)>80)
f<<“8”;
else if(grayImage.at<uchar>(i,j)>40)
f<<“N”;
else
f<<“M”;
}
f<<“\n”;
}

here different characters are chosen to represent different brightness in the final output depending on the white space they have around them.

quality can be improved further by more conditional constraints to the pixel value or edge detection.

Being a-part (UAS-DTU)

Posted: July 9, 2012 in General, Work
Tags: , , ,

UAS-DTU is a project undertaken by B.Tech. Students in Delhi Technological University.

The DTU UAS project was initiated with the primary purpose of developing technologies so as to reduce India’s dependance on foreign ISR (Intelligence, Surveillance and Reconnaisance) products.

The project aims to:
– Maximize in-house research and development
– Minimize the usage of Commercial Off The Shelf products so as to keep the costs low.
– Develop UAVs with reliabilty and safety as their core USPs.

The team participates in the AUVSI Student UAS Competition (an international inter-university aerial robotics challenge) which is held annualy in Webster Field, Maryland, USA

(www.dceuav.com)

This was all i read about it when i just entered into the college and was not a part of this project. But soon i can to knew about my interest in Image Processing and I thank Harsh Agrawal sir (one of the team member) who made me know my interest. So, when the team started recruitment in August I too applied. The recruitment process was really good and I really admire it. After passing the written exam i went under series of interview. And to my strange in one of the interview I was even asked to play Portal game (to check my skills). My last interview was a 7 hour interview started at 12 noon till & p.m.

I was determined throughout. And yeah !! i got selected.

So, I entered the team as Software Developer, Image Processing.

Since that day, I have learned a lot be it about image processing or may many other aspects of life. Working under the finest Leader Jayant Malani was an immense pleasure to me. Seeing the greatest minds like Kumar Shaurya Shankar acted like lots of inspiration to me. Resp. Shivang Baveja  taught me the definition of dedication.

I feel that am writing late about UAS  but there is never too late for good stuff.

Working in team does not only increase my technical skills but also management. Everyone’s dedication in the team, spending sleepless nights in Lab working, standing for hours in sun for test flights , has ultimately brought  us 3rd position in SUAS this year.Thanks to all people supporting us in anyway.

But along with work we do have lots of fun

I have many more things to say, but feel I could only say that for UAS DTU Sky is just the beginning .

Am writing after so long.

But still am back. Past days were learning days for me. I learned lots of things.

Once i found people talking about line follower. Line follower is simply a bot that follows a line. It is very easy to make one using IR sensors. But being an Image Processing Learner I decided to make one using Image Processing.

My aim is not only to make a Line follower but to make it more robust (using image processing)

Till now writing code was easy, but will have to surely append some changes to make it robust.

Simplest line follower (image processing ) can be made doing following, as I did first:

My first step was to reduce brightness variation , which i did through intensity normalization. Generating histogram over some images could explain why i did so.

Secondly I set up a control box which helps me robustly select few parameters for edge detection and image morphology.

Then i perform edge detection (canny). On doing this I get the Image containing path boundaries with white colour and rest with black.

Then i compute Cente of Gravity for white pixels in the image.

Now this COG helps me to orient my bot properly.

Tills here everything is easy. In this i even used Opencv2 (for C++)

the code is though simple but works even for distorted path.