Thursday, 22 December 2016

Using Virtual box to try and run Linux



Virtual box is great tool provided by Oracle to run a guest OS let it be Windows, Mac or Linux. It gives users the freedom to have another
virtual machine without having to change the existing setup of their system but there are some drawbacks.

The Following packages are required
VirtualBox 5.x.x platform packages
VirtualBox 5.x.x Oracle VM VirtualBox Extension Pack (which has support for usb 2.0 and 3.0 etc..)

Host System (where virtual box is installed) must be having good configurations [My idea of a good configuration
minimum 4GB of RAM, 500 GB drive space, at least a dual core (2 cores) system but preference is quad core system (4 cores)]
This is due to the fact that virtual box is installing an entire system on the resources you have allocated like 2 GB of RAM, 70 GB storage space
and 1 processing core.

Friday, 9 December 2016

Some basic myths about Linux

Some basic myths that need to be demystified:
  1. Linux is tough to use: If Windows or Mac OS was the primary OS used for a very long time then it will slightly challenging in the beginning. Once accustomed, it does not take much effort. Linux has various desktop environments (styles of how you computer will appear) to choose from so you have a wider choice as compared to Windows and Mac. If you require a desktop environment similar to windows then try Linux Mint or any other OS which uses Cinnamon / KDE  desktop. Find out more here. Similarly for Mac you can use elementary OS which uses pantheon desktop (currently no other desktop that I know of has this environment) To have a quick glance to how desktop environments appear have a look at Fedora Spins
  2. Linux is used by coders and scientists a lot but I don't do those things that much:  Linux was intended as an alternative to Windows and Mac so it is possible to simply use it for media, web browsing, office (Not Microsoft's office suite), etc.. Only difference is that you don't have to shell out any extra cash while purchasing the hardware. Many Developers and researchers have chosen to use Linux as it is easy and efficient to setup software and automate certain tasks. Linux gives more flexibility on the file system as compared to Mac and Windows.
  3. Linux users use terminal so much and I don't know and don't want to use these commands: Unless there is an error while installing Linux in your system or you are trying to install software from source,  you don't need to know or use the terminal so often. Even if such an issue occurs there are many communities which provide help and direct commands can help solve the problem.
  4. Linux is virus proof: Linux is an OS just like Windows or Mac so it is theoretically susceptible to viruses but there are few aspects to this:   
    • Each distro is slightly different from the first so a virus made by hackers has to be rewritten multiple times for different systems. This becomes tedious as there are too many distributions each with their set of rules etc.. Also the vast majority of people use Windows or Mac thus the population of Linux users using a particular distribution is very less. 
    • Also Linux has a feature called file permissions which limits the access to the system thus protecting your self from viruses.
    • Also most Linux distributions have a software package manager which download the essential software form trusted sources 
    • There are antivirus programs available for Linux as well should the need arise.
  5. I already have a MacBook / Windows System and I hear that I must delete my entire laptop to use it: Installing a Linux distro (especially if it is the first time) can be a difficult task but it is not necessary to delete the current OS. There are 3 methods available to use Linux
    •  Dual boot: Have 2 operating systems in your computer and use only 1 of them at a time. for beginners Ubuntu / Linux mint is a distro to dual boot with Windows / Mac as they have a lot of support and easy installers. For seasoned / veteran Linux users any other distribution like Arch, Cent OS, Debian, Fedora, Kali etc .. can be used
    • Use virtualization software like Virtual box, Vm player: this lets you run Linux in parallel to your current OS but here performance can be an issue as 2 operating systems are running simultaneously. So this operation is useful while running a light weight Linux or the computer has a high configuration (min 4 GB Ram, i5 quadcore system and at least 50 GB storage space)
    • Using Live CD/DVD: You don't have to install Linux to try it out. a new feature is present where you can simply put Linux in a flash and run it without ever having to install. This is a useful feature for reviewing a Linux distros but to actually work or install software on that Linux Live session it is not recommended

My Thoughts on Linux

The following is just my thoughts on Linux. I have already covered on which Linux distro is best for beginners but I would like to put more emphasis on why in this post.

Linux is a free and open source Operating System (OS) which can be considered as an alternative to Other operating systems like Windows 10 by Microsoft and OSX by Apple. This makes sense as not many  can afford the high quality products manufactured by these companies such as MacBook, Microsoft Surface Pro, Microsoft Surface Studio etc.. And for those who can afford it there is not much customization possible as both companies  impose restrictions on the users from utilizing the devices full potential to suite individual needs. Peoples requirements can be form basic office use and media consumption like browser, video/audio player, word documents excel sheets, presentation  to  high level of scientific computations and play computationally intense games. For all of these requirements Linux can be a possible solution for everyone. To know the origins of why Linux was started have a look at Revolution OS  and understand what was in the minds of Richard Stallman, Linus Torvalds, Eric Raymond and many others who have contributed to the idea which is a reality today.

As there are many different people with different opinions, there are different Linux based operating systems to suite different needs. Why are there so many distributions of Linux? "Because we can" would be the closest answer to this question as per the GPL license through which Linux is distributed. The basic gist is that anyone can take the source code (which is open source) modify and do with it as they please and redistribute it. Which is why there are many distros like Debian, Ubuntu, Linux Mint, Fedora, CentOS, openSuse, elementry OS, Arch Linux, Kali Linux, puppy Linux, etc.. to have a brief idea about these various distros have a look at Distrowatch

Thursday, 14 April 2016

How to make a Live USB of Windows/Linux

After choosing an OS(Windows/Linux) the next challenge is to install it on your system without affecting any other system files/data already present in your system. It is a problem for Windows as it does not provide making a bootable live CD/USB with the feature to run from the bootable device without having to install (Live). This feature is in Linux OS so you can try the system without making any changes to you computers HDD. 

This a small procedure I have used to install Linux in different machines.
  • Download the LiveISO file: Download the .iso file of the Linux system to be installed.
  • Create a live USB/CD: Many Softwares are used to make Live CD/USB. For windows use unetbootin(cross-platform), universal usb creator. Linux automatically has tools such as "startup disk creator", "usb image writter", etc.. Select the particular USB/CD to be used (The USB/CD storage size should be greater than the iso file size. Also it is recommended to use USB flash drives as they can be used as many times as needed and they can be rewritten easily.) 

Set Brightness permanently in Ubuntu

Sometimes the brightness controls in Ubuntu do not work properly. Sometimes Ubuntu reverts to its default maximum value every time it reboots. I have used xbacklight but no change was visible. There is a simple fix to the problem using the following steps

  • Locate the back light directory:  Simply type the command
     
    cd /sys/class/backlight/
     
    Next use ls command to list out all the graphics e.g. acpi_video0, radeon_bl0 etc..
  • Locate the brightness file: Enter  the directory, locate the "max_brightness" file and display its content using

    cat max_brightness

    This will display the maximum value max_val of brightness. The "brightness" file controls the screen brightness. Choose the value X you would like to set the brightness where X can be an integer between 0 to max_val. A small tip is to use a fraction of the max_val say 40% to help decide value of X.
    (You may have to do the same procedure on as many folders as there are in /sys/class/backlight/ i.e. in my case I had both acpi_video0 & radeon_bl0 so I had to do it twice for it to work)
  •  Set rc.local: Now that X is chosen simply edit "/etc/rc.local" file using the command
    sudo gedit /etc/rc.local

    This script is executed at the end of each multiuser runlevel. Before "exit 0" command type the following:

    echo X > /sys/class/backlight/<graphic_folder>/brightness
     
    (In my case, 
     echo 6 > /sys/class/backlight/acpi_video0/brightness 
     echo 51 > /sys/class/backlight/radeon_bl0/brightness 
     exit 0
    )
  • Reboot: Reboot your system and you will see that the settings would have taken effect

Thursday, 3 March 2016

Install all octave packages in one shot

FOSSEE is the FREE and OPEN SOURCE SOFTWARE FOR EDUCATION

It aims on providing software which can be used in academia field and industries for free.
This very useful as researchers, institutes and many small scale start-ups and industries need not worry on purchasing licenses of softwares they require as an opensource substitute of that software is present e.g. Matlab can be substituted by octave or scilab,
Photoshop can be substituted by GNU Image Manipulation Program, Illustrator can be substituted by Inkscape and so on.
Octave is a light and open source software useful for computation. It is easy as it uses almost the same programming structure as Matlab, the software which is most used in academia and industries. However when octave is downloaded and installed  it  give a command line interface and all the other packages e.g. signal processing, control, etc are not  downloaded by default. One way to overcome this in Ubuntu (based distros) is :

sudo apt-get install $( apt-cache search octave-forge | awk '{printf $1; printf " " }' ) qtoctave

The text Highlighted in bold is simply a script to list all octave packages and qtoctave is a front end Graphical User Interface (GUI) that can be used instead of the command line interface.

Friday, 29 January 2016

Which Linux Distro to choose as a begineer ?

As mentioned in the earlier post, Linux has become an integral part of our life so now one cannot simply escape without knowing/using Linux. We may see in various hacker movies, the operating system look as though there is only text (Users with a Linux  disto simply press ctrl+alt+f1 to know) and we need to know some sophisticated language and type with incredible speed etc.. THIS IS NOT THE CASE AT ALL. Everyone has a first time with Linux so it is not necessary to know commands for the terminal while using Linux.

Most of the Linux distros come with a desktop environment so that beginners do not face any issue when starting. Only on some rare occasions you may have to use the terminal to write commands e.g. installing libraries for a C/C++ program, building a new software from scratch, etc... There are many different Desktop Environments like and my preference order is as follows:
  • Cinnamon 
  • Mate
  • GNOME 
  • Unity (Mainly used by Ubuntu)
  • KDE
  • XFCE
  • LXDE
  • Standard i.e. (no desktop environment so only commands like Debian standard)

For a beginner, it would be nice to use a distribution which is easy to install as well as use. So the best way to start is to use "Ubuntu" (as it has support for UEFI ) or "Linux Mint" (Linux Mint 17 in case you are using an older system with BIOS and 17.3 "Rosa" support UEFI) or "Elementry OS"(which gives the feel of Mac OSX using Pantheon desktop)  "Fedora" (a bit tedious while installing) which is also UEFI compatible. If you are completely new to Linux, the standard Ubuntu with Unity Desktop will be most preferred.

Ubuntu or its derivatives are easy to install as they generally have the "install alongside" option. One Distro (say Ubuntu with default Unity Desktop) can come in different other desktop environments , as mentioned above, so simply have a look at the other distros (Kubuntu, Lubuntu, Ubuntu-Mate, Ubuntu Studio, etc.. ) from distrowatch.com and see which one appeals the most. So have a look at the distro's desktop
(search for screen shots of the distro you are interested in).

My personal preference is the cinnamon desktop which is not present in Ubuntu. Linux Mint is a derivative of Ubuntu so all the normal command work with a few changes e.g. bashrc file. Next i would choose Ubuntu Mate as it preserves the look of Ubuntu 10.04 if one needs to know how to use / locate applications in the environment. It is not as resource hungry as the later versions of Ubuntu (>13.04) with unity desktop. But then again you are welcome to explore all the distros.

Those who are well versed with Linux can try distributions like Debian which is a very stable and sturdy distro or Fedora which is a project of Redhat. or even Arch Linux, Slackware,

Operating Systems

Linux has now become a part of our life thanks to Linus Torvalds. Many of our systems use Linux in the backend and we are generally unaware e.g. Xbox,  Playstation, Web Servers, Cloud computing servers (e.g. Amazon), Android smartphones (Android OS is a linux), Backtrack/ Kali (the famous hacking OS's) etc.. So it is suggested to try atleast one of these flavors of linux from the wide variety available from the net.

As many of you have seen there has been a huge change in the computers we had in the 90's and in recent times. Moore's law is holding true so far that the number of transistors are doubling. Because of this fact our latest machines are capable to perform many tasks and give us a faster and better way to perform the tasks. Many processors came and came with them the operating system, our guides to the hardware. Generally there are 3 types of operating systems known to most users :
  • Windows
  • Mac OS
  • Linux
Each have their pros and cons like Mac OS was designed to optimized performance and battery life same as that of Windows. It was battle between these two titans, until the arrival of Linux. I have used all the above operating systems and concluded the following:

  • Anybody can use a Mac and it is good in terms of battery life. Windows however, the User Interface (UI) keeps changing with each version(windows XP, 7, 8, 10) so may be slightly hard to use and Battery life does not last more than three hours. Linux may be slightly tough for a beginner but once you get used to it you start to appreciate it however no improvement in battery life.
  • Mac and Windows are proprietary OSs so one cannot just download the OS for free (legally). Linux on the other hand is supported by different organizations and is free for anyone to use as a server, as a desktop, as a cloud, etc.. So many organizations prefer to use Linux on their servers and networks
  • "No one size fits all" .... So Linux comes in many different distributions like Debian, Ubuntu, Linux Mint, Backtrack, Elementry, etc.. are all different flavors of the Debian OS with slight tweaks depending on the way you like it.
  • After Windows 8.1, the normal BIOS has been changed by UEFI which makes it slightly difficult to install another OS along side Windows 8.1 and above. You can only install those Linux OSs which do have support for UEFI like Ubuntu, Fedora, etc..
  • There is no way you can try out Windows or Mac OS without installing them. Linux can be written into a CD / USB flash drive to make "Live" CD/ USB so that one can simply try out the OS before installing
  • Windows is very easily susceptible to virus attacks so an anti-virus program is always required. Mac may not need anti-virus programs as it partially resembles a version of Linux. Linux does not need anti-virus programs.

Running openCV

Running Programs in openCV:

There are many ways to run .c or .cpp programs in opencv you can use the methods specified in the homepage.
I am following the method mentioned in the opencv homepage for using gcc and eclipse

Using Cmake:
To run opencv programs one must now:

  • Create a project folderi.e.,say a program 'proj_name.cpp' is to be created compiled and executed. Create a Folder proj_name (This is only for convinence sake). Create the source file proj_name.cpp
  • Create a .txt file named "CMakeLists.txt" and it must contain the following
cmake_minimum_required(VERSION 2.8)
project( proj_name )
find_package( OpenCV REQUIRED )
add_executable( proj_name proj_name.cpp )
target_link_libraries( proj_name ${OpenCV_LIBS} )



  • Now to compile and create an executable object use the following commands:

cd <DisplayImage_directory>
cmake .
make

4)After compiling you will get an executeable object. To run the code use the command


./proj_name     any_parameter_needed



any_parameter_needed varies depending on your program

Using eclipse(C/C++):
I am following the method mentioned in the opencv homepage

openCV Sample tutorials

To understand the syntax of using openCV in C/C++ it is better "Follow by example". A small tutorial has been generated to understand how to implement the following operations in Matlab/Octave and openCV in C++ :
  1. Mapping images into different colour spaces:
    This part of the program deals with reading an image, understanding its data-structure, seperating different planes (in case of colour images) , conversion from RGB (Red,Blue,Green) to HSV (Hue,Saturation,Value) plane, YUV plane(Intensity, Complement of red, Complement of blue plane)
  2. Point Processing:
    This section deals with how different point processing techniques (Where region of the pixel does not matter) such as Negative of an image, Gray level slicing, Contrast Enhancement, Bit plane slicing etc..
  3. Neighbourhood Processing:
    This section deals how to use masks and convolution operators for Low pass filters, High pass filters, etc..

openCV App: Vehicle Detection and counting

This is a simple program implemented in opencv to detect and count the number of vehicles passing through a virtual fence. A virtual fence is an imaginary line/region of interest (ROI) which is used in detection and processing of a moving object. A virtual fence can be useful for counting of an object, detection of intrusion, determining direction of a moving object but for this purpose we have limited the function of our virtual fence to detection and counting. However, many a priori assumptions were made for determining the optimality taking into account environmental factors such as location and positioning of the camera, illumination variation, ambient noise etc..
The procedure is as follows
  • An inital frame is kept as a reference (prev_frame) and later the next frame (current_frame) is taken and the forward difference(current_frame - prev_frame ) is calculated.
  • Later this image is thresholded to a value such that the noise is suppressed and the objects and highlighted and median filtering is done to remove any noise which might have come after thresholding.
  • After thresholding, we see that the object is not connected properly so morphological operators are used to join the object.

openCV comaptibility with other languages

Matlab is good when it comes to image processing but the codes used are also written in the same language hence the execution of the code lags. Here is where openCV has the advantage as the codes are written to be fast. It is now possible to use openCV in Matlab as well. However I have not found any good document which works perfectly.
OpenCV is mainly developed in C /C++ and they have been optimized in these languages however C / C++ can become complex at times so some developers use python to integrate with openCV and reuse the C/C++ code. OpenCV has python bindings which allows python use the C/C++ functions in the library.This is a good feature to those who are not so familiar with coding (Python is very easy to learn) and for using additional functionality e.g. python can handle complex numbers directly while C/C++ does not deal with it directly.

openCV installation

Installation in Windows:

On the home page of opencv,they have already mentioned how to install the openCV library in windows and configuring it to visual studio.
It is not necessary that you need visual studio. Any C++ compiler/ IDE can be used such as codeblocks compiler (Courtesy STAB IIT Bombay check the link).
First Download the  codeblocks and select "codeblocks-13.12mingw-setup.exe" file. After the installation is complete reboot the system.
Download the opencv2.0 library for windows and during the installation you will be asked about the system path.
Select the option "Add openCV to the system path for all users".
Later in the compiler options-->Search directories-->Compiler and add the include folder of openCV. (Note: BE SURE NOT TO KEEP THE PATH RELATIVE FOR THESE STEPS.)
Next goto compiler options-->Search directories-->Linker and add the lib folder

Next goto compiler options-->Linker Settings and add all the contents of the lib folder one at a time.
Thats it. Now openCV has been configured and can be used to start implementing.
Note: openCV 2.0 has only the basic libraries (which do not include the folder opencv2) so for an introduction to image processing using openCV it is useful. If the advanced functions ( > 2.0) are required the please follow the steps for openCV>2.0 However the installation of this library requires additional 10 software(CMake,tortoise SVN/Git, Miktex, Python, Numpy, Intel Threading blocks, CUDA, Eigen, openEXR, openNI and SphinX) to to downloaded and installed separately. Thus it is recommended to use linux (Ubuntu, Fedora, Linux Mint, Debian etc..) for using openCV.
___________________________________________________________________________________________________________________________________________________

Installation in Linux:

If you check out the home page of opencv, they have already mentioned how to install the software in linux however, I faced some difficulties after the installation so I checked for errors and dependency issues and made a complete step-by-step procedure for installing openCV in Linux. You an also follow the steps mentioned in this web page if you are facing those issues.

Note:I have tested on Ubuntu and Linux Mint so far. It should work for other Debian based distributions as well.

The following are my sources if you would like to explore. Enjoy!!!

Installation Steps:

These instructions can be directly copy-pasted to the terminal in linux. The only assumption is that there is a working Internet connection. It supports the latest openCV currently version 3.1.0.

Install all pre requisites

Ubuntu provides a package of OpenCV 2.x.x that you can easily install by typing:

sudo apt-get install libopencv-dev

If you do not care about having the latest version you could skip the rest of the post however while interfacing with eclipse you may face some issues so it is recommended to follow all the instructions.
Depends on which version of linux you are using.

Simply Copy paste the following into your terminal screen it will install the necessary softwares and dependencies required.

sudo apt-get install libopencv-dev  build-essential checkinstall cmake pkg-config yasm libtiff4-dev libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libeigen3-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libpng12-0 libpng12-dev libpng++-dev libpng3 libpnglite-dev zlib1g-dbg zlib1g zlib1g-dev libjasper-dev libjasper-runtime libjasper1 pngtools libtiff4-dev  libtiff-tools libjpeg8 libjpeg8-dev libjpeg8-dbg  libavcodec-dev libavformat-dev libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libxine1-ffmpeg libxine-dev libxine1-bin libunicap2 libunicap2-dev libdc1394-22-dev libdc1394-22 libdc1394-utils swig libv4l-0 libv4l-dev libeigen2-dev libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev


(Even after here also you can use openCV however to ensure that the library is properly configured please proceed ahead)

Installation from the tar file

Download the source code from openCV homepage.Next go to the directory where OpenCV is downloaded via the terminal only and then un zip the package:

Note:- It is recommended that you move the downloaded OpenCV package to the home/<user>/ 

unzip OpenCV-2.x.x.zip
cd OpenCV-2.x.x/
Now make a new directory (folder) called "build" for building the software. Use the following commands.

mkdir build
cd build
Later run Cmake with the following commands
cmake -D WITH_TBB=ON -D WITH_QT=ON -D WITH_XINE=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_OPENGL=ON -D BUILD_EXAMPLES=ON ..
Now make the files
make

Now we make it permanent
 
sudo make install

Configuring OpenCV:

The installation is nearly complete so now we have to configure with the OS to use gcc or any ide(e.g. eclipse) to compile and run the programs.

sudo gedit /etc/ld.so.conf.d/opencv.conf

Add the following line at the end of the file (it may be an empty file, that is ok) and then save it:
/usr/local/lib

Close the file and run the following command to configure the library:

sudo ldconfig

OR we can alternatively run the command


  export LD_LIBRARY_PATH=/usr/local/lib

Open your .bashrc file and add the following:

sudo gedit /etc/bash.bashrc

append the following at the end of the file -

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

Save and close the file and reboot the system
Installation is now complete.

openCV intro

Generally when we think of image processing we think of a famous software "Matlab". Matlab has made coding easy for novice beginners even outside the world of image processing but many have a notion that Matlab is the only tool to be used.Matlab is a high level language for researchers and students to develop things with ease.Traditionally if a task had to be done (say simply reading an image) the level of C/C++ programming required would have to be huge thus limiting the field to those who could write efficient program. This is where Matlab was useful as it removed the base level programming(creating pointers, allocate memory reading the data) required and focused on the abstract layer programming(Theories to be developed). Matlab has its perks if you can optimize your code in matlab to execute it in shorter run time.Also if you have the finance to purchase the product. But I want inform that there are other tools which can be used instead of Matlab such as Octave, openCV, etc..
OpenCV is a very powerful open source library for image and video processing applications and can be used in any platform such as Windows, Linux, Android, iOS,Raspberry pi, etc...You can check out their website opencv. I will be sharing my experiences and tricks with openCV. Lets start with installation of openCV in both Windows and Linux.I will be following the Mat structure instead of IplImage structure as it is a bit easier to program.

openMP

It is a pain that each and every library has to downloaded and installed and configured but it is a necessary evil in most cases. If we had each and every tool in our computer then we would have no space and our systems would be slow as there are other tools which we don't know about. For those who are using:

  • Windows 
If an Intel compiler is already present in Windows, simply launch the software development environment (Intel parallel studio XE) and you will get a command prompt. Next  type icl /QopenMP c_code.cpp.
The standard compiler for Windows comes from Microsoft Visual C/C++ compiler from Visual Studio. Unfortunately its OpenMP support is a bit outdated. To use it simply Start a project in Visual studio.
  1. Start a new Project
  2. Select a Win 32 console project
  3.  Set name and path
  4. Select an empty project in the next panel
  5. Drag and drop source file into solution explorer
Next to run openMP
  1. Goto Project properties -->configuration properties/C.C++/language
  2. Activate the openMP tab
Check out the link
  • Linux 
To install and try out openMP (if you have the gcc compiler already) you have to do ....nothing
If you are using gcc as the compiler then you have done it already. All there is to do is create a c/c++ code and while compiling the program simply use the following statement
   gcc    -fopenmp   c_code.cpp   -o  c_obj

where c_code.cpp is the source code and c_obj is the object /exe file to run

Parallel Programming (OpenMP, CUDA, OpenCL)

Parallel Programming (OpenMP, CUDA, OpenCL)

One of the various useful tools which I feel will be required if we need to do some simulations, applications, etc.. to run efficiently. But  the latest computer processors from intel (corei3, corei5, corei7) have multiple cores so isn't it implied that we are getting better performance ?

The short answer is NO
They simply have the functionality however if we are writing a code which performs sequential actions then we are not utilizing the resources  efficiently.
We can see that if some computations are independent then they can be performed in parallel using threads and this reduces the computation time of the overall program drastically.
To learn openMP a YouTube_series is provided by intel and instructor is Tim Mattson. The Basics of openMP and a few parallel algorithms are taught in C/C++ and fortran.
A series called Heterogeneuous Parallel Programming is also offered in Coursera which teaches basics of CUDA and openCL .

Raspberry Pi

The Raspberry Pi could be called a "Mini Computer" as it is very cheap and useful. On purchase of a Raspberry Pi you would have to purchase/get a mouse+keyboard, any adapter to connect you to the internet, a HDMI cable+ Display with HDMI connection. It works well with the Linux OS Raspberian (Raspberry Pi + Debian) but other distros can be used such as fedorapi.

Tips to efficiently do computations

Hint #1

You can configure eclipse in Linux to use as a debugger.
To configure with  eclipse for c/c++ :

  •  Download the HEVC reference software version using subversion (First check if files such as .cproject, .project, etc exist) and later zip the file
  •  Open Eclipse and select file and select import. Select the zipped file and give a name to your Project.
  •  The Zip file will be unzipped at the workspace location.Goto the build linux location i.e. ‘Project Space’/build/linux/ and enter the terminal command “make”. This will create the binaries and object files.
  •  After that go to the project properties,select c/c++ build,select builder settings ensure that the “Use default build command”is unchecked and type “<Project Space>/build/linux/makefile”. Ensure the Build Location is also in the same directory
  •  Since there are many project you have to first select the project of interest e.g. TAppEncoderStatic Check the projects name as well
  • In the Arguements section type the necessary arguments e.g. configuration files -c [config file] (Note ensure that they are in the bin directory along with the YUV file of choice ). Also ensure the workspace is also the same directory

Hint #2

Depending on various factors such as number of frames and resolution of the input video the processing time may vary (usually an hour). To effectively utilize the system and time, simply open multiple command prompts(on windows)/terminals (on linux).  This is called High Throughput Computing (HTC) where the same program is executed but with different parameters.
Bash programming can also be used to automate processes. Literally making a bash script is  easy by adding the bang line #!/bin/bash
Python is also an alternative to bash scripts as it can have problems while defining arrays. Utilize HTC wherever possible but do not push it as PCs have certain capacities and capabilities.
JM and JSVM software are the reference softwares used to understand and emulate H.264 and its scalable version while HEVC and SHM software are the reference softwares used to understand and emulate H.265 and its scalable version. These reference softwares( JM, JSVM, HEVC, SHM ) are managed using a version control software such as subversion (SVN) and Concurrent Version Systems (CVS). These applications help in controlling and distributions of the reference softwares.The HEVC and its scalable version reference software can be downloaded
from

https://hevc.hhi.fraunhofer.de/

  • Windows
In windows one can use a simple software such as tortoiseSVN or tortoiseCVS and simply get the corresponding tools. Also some standard YUV files will be required to test the code such as foreman.yuv,basketballdrill.yuv etc.. To read and play the yuv files in windows ,YUV player or YUV toolkit (preffered) will be useful. HEVC uses SVN so for windows(after installing tortoise SVN) go to the folder where the project will be saved.Simply right click and select the option “SVN checkout”and add the url and click OK.
                                                                                                                https://hevc.hhi.fraunhofer.de/svn/svn_HEVCSoftware/
  • Linux
In Linux,the packages “subversion”and “cvs ”have to be installed via command line or any other package manager(e.g. synaptic package manager). After installation ,in the terminal , simply type the command in the terminal window:
 
svn checkout https://hevc.hhi.fraunhofer.de/svn/svn_HEVCSoftware/

Unfortunately YUVplayer/YUV toolkit is not developed for linux however we can use the VLC player to read these YUV files. To read and play the yuv files in linux using vlc player use the command.
 
 
vlc --demux rawvideo --rawvid-fps FrameRate --rawvid-width FrameWidth --rawvid-height FrameHeight --rawvid-chroma I420 YUV_File


After the download is complete in either platform, a set of directories/folders will appear in your workspace such as:

  • build (which has the project files )
  • cfg (configuration files)
  • compact
  • doc (documentation)
  • HM.xcodeproj
  • lib (libraries)
  • source (source files)
The“build”contains the projects files like .sln for visual studio projects (in Windows)and Makefiles (in Linux).  The“source” folder contains all the C/C++ source files,headers and libraries required the execute the code. The“cfg”folder contains the configurations files which are generally used to avoid inputing large command line arguments at the time of execution. Once
the files have been compiled another folder “bin”will appear which will contain the binaries i.e. the executable files. Depending on the system configurations (i.e processor, RAM ,HDD size etc..) the time required to complete the execution may vary. It is recommended to use a system with good configurations.
  • Windows
In windows,the visual studio express(preferred 64 bit)software is used for compilation of the project.The Project files are present in the build folder with a .sln extension. While opening the visual studio project, a set of projects will be displayed on the solution explorer.First the solution of these projects must be built.
To build the solution of these projects simply click F7 or right click and select build solution and the executional files will be created. Now to select a particular project e.g. the encoder project “TAppEncoderStatic” first right click on the project and select ‘Set as Startup Project’. Next right click on the project and select properties go to configuration properties and select the
debugging tab.The Command arguments are already added however if not simply check the software manual in section 3.
Using the encoder it will show that has to be written. Command Prompt can also be used by going to the directory and using the command

 TAppEncoder.exe [-c config file] [--parameter value] 

E.g.         TAppEncoder.exe -c BasketBallDrill.cfg -c encoder_lowdelay_main.cfg

Using this command the following outputs should appear if not then an error has occurred.


  • Linux
In Linux, open the terminal and go to the linux directory and type the command ‘make’. It will compile the code and generate executable files.These executable files can be used in the terminal by using the following command 

 ./TAppEncoder [-c config file] [--parameter value] 
  
E.g.           ./TAppEncoder -c BasketBallDrill.cfg -c encoder_lowdelay_main.cfg

Scalable Video Coding

High Efficiency Video Coding (HEVC) is relatively new video coding standard (H.265) which has been released in January 2013. This standard augments the already existing standard (H.264) to provide enhanced quality such as high definition (HD) and ultra high definition (UHD) services with a reduced bit rate. This increases the amount of processing required to encode/decode the bit stream. For implementation, understanding of the codec in the industries, academic domain a reference software has been released to understand the functioning and experimentation.

Android Setup

Its very easy to start with android programing as the programming language is a combination of Java (with some additional libraries for back end processing) and XML (for the front end Graphical User Interface GUI). All that is required is that java is installed on the operating system used(Windows, Mac, Linux, etc...).  After Java has been successfully installed and configured(setting the path variable on the OS) the next step is to simply download either of the following:
  • Android Development Tools (ADT) bundle (the complete package ,highly recommended as everything is already set however no longer supported)
  • Eclipse IDE for java developers(after helio version )+android Software Development Kit (SDK)+android adt plugin (all downloaded separately and have to be configured which is a time consuming process)
  • Android Studio which is an IDE provided by google based on IntelleJ (a complete package)
After acquiring the software, the next task is to download the tools required (such as the image file ) for the android version (Lollipop ,KitKat, Jellybean etc..) from the android sdk manager.

Android Programming + openCV Libraries

As the name suggests,we can combine openCV code written in C/C++ and Android code which is written in Java.You may ask yourself how is it possible as Java and C++ use different compilers for compilation and how can they be called by each other.
The simple answer which explains it is the android Native Development Toolkit (NDK).
There are new java libraries so it isnt necessary to embed C++ as well but it may be useful at time for code reuse-ability.
Sources:

Android Development

Android Developement has been the latest buzz ever since the sdk was first released for developing android apps for free and understanding the fact that we can develop any app we require and correspondingly upload it into the Android Market (Google Play).
I will be sharing my experience of android developement and revealing my sources.
Major thanks to #mybringback and #thenewboston by travis and bucky as they guided me step by step to develop simple apps and test them easily.
Sources: