PDF Books

In need of any book(.pdf) relating to any subject/field or topic?
Go to your browser and type:
http://www.pdfdrive.net
You will get access to millions of  books you need, for free.
Unlimited downloads.

You may browse by title or author, etc.
Currently 274376478 books are available for free and every minute, around 50 new books are added to the database.
All downloads are free.

SOME USEFUL  WEBSITES  ONLINE EDUCATIONAL SUPPORT

http://www.khanacademy.org
http://www.academicearths.org
http://www.coursera.com
http://www.edx.org
http://www.open2study.com
http://www.academicjournals.org
codeacademy.org
youtube.com/education

BOOK SITES
http://www.bookboon.com
http://ebookee.org
http://sharebookfree.com
http://m.freebooks.com
http://www.obooko.com
http://www.manybooks.net
http://www.epubbud.com
http://www.bookyards.com
http://www.getfreeebooks.com
http://freecomputerbooks.com
http://www.essays.se
http://www.sparknotes.com
http://www.pink.monkey.com

ONLINE EDUCATIONAL SUPPORT
http://www.ocwconsortium.org/
http://www.ocwconsortium.org/en/courses/ocwsites
http://ocw.tufts.edu -Tuft University
http://ocw.upm.es -Univesidad Politechnica, Madrid
http://www.open.edu/openlearn/
http://ocw.usu.edu/ -Utah State University
http://open.umich.edu/ -University of Michigan
http://ocw.nd.edu/ -Nore Dame University

ANSWERS TO QUESTIONS
http://www.ehow.com
http://www.whatis.com
http://www.howstuffwork.com
http://www.webopedia.com
http://www.plagtracker.com
http://www.answers.com

SEARCH SITES
■ About.com (www.about.com)
■ AllTheWeb (www.alltheweb.com)
■ AltaVista (www.altavista.com)
■ Ask Jeeves! (www.askjeeves.com)
■ Excite (www.excite.com)
■ HotBot (www.hotbot.com)
■ LookSmart (www.looksmart.com)
■ Lycos (www.lycos.com)
■ Open Directory (www.dmoz.org)
■ Google (www.google.com)
■ Mamma (www.mamma.com)
■ Webcrawler (www.webcrawler.com)
■ Aol (www.aol.com)
■ Dogpile (www.dogpile.com)
■ 10pht (www.10pht.com)

SEARCHING FOR PEOPLE
■ AnyWho (www.anywho.com)
■ InfoSpace (www.infospace.com)
■ Switchboard (www.switchboard.com)
■ WhitePages.com (www.whitepages.com)
■ WhoWhere (www.whowhere.lycos.com)

SEARCHING FOR THE LATEST NEWS
■ ABC News (www.abcnews.com)
■ CBS News (www.cbsnews.com)
■ CNN (www.cnn.com)
■ Fox News (www.foxnews.com)
■ MSNBC (www.msnbc.com)
■ New York Times (www.nytimes.com)
■ USA Today (www.usatoday.com)

SEARCHING FOR SPORTS HEADLINES AND SCORES
■ CBS SportsLine (www.sportsline.com)
■ CNN/Sports Illustrated (sportsillustrated.cnn.com)
■ ESPN.com (espn.go.com)
■ FOXSports (foxsports.lycos.com)
■ NBC Sports (www.nbcsports.com)
■ The Sporting News (www.sportingnews.com)

SEARCHING FOR MEDICAL INFORMATION
■ healthAtoZ.com (www.healthatoz.com)
■ kidsDoctor (www.kidsdoctor.com)
■ MedExplorer (www.medexplorer.com)
■ MedicineNet (www.medicinenet.com)
■ National Library of Medicine
(www.nlm.nih.gov)
■ Planet Wellness (www.planetwellness.com)
■ WebMD Health (my.webmd.com)

JOURNALS
http://www.indexcopernicus.com Multidisciplinary
http://www.ajol.info/ – African Journal Online
http://www.africanjournalseries.com
http://www.devconsortservices.com.ng
http://www.doaj.org – directory of open access journal
http://www.sabinet.co.za – South African Journals.
http://www.oajse.com – Open Access Journal Search Engine
http://www.lub.lu.se/en.html – Lund University
http://www.dovepress.com/ – Free Scientific & Medical Materials
http://www.copernicus.org/ – Access & Publication

ACADEMIC SEARCH/WEB RESEARCH TOOLS/REFERENCE MANAGERS
http://academic.research.microsoft.com – Multidisciplinary
http://www.scirus.com
http://www.scholar.google.com
http://dbis.uni-trier.de/DBL-Browser/ – Digital Bibliography Library Browser
http://academic.live.com – Live Search Academic
http://www.science.gov/ – USA government for Science
http://citeseerx.ist.psu.edu/index – Computing & Information Sciences
http://www.mendeley.com/ – academic social network/collaboration
http://www.worldcat.org/ – Multidisciplinary
http://libserver.cedefop.europa.eu – Voc & Tech Education
http://inspirehep.net/ – Stanford physics information retrieval system
hsystemv  http://www.ssrn.com/ – Social Science Research Network.

Advertisements

The 10th apple effect

A hunter once lost his way deep inside the jungle while chasing a deer.
He used all his navigation skills but neither did he find any way out of the jungle, nor could he find any food to eat for 8 days at a stretch.
He started feeling so damn hungry that he could eat an entire elephant at one go.
Disappointed, he lost all hope. And that is exactly when an apple tree caught his sight.
He collected a dozen apples to feed him for the rest of his search.

As he ate the 1st apple, his joy knew no bounds and he just couldn’t stop feeling grateful and blessed.
He thanked life.
He thanked God.
He could not believe his luck when he ate the 1st apple, but he was less grateful while having the 2nd apple and even lesser grateful when he had the 5th apple.

Somehow, with each passing apple, the hunger still kept on increasing and the joy kept on reducing drastically.
He just could not enjoy the 10th apple.

Why?
He had already taken for granted the gift of having found an apple tree in the middle of a forest after 8 long days of wandering with hunger !!
When he took the 10th apple in his hand, he was still very hungry but he just did not feel like having it any more.
Economics calls this diminishing marginal utility…I would like to call it diminishing gratitude…
in simple words, taking things for granted !!
Or let’s just call it the 10th apple effect.

The 10th apple did not lack taste, it did not lack the potential to satisfy his hunger but the only thing lacking was his gratitude for finding food in the middle of the jungle.

The hunter represents us.
And the apple represents the gifts that life gives us.
The 10th apple represents our lack of gratitude for these gifts of life and our ‘take everything for granted’ attitude.

As we continue receiving the gifts of life, our hunger, our greed keeps on increasing and the joy we get from these gifts diminishes.

The 10th apple is as sweet as the first apple.
If the 10th apple fails to give you as much pleasure as the first one, nothing is wrong with the apple, everything is wrong with you !!
If you get bored on a dull day, it is not because the day is dull and boring. It is because your gratitude has become dull and boring.

The gift of life for another day cannot be taken for granted.

The Nth year of life, should seem as exciting as, the 16th year, as the 25th year, as the 50th year….

Never let the ‘10th apple effect’ make you take these gifts of life for granted.
Never let your gratitude for life fade away.

Setting up Machine Learning workstation

NVidia 1060
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
sudo apt-get install nvidia-384
sudo apt-get install nvidia-367
sudo apt-get install nvidia-smi

dcml@sun:~$ lsmod | grep -i nvidia
nvidia_uvm            671744  0
nvidia_drm             45056  1
nvidia_modeset        843776  5 nvidia_drm
nvidia              13119488  268 nvidia_modeset,nvidia_uvm
drm_kms_helper        151552  2 i915,nvidia_drm
drm                   352256  5 i915,nvidia_drm,drm_kms_helper

dcml@sun:~$ nvidia-smi
Sat Dec  9 12:49:29 2017
+—————————————————————————–+
| NVIDIA-SMI 384.98                 Driver Version: 384.98                    |
|——————————-+———————-+———————-+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 106…  Off  | 00000000:01:00.0  On |                  N/A |
| 35%   30C    P8     6W / 120W |    206MiB /  6069MiB |      2%      Default |
+——————————-+———————-+———————-+

+—————————————————————————–+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1085      G   /usr/lib/xorg/Xorg                           132MiB |
+—————————————————————————–+

apt-get Update – Hash-Mismatch
sudo apt-get clean
sudo apt-get update
sudo sed -i -re ‘s/\w+\.archive\.ubuntu\.com/archive.ubuntu.com/g’ /etc/apt/sources.list

Open SSH
apt-get install openssh-server

Annaconda
https://repo.continuum.io/archive/Anaconda2-5.0.1-Linux-x86_64.sh

Install path – /opt/anaconda2

Anaconda Clean Remove
conda install anaconda-clean
anaconda-clean –yes
rm -rf ~/anaconda2
rm -rf ~/.anaconda_backup

Open CV with CUDA
apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
apt-get install libgtk2.0-dev
apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
apt-get install libatlas-base-dev gfortran
apt-get install libhdf5-serial-dev
apt-get install python2.7-dev
apt-get install yad

apt-get install build-essential cmake git unzip pkg-config
apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
apt-get install libxvidcore-dev libx264-dev
apt-get install libgtk-3-dev
apt-get install libhdf5-serial-dev graphviz
apt-get install libopenblas-dev libatlas-base-dev gfortran
apt-get install python-tk python3-tk python-imaging-tk

apt-get install python2.7-dev python3-dev
apt-get install linux-image-generic linux-image-extra-virtual
apt-get install linux-source linux-headers-generic

apt-get update
apt-get upgrade

Numpy
apt-get install python-pip
pip install –upgrade pip

pip install numpy scipy
apt-get install python-numpy python-scipy

Opencv
wget -O opencv_3.3.1.zip https://github.com/opencv/opencv/archive/3.3.1.zip
wget -O opencv_contrib_3.3.1.zip https://github.com/Itseez/opencv_contrib/archive/3.1.1.zip

ffmpeg
add-apt-repository ppa:jonathonf/ffmpeg-3
apt-get install ffmpeg
  update && apt upgrade

Atom
wget https://github.com/atom/atom/releases/download/v1.22.1/atom-amd64.deb
dpkg -i atom-amd64.deb

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=/home/dcml/opencv_build/opencv_cuda/opencv_contrib-3.1.0/modules \
-D BUILD_EXAMPLES=ON \
-D WITH_TBB=ON \
-D WITH_CUDA=ON \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
..

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=/home/dcml/opencv_build/opencv_cuda/opencv_contrib-3.1.0/modules \
-D BUILD_EXAMPLES=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
..

make -j 2
sudo make install

PyQT
apt-get install python-qt4 pyqt4-dev-tools qt4-designer
apt-get install qtcreator
apt-get install qt4-designer
apt-get install python-pyqt5
apt-get install python-qt4 qt4-designer

Run – designer-qt4

CUDA
wget http://192.168.1.27:8000/cuda_8.0.61_375.26_linux-run
dcml@sun:~/Downloads$ sudo bash cuda_8.0.61_375.26_linux-run
Logging to /tmp/cuda_install_9246.log
Using more to view the EULA.
End User License Agreement
————————–

Preface
——-

The following contains specific license terms and conditions
for four separate NVIDIA products. By accepting this
agreement, you agree to comply with all the terms and
conditions applicable to the specific product(s) included
herein.

NVIDIA CUDA Toolkit

Description

The NVIDIA CUDA Toolkit provides command-line and graphical
tools for building, debugging and optimizing the performance
of applications accelerated by NVIDIA GPUs, runtime and math
libraries, and documentation including programming guides,
user manuals, and API references. The NVIDIA CUDA Toolkit
License Agreement is available in Chapter 1.

Default Install Location of CUDA Toolkit

Windows platform:

%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v#.#
Do you accept the previously read EULA?
accept/decline/quit: accept

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26?
(y)es/(n)o/(q)uit: n

Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: y

Enter Toolkit Location
  [ default is /usr/local/cuda-8.0 ]:

Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y

Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: y

Enter CUDA Samples Location
  [ default is /home/dcml ]:

Installing the CUDA Toolkit in /usr/local/cuda-8.0 …
Missing recommended library: libXmu.so

Installing the CUDA Samples in /home/dcml …
Copying samples to /home/dcml/NVIDIA_CUDA-8.0_Samples now…
Finished copying samples.

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-8.0
Samples:  Installed in /home/dcml, but missing recommended libraries

Please make sure that
  –   PATH includes /usr/local/cuda-8.0/bin
  –   LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or, add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/doc/pdf for detailed information on setting up CUDA.

***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 361.00 is required for CUDA 8.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
     sudo <CudaInstaller>.run -silent -driver

Logfile is /tmp/cuda_install_9246.log

apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev
apt-get install libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libglfw3-dev libgles2-mesa-dev

Cleanup
apt autoremove

root@sun:~# cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery
root@sun:/usr/local/cuda-8.0/samples/1_Utilities/deviceQuery# make
“/usr/local/cuda-8.0″/bin/nvcc -ccbin g++ -I../../common/inc  -m64    -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o deviceQuery.o -c deviceQuery.cpp
nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
“/usr/local/cuda-8.0″/bin/nvcc -ccbin g++   -m64      -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o deviceQuery deviceQuery.o
nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
mkdir -p ../../bin/x86_64/linux/release
cp deviceQuery ../../bin/x86_64/linux/release
root@sun:/usr/local/cuda-8.0/samples/1_Utilities/deviceQuery# ./deviceQuery
./deviceQuery Starting…

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: “Ge GTX 1060 6GB”
   CUDA Driver Version / Runtime Version          9.0 / 8.0
   CUDA Capability Major/Minor version number:    6.1
   Total amount of global memory:                 6070 MBytes (6364463104 bytes)
   (10) Multiprocessors, (128) CUDA Cores/MP:     1280 CUDA Cores
   GPU Max Clock rate:                            1759 MHz (1.76 GHz)
   Memory Clock rate:                             4004 Mhz
   Memory Bus Width:                              192-bit
   L2 Cache Size:                                 1572864 bytes
   Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
   Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers
   Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 2048 layers
   Total amount of constant memory:               65536 bytes
   Total amount of shared memory per block:       49152 bytes
   Total number of registers available per block: 65536
   Warp size:                                     32
   Maximum number of threads per multiprocessor:  2048
   Maximum number of threads per block:           1024
   Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
   Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
   Maximum memory pitch:                          2147483647 bytes
   Texture alignment:                             512 bytes
   Concurrent copy and kernel execution:          Yes with 2 copy engine(s)
   Run time limit on kernels:                     Yes
   Integrated GPU sharing Host Memory:            No
   Support host page-locked memory mapping:       Yes
   Alignment requirement for Surfaces:            Yes
   Device has ECC support:                        Disabled
   Device supports Unified Addressing (UVA):      Yes
   Device PCI Domain ID / Bus ID / location ID:   0 / 1 / 0
   Compute Mode:
      < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce GTX 1060 6GB
Result = PASS

export CMAKE_CXX_FLAGS=-std=c++11

apt-get install liblapacke-dev checkinstall
apt-get install libavresample-dev
apt-get install libgphoto2
apt-get install libgphoto2-dev
apt-get install libdc1394-22
apt-get install libdc1394-22-dev
apt-get install liblapacke-dev checkinstall
apt-get install libxine2-dev

cmake -D CMAKE_BUILD_TYPE=RELEASE \
     -D CMAKE_INSTALL_PREFIX=/usr/local \
     -D INSTALL_C_EXAMPLES=ON \
     -D INSTALL_PYTHON_EXAMPLES=ON \
     -D OPENCV_EXTRA_MODULES_PATH=/home/dcml/opencv_build/opencv_contrib-3.3.1/modules \
     -D BUILD_EXAMPLES=ON \
     -D WITH_TBB=ON \
     -D WITH_CUDA=ON \
     -D ENABLE_FAST_MATH=1 \
     -D CUDA_FAST_MATH=1 \
     -D WITH_CUBLAS=1 \
     -D BUILD_NEW_PYTHON_SUPPORT=ON \
     ..

Building and running Python demo of
Simple Vehicle Counting
Vehicle Detection, Tracking and Counting

https://github.com/andrewssobral/simple_vehicle_counting

1. Install Boost library for Python
sudo apt-get install libboost-python-dev

2. Clone the repo
mkdir work
cd work
git clone –recursive https://github.com/andrewssobral/simple_vehicle_counting.git

3. Apply Patch
cd simple_vehicle_counting
patch -p1 <fix.diff
git diff

4. Build
cd build
mkdir python
cp -r ../python/* python
cmake -D BUILD_PYTHON_SUPPORT=ON ..
make

5. Run demo
../run_python_demo.sh

fix.diff
diff –git a/CMakeLists.txt b/CMakeLists.txt
index c205e27..5a5fd9b 100644
— a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,7 +41,7 @@ endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)

IF (UNIX)
      # add some standard warnings
–    ADD_DEFINITIONS(-Wno-variadic-macros -Wno-long-long -Wall -Wextra -Winit-self -Woverloaded-virtual -Wsign-promo -Wno-unused-parameter -pedantic -Woverloaded-virtual -Wno-unknown-pragmas)
+    ADD_DEFINITIONS(-Wno-variadic-macros -Wno-long-long -Wall -Wextra -Winit-self -Woverloaded-virtual -Wsign-promo -Wno-unused-parameter -pedantic -Woverloaded-virtual -Wno-unknown-pragmas -fPIC)

     # -ansi does not compile with sjn module
      #ADD_DEFINITIONS(-ansi)

Install OpenCV-Python with FFMPEG to Anaconda

I have summarized my now fully working solution OpenCV-Python – How to install OpenCV-Python package to Anaconda (Windows). Nevertheless I’ve

To use OpenCV fully with Anaconda (and Spyder IDE), we need to:

  1. Download the OpenCV package from the official OpenCV site
  2. Copy and paste the cv2.pyd to the Anaconda site-packages directory.
  3. Set user environmental variables so that Anaconda knows where to find the FFMPEG utility.
  4. Do some testing to confirm OpenCV and FFMPEG are now working.

Prerequisite

Install Anaconda

Anaconda is essentially a nicely packaged Python IDE that is shipped with tons of useful packages, such as NumPy, Pandas, IPython Notebook, etc. It seems to be recommended everywhere in the scientific community. Check out Anaconda to get it installed.

Install OpenCV-Python to Anaconda

Cautious Note: I originally tried out installing the binstar.org opencv package, as suggested. That method however does not include the FFMPEG codec – i.e. you may be able to use OpenCV but you won’t be able to process videos.

The following instruction works for me is inspired by this OpenCV YouTube video. So far I have got it working on both my Desktop and Laptop. Both 64-bit machines and Windows 8.1.

Download OpenCV Package

Firstly, go to the official OpenCV site to download the complete OpenCV package. Pick a version you like (2.x or 3.x). I am on Python 2.x and OpenCV 3.x – mainly because this is how the OpenCV-Python Tutorials are setup/based on.

In my case, I’ve extracted the package (essentially a folder) straight to my C drive. (C:\opencv).

Copy and Paste the cv2.pyd file

The Anaconda Site-packages directory (e.g. C:\Users\Johnny\Anaconda\Lib\site-packages in my case) contains the Python packages that you may import. Our goal is to copy and paste the cv2.pyd file to this directory (so that we can use the import cv2 in our Python codes.).

To do this, copy the cv2.pyd file…

From this OpenCV directory (the beginning part might be slightly different on your machine):

# Python 2.7 and 32-bit machine: 
C:\opencv\build\python\2.7\x84

# Python 2.7 and 64-bit machine: 
C:\opencv\build\python\2.7\x64

To this Anaconda directory (the beginning part might be slightly different on your machine):

C:\Users\Johnny\Anaconda\Lib\site-packages

After performing this step we shall now be able to use import cv2 in Python code. BUT, we still need to do a little bit more work to get FFMPEG (video codec) to work (to enable us to do things like processing videos.)

Set Enviromental Variables

Right-click on “My Computer” (or “This PC” on Windows 8.1) -> left-click Properties -> left-click “Advanced” tab -> left-click “Environment Variables…” button.

Add a new User Variable to point to the OpenCV (either x86 for 32-bit system or x64 for 64-bit system.) I am currently on a 64-bit machine.

| 32-bit or 64 bit machine? | Variable     | Value                                |
|---------------------------|--------------|--------------------------------------|
| 32-bit                    | `OPENCV_DIR` | `C:\opencv\build\x86\vc12`           |
| 64-bit                    | `OPENCV_DIR` | `C:\opencv\build\x64\vc12`           |

Append %OPENCV_DIR%\bin to the User Variable PATH.

For example, my PATH user variable looks like this…

Before:

C:\Users\Johnny\Anaconda;C:\Users\Johnny\Anaconda\Scripts

After:

C:\Users\Johnny\Anaconda;C:\Users\Johnny\Anaconda\Scripts;%OPENCV_DIR%\bin

This is it we are done! FFMPEG is ready to be used!

Test to confirm

We need to test whether we can now do these in Anaconda (via Spyder IDE):

  • Import OpenCV package
  • Use the FFMPEG utility (to read/write/process videos)
Test 1: Can we import OpenCV?

To confrim that Anaconda is now able to import the OpenCV-Python package (namely, cv2), issue these in the IPython Console:

import cv2
print cv2.__version__

If the package cv2 is imported ok with no errors, and the cv2 version is printed out, then we are all good! Here is a snapshot:

import-cv2-ok-in-anaconda-python-2.png http://mathalope.co.uk/wp-content/uploads/2015/07/import-cv2-ok-in-anaconda-python-2.png

Test 2: Can we Use the FFMPEG codec?

Place a sample input_video.mp4 video file in a directory. We want to test whether we can:

  • read this .mp4 video file, and
  • write out a new video file (can be .avi or .mp4 etc.)

To do this we need to have a test python code, call it test.py. Place it in the same directory as the sample input_video.mp4 file.

This is what test.py may look like (I’ve listed out both newer and older version codes here – do let us know which one works / not work for you!):

(Newer verison…)

import cv2
cap = cv2.VideoCapture("input_video.mp4")
print cap.isOpened()   # True = read video successfully. False - fail to read video.

fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter("output_video.avi", fourcc, 20.0, (640, 360))
print out.isOpened()  # True = write out video successfully. False - fail to write out video.

cap.release()
out.release()

(or the older version…)

import cv2
cv2.VideoCapture("input_video.mp4")
print cv2.isOpened()   # True = read video successfully. False - fail to read video.

fourcc = cv2.cv.CV_FOURCC(*'XVID')
out = cv2.VideoWriter("output_video.avi",fourcc, 20.0, (640,360))
print out.isOpened()  # True = write out video successfully. False - fail to write out video.

cap.release()
out.release()

This test is VERY IMPORTANT. If you’d like to process video files, you’d need to ensure that Anaconda / Spyder IDE can use the FFMPEG (video codec). It took me days to have got it working. But I hope it would take you much less time! 🙂

Note: one more very important tip when using the Anaconda Spyder IDE. Make sure you check the Current Working Directory (CWD)!!!

Conclusion

To use OpenCV fully with Anaconda (and Spyder IDE), we need to:

  1. Download the OpenCV package from the official OpenCV site
  2. Copy and paste the cv2.pyd to the Anaconda site-packages directory.
  3. Set user environmental variables so that Anaconda knows where to find the FFMPEG utility.
  4. Do some testing to confirm OpenCV and FFMPEG are now working.

Good luck!

What’s the value of life?

A little boy went to his old grandpa and asked, “What’s the value of life?”

The grandpa gave him one stone and said, “Find out the value of this stone, but don’t sell it.”

The boy took the stone to an Orange Seller and asked him what its cost would be.

The Orange Seller saw the shiny stone and said, “You can take 12 oranges and give me the stone.”

The boy apologized and said that the grandpa has asked him not to sell it.

He went ahead and found a vegetable seller.

“What could be the value of this stone?” he asked the vegetable seller.

The seller saw the shiny stone and said, “Take one sack of potatoes and give me the stone.”

The boy again apologized and said he can’t sell it.

Further ahead, he went into a jewellery shop and asked the value of the stone.

The jeweler saw the stone under a lens and said, “I’ll give you 1 million for this stone.”

When the boy shook his head, the jeweler said, “Alright, alright, take 2 24karat gold necklaces, but give me the stone.”

The boy explained that he can’t sell the stone.

Further ahead, the boy saw a precious stone’s shop and asked the seller the value of this stone.

When the precious stone’s seller saw the big ruby, he lay down a red cloth and put the ruby on it.

Then he walked in circles around the ruby and bent down and touched his head in front of the ruby. “From where did you bring this priceless ruby from?” he asked.

“Even if I sell the whole world, and my life, I won’t
be able to purchase this priceless stone.”

Stunned and confused, the boy returned to the grandpa and told him what had happened.

“Now tell me what is the value of life, grandpa?”

Grandpa said,

“The answers you got from the Orange Seller, the Vegetable Seller, the Jeweler & the Precious Stone’s Seller explain the value of our life…

You may be a precious stone, even priceless, but, people will value you based on their intellectual status, their level of information, their belief in you, their motive behind entertaining you, their ambition, their risk taking ability & ultimately their calibre.

So don’t fear, you will surely find someone who will discern your true value.”

Respect yourself.

Don’t sell yourself cheap.

You are rare, Unique, Original and the only one of ur kind.

Your are a masterpiece because u r  the MASTER’S PIECE.

No one can Replace you.

Have a Great Life

Life to live

Once upon a time there was a person who had a deep desire to succeed more, and wanted to do so many things after making more money and acquiring few more assets.

Months passed, years passed, that person raised the bar of success and got busier and busier in work and asset creation, and forgot to enjoy life and speaking with friends, taking a holiday, a nap in the afternoon, walk in the garden.

Many years later the person reflected the way the life had panned out, only to notice that nothing fun was being done and all the time was spent in running behind success which was meaningless at the end when the person was in a hospital getting a dialysis done to stay alive and live for some more time.

 

Suddenly the person woke up from the bed, and realized it was just a dream, and that the person has full life to live and decide what to do with life.

WHEN TO BE SILENT

1.  Be silent – in the heat of
     anger.

2.  Be silent – when you don’t
     have all the facts.

3.  Be silent – when you
     haven’t verified the story.

4.   Be silent – if your words
     will offend a weaker Person.

5.  Be silent – when it is time
     to listen.

6.  Be silent – when you are
     tempted to make light of
     holy things.

7.  Be silent – when you are
     tempted to joke about  sin.

8.  Be silent – if you would be
     ashamed of your word  later.

9.  Be silent – if your words
     would convey the wrong
     impression.

10. Be silent – if the issue is
      none of your business.

11. Be silent – when you are
      tempted to tell an  outright lie.

12. Be silent – if your words
      will damage someone  else’s reputation.

13. Be silent – if your words
      will damage a friendship.

14. Be silent – when you are
      feeling critical.

15. Be silent – if you can’t 
      say it without screaming.

16. Be silent – if your words
      will be a poor reflection
      of your friends and family.

17. Be silent – if you may  
       have to eat your words
       later.

18. Be silent – if you have
       already said it more
       than one time.

19. Be silent – when you are
      tempted to flatter a
      wicked person.

20. Be silent – when you are
      supposed to be working
      instead.

21. Be silent – when your
       words do not do any
       good to anyone
       including yourself.

“WHOEVER GUARDS HIS MOUTH AND TONGUE KEEPS HIS SOUL FROM TROUBLES”