Moving forward

I have decided to work on learning maths and learning reverse engineering.
So right now I am watching MIT OCW courses ( MIT_18.01, MIT_18.02 and MIT_18.06) for improving my mathematics knowledge. (all this to attain my final goal of completing a much promised project with requires linear algebra as it deals with computer vision.(hand signs 😀 )).

Along with this I am also working on improving my RE Skills so I will be reading through following books in no particular order

  • Game Hacking: Developing Autonomous Bots for Online Games
  • (Addison-Wesley Microsoft Technology Series) Johnson M. Hart-Windows System Programming-Addison-Wesley Professional (2010)
  • (Software Security Series) Christian Collberg, Jasvir Nagra-Surreptitious Software_ Obfuscation, Watermarking, and Tamperproofing for Software Protection-Addison-Wesley Professional (2009)
  • (The Addison-Wesley Microsoft technology series) Mario Hewardt, Daniel Pravat-Advanced Windows Debugging-Addison-Wesley (2008)
  • (The Morgan Kaufmann Series in Software Engineering and Programming) John R. Levine-Linkers & Loaders-Morgan Kaufmann (1999)
  • Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman-Compilers – Principles, Techniques, and Tools-Pearson_Addison Wesley (2006)
  • The.IDA.Pro.Book.2nd.Edition
  • Bruce Dang, Alexandre Gazet, Elias Bachaalany-Practical Reverse Engineering x86, x64, ARM, Windows Kernel, Reversing Tools, and Obfuscation-Wiley (2014)
  • Jeffrey M. Richter, Christophe Nasarre-Windows via C C++ (Pro – Developer)-Microsoft Press (2007)
  • Peter van der Linden -C++ Expert C Programming – Deep C Secrets. -Prentice Hall (1994)
  • Ritchie-Kernighan-The_C_Programming_Language_2_ed
  • Steven S. Muchnick-Advanced Compiler Design and Implementation. 1-Morgan Kaufmann (1997)
  • Tarik Soulami-Inside Windows debugging _ a practical guide to debugging and tracing strategies in Windows-MS Press (2012)
  • harbison-s-p-steele-g-l-c-a-reference-manual-5th-ed

Just including the list of books for my own reference in case I forget 🙂 later.

Hello world !

wow finally hello world , you have been waiting for this right ;p. if you have setup all the things correct and added libraries to the IDE , then It’s time to do some nice simple coding.

fire up eclipse , now create a project and add libraries and library paths.

here is the code that I have used

/*
* hello.cc
*
* Created on: Feb 23, 2013
* Author: ludkiller
*/

//This file is for educational purpose

#include<iostream>
#include<cv.h>
#include<highgui.h>

using namespace std;
using namespace cv;

int main(int argc, char **argv) {

Mat image;
//check if filename is provided through command line.
if(argc != 2)
return 0;
//imread function takes file name(if file exists in same directory as executable) or path to file
//and returns a Mat object.
image = imread( argv[1] );
//We can use if(!image.data) to check if image is loaded or not.
//namedWindow to create a window (highgui)
namedWindow(“Display Window”);
//imshow takes a window name and Mat object as parameters and shows a window.
imshow(“Display Window”,image);
//waitKey(x) waits till x ms . 0 is for infinity.
waitKey(0);
return 0;

}

ok now compile/build and run it using command line like this

./Hello_world image.jpg

this will open a nice image in a windows ;D, that’s what it does displays and image as you can see in below image.

Screenshot from 2013-02-23 22:02:34

 

now let us see what the code exactly does. I have commented the code so it will be easy if you just look at the code (you should know basics of C/C++)

 

#include<iostream>
#include<cv.h>
#include<highgui.h>

the above files are included files which are needed for various function and classes.

like Mat class , namedWindow function and other functions.

 

using namespace std;
using namespace cv;

above namespaces are included to make program user friendly, if you don’t use these then you need to use scope resolution to resolve things present in other name spaces.

for example if you skip using namespace std;

std::cout<<“Hello world”;

and if you skip using namespace cv;

then you need to do cv::Mat to declare object of Mat class.

then comes our main() function the entry point of program.

 Mat image;

declare a object of Mat class.

if(argc!=2)

return 0;

check if image path is provided or not if not then exit program.

image = imread(argv[1]);

argv[1] contains image path, so it’s passed on to imread(path to image);

namedWindow(“Display Window”);

create a window named “DIsplay Window”.

imshow(“Display Window”,image);

imshow is used to display image stored in a Mat Object.

first argument is window name and second object is object of class image with loaded image.

waitKey(0);

return 0;

waitKey(x) takes time as argument time is in milli second so waitKey(40); will wait for 40 ms.

Setting Up Eclipse CDT IDE

well now comes the most difficult part ;3, how to setup eclipse IDE CDT for C/C++ development

the process is really long, so tighten your horses.

Open terminal type

sudo apt-get install eclipse-cdt

guess what It’s done. 😀

yeah I know short and sweet ;p , now to run eclipse IDE open terminal type

eclipse &

ok Now we need to include Library paths for OpenCV in our includes :D.

follow the following images and you shall get your answer.

Start Eclipse > Create a New Project > Project > Properties.

Now follow these images.

add /usr/local/include/opencv to Include paths.

Screenshot from 2013-02-22 22:17:58

add /usr/local/lib to Library Search Paths as shown in image.

add following to Libraries as shown in image below

opencv_flann
opencv_legacy
opencv_contrib
opencv_objdetect
opencv_calib3d
opencv_features2d
opencv_video
opencv_ml
opencv_highgui
opencv_imgproc
opencv_core

Screenshot from 2013-02-22 22:20:53

Getting Started (LINUX)

Now let’s set up OpenCV on our Ubuntu Machine.

You need following components to compile and install OpenCV libraries on your ubuntu system.

  • GCC 4.3 or later. In Ubuntu/Debian it can be installed with

 sudo apt-get install build-essential

  • CMake 2.6 or higher

sudo apt-get install cmake cmake-qt-gui

  • Subversion (SVN) client / Git

sudo apt-get install git

  • GTK+ 2.x or higher, including ers (e.g. libgtk2.0-dev)

sudo apt-get install libgtk2.0-0 libgtk2.0-dev

  • pkgconfig

sudo apt-get install pkg-config

  • libpng, zlib, libjpeg, libtiff, libjasper with development files (e.g. libjpeg-dev)

sudo apt-get install libpng12-0 libpng12-dev zlib1g zlib1g-dev libjpeg8 libjpeg8-dev libjpeg62 libjpeg62-dev libtiff4 libtiff4-dev libtiff5 libtiff5-dev libjasper1 libjasper-dev

  • Python 2.3 or later with developer packages (e.g. python-dev)

sudo apt-get install python2.7 python2.7-dev

  • SWIG 1.3.30

sudo apt-get install swig swig2.0

sudo apt-get install ffmpeg

  • libdc1394 2.x + headers for video capturing from IEEE1394 cameras

sudo apt-get install libdc1394-22 libdc1394-22-dev

Download OpenCV latest Stable version from their sourceforge repo

http://sourceforge.net/projects/opencvlibrary/files/?source=navbar

select the one you want 2.4.4 is the latest and stable one

OpenCV-2.4.4

extract the files from the archive anywhere you want, now cd into OpenCV-2.4.4 , do a mkdir release

now cd into release and type cmake-gui ../

a GUI will be presented click on configure , read and check the boxes you want , now click generate , ok so now we have geenrated some UNIX makefiles

cd into your OpenCV-2.4.4/release and then type sudo make install

now do a ldconfig -v

and then export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH  default installation directory is /usr/local/lib

FInally OpenCV is ready to be used 😀

Next tutorial will be about setting up Eclipse CDT IDE to make our life easy.

OpenCV : Starting of a dream

It was around winter when i first heard of the word OpenCV(Open Computer Vision), fascinating it was when i learned about stuff you can do with it, if you find it fascinating like I did, then you are at the right place, I am starting this blog to introduce newbies to the concept of OpenCV , how to process images , track things and other fun things. 😀

I will be working on Live projects so be sure to check my Git repo http://github.com/ludkiller

if you are interested we can work on Open Source projects.