Monday, July 31, 2017

Python and OpenCV 3.1


First you need Jupyter and AWS ubuntu 16.04
https://www.rosehosting.com/blog/how-to-install-jupyter-on-an-ubuntu-16-04-vps/

All the powerful feature descriptors are 3rd party extensions which need special build of OpenCV

Prior to installing OpenCV, resolve some dependencies like Tesseract, PyVTK etc.,
https://medium.com/@lucas63/installing-tesseract-3-04-in-ubuntu-14-04-1dae8b748a32
https://lucacerone.net/2017/install-tesseract-3-0-5-in-ubuntu-16-04/

Then proceed with OpenCV build
http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/

You will run into a snag with the OpenCV build. Here is how to resolve it:
https://github.com/opencv/opencv/issues/6016

locate the file:modules/python/common.cmake and append 2 lines of code 
find_package(HDF5)

include_directories(${HDF5_INCLUDE_DIRS})


The way to access the features has changed from OpenCV 2.4 days to OpenCV 3.1
Reference: http://www.pyimagesearch.com/2015/07/16/where-did-sift-and-surf-go-in-opencv-3/#comment-431206


Some great descriptors are DCT, GLCM, FLANN, LUCID, ORB, BRIEF, SURF and SIFT, Gabor

https://www.researchgate.net/post/I_want_to_extract_Haralick_texture_features_in_openCV2
https://stackoverflow.com/questions/19556538/how-to-find-glcm-of-an-image-in-opencv-or-numpy
http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_orb/py_orb.html
http://docs.opencv.org/3.1.0/d5/d51/group__features2d__main.html
http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.html
http://answers.opencv.org/question/63517/how-to-successfully-implement-a-gabor-filtering/
http://docs.opencv.org/3.0-beta/modules/imgproc/doc/filtering.html
https://gist.github.com/odebeir/5237529

Finding the best features which are rotation invariant, scale invariant, resolution invariant, robust against blurring etc., is a challenge.


Of course going with a deep-learning way of classification would imply that there is no need to explicitly do feature extraction

http://www.wolfib.com/Image-Recognition-Intro-Part-1/
https://research.googleblog.com/2016/03/train-your-own-image-classifier-with.html
https://github.com/rdcolema/tensorflow-image-classification/blob/master/cnn.ipynb

Finally, remember to run Jupyter from this location so that the cv2 version is set to 3.1.0

~/.virtualenvs/cv/lib/python2.7/site-packages$


Tuesday, July 25, 2017

Setting up R Server Connect

R Server Connect is a great piece of software!
It allows data scientists to publish their static or interactive dashboards which might be RMarkdown or Shiny applications

But one is bound to run into installation problems like I did.

Please ensure that the following dependencies are met.

Rstudio IDE:
install.packages('rsconnect')


install.packages("devtools", dependencies=TRUE)

Linux Shell:
sudo apt-get install r-cran-rserve
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libxml2-dev