# Installing SimpleCV with Python 2.7.5 in Virtualenv in Ubuntu 13.10

1. sudo apt-get build-dep python-opencv
2. sudo apt-get install python-opencv
3. sudo apt-get install python-setuptools python-pip gfortran g++ liblapack-dev libsdl1.2-dev libsmpeg-dev mercurial
4. Get the paths for cv2.so and cv.py by applying dpkg -L python-opencv
/usr/lib/pyshared/python2.7/cv2.so
/usr/share/pyshared/cv.py
5. virtualenv simplecv_venv
cd simplecv_venv
ln -s /usr/lib/pyshared/python2.7/cv2.so lib/python2.7/site-packages/cv2.so
ln -s /usr/share/pyshared/cv.py lib/python2.7/site-packages/cv.py
sudo ./bin/pip install https://github.com/numpy/numpy/zipball/master
sudo ./bin/pip install cython
sudo ./bin/pip install scipy
sudo ./bin/pip install PIL
sudo ./bin/pip install ipython
mkdir src
wget -O src/pygame.tar.gz https://bitbucket.org/pygame/pygame/get/6625feb3fc7f.tar.gz
cd src
tar zxvf pygame.tar.gz
cd ..
sudo ./bin/python src/pygame-pygame-6625feb3fc7f/setup.py -setuptools install
sudo ./bin/pip install https://github.com/sightmachine/SimpleCV/zipball/develop
6. Test installation with the following webcam capture code, you’ll need to install the following module:
sudo bin/pip install svgwrite
7. Activate simplecv virtual environment:
$source bin/activate 8. Open ipython and run the following code: (simplecv_venv)$ipython
In [1]: run simplecv_helloworld.py
Code:

from SimpleCV import Camera, Display, Image
# Initialize the camera
cam = Camera()
# Initialize the display
display = Display()
# Snap a picture using the camera
img = cam.getImage()
# Show the picture on the screen
img.save(display)


Exit ipython to stop the code running.

1. Show the List of Installed Packages on Ubuntu :
The command we need to use is dpkg –get-selections, which will give us a list of all the currently installed packages.

\tan^{-1}\theta+Cequation. In the next case, mathematics mode is delimited by the $$and$$ pair. This is an in-line $$\int\frac{d\theta} {1+\theta^2}= \tan^{-1} \theta+C$$ equation.  In the third case, mathematics environment is delimited by the \begin{math} and \end{math} pair. This is an in-line \begin{math}\int\frac {d\theta}{1+\theta^2} = \tan^{-1} \theta+ C\end{math} equation.  The advantage of using a dollar sign to delimit mathematics mode is that it is easy to type. On the other hand, using different opening and closing delimiters facilitates error detection and correction. 7. Scale image to page width Use \textwidth for the width of the text block, and \paperwidth if you want to fit it into the paper width. You could also use \linewidth if you want to fit the image within the line width, which may vary depending on the environment you’re in (for example, within a list like enumerate). \begin{figure}[!htbp] \label{fig:1} \centering \includegraphics[width=\textwidth]{sample-faces.png} \caption{Sample images from (a) FERET, (b) Indian and (c) in-house database} \end{figure}  8. Quotation marks use two ‘ signs instead of one ” sign, like this “quoted”. 9. Tables: How to span over variable number of cells Use multicolumn. Example – \begin{table}[!htbp] % table caption is above the table \caption{The recognition accuracy of different orientation featured Gabor phase representations for 200 subjects.} \label{tab:1} % Give a unique label % For LaTeX tables use \begin{tabular}{|>{\centering\arraybackslash}p{.25cm}|>{\centering\arraybackslash}p{8.25cm}|>{\centering\arraybackslash}p{1.5cm}|>{\centering\arraybackslash}p{.5cm}|>{\centering\arraybackslash}p{.5cm}|>{\centering\arraybackslash}p{.5cm}|} \hline No. & Description & Complexity & \multicolumn{3}{|c|}{Recognition Accuracy (\%)} \\ \hline ...  10. Squeezing space with LaTeX Make your text block as big as pos­si­ble. The sim­plest way to do that is using the geom­e­try package: \usepackage[text={16cm,24cm}]{geometry}  More on this here. Following code will set the space between floats (including caption) and the surrounding text to 0pt, which is stretchable by 2pt. \setlength{\intextsep}{0pt plus 2pt} % default value 12pt plus 2pt minus 2pt,  11. Float problem – How to use the placement options [t], [h] with figures? In short, the placement options means allowing placement at certain locations: h means here: Place the figure in the text where the figure environment is written, if there is enough room left on the page t means top: Place it at the top of a page. b means bottom: Place it at the bottom of a page. p means page: Place it on a page containing only floats, such as figures and tables. ! allows to ignore certain parameters of LaTeX for float placement, for example: \topfraction: maximal portion of a page (or column resp., here and below), which is allowed to be used by floats at its top, default 0.7 \bottomfraction: maximal portion of a page, which is allowed to be used by floats at its bottom, default value 0.3 \textfraction: minimal portion of a page, which would be used by body text, default value 0.2 \floatpagefraction: minimal portion of a float page, which has to be filled by floats, default value 0.2. This avoids too much white space on float pages. topnumber: maximal number of floats allowed at the top of a page, default 2 bottomnumber: maximal number of floats allowed at the bottom of a page, default 1 totalnumber: maximal number of floats allowed at whole page, default 3 This means, if you add !, the float will be placed if it fits onto the current page and if there aren’t further waiting float objects of the same type, ignoring predefined propotions of text and floats as above. Such floats are also called bang floats. Fractions can be changed by \renewcommand, numbers are counters which can be changed by \setcounter, further there are lenghts for spacing before, after, and between floats. This gives an impression how LaTeX automatically takes care of sensible figure placement, which you could adjust yourself – or override by ! if meaningful. These options can be combined, such as [!htbp]. Their order doesn’t matter, LaTeX itself attempts using allowed places in order h, t, b, p, even if [pbth] was used. You should even consider combining as many options as sensible. If a figure cannot be placed, it blocks subsequent figures. This can be a reason why figures end up very late, as you noticed. Specifically, ensure that the figures are not too big to fit into the margins. 12. How do I order citations by appearance using BibTeX? Use \bibliographystyle{ieeetr} 13. Multiline equations Use \usepackage{amsmath} and put aligned command around the equations \begin{aligned} H_{\mu,v,r}=(h_{\mu,v,r} (0),h_{\mu,v,r} (1),\dots,h_{\mu,v,r} (B-1) ) \\ \mbox{where, } h_{\mu,v,r}(i)=\sum_{(x,y)\in R_r}\delta(LGBP_{\mu,v}(x,y)-i),i=0,1,\dots,B-1 \end{aligned}  14. Text Embedded in Displayed Equations Text can be embedded in displayed equations (in LaTeX) by using \mbox{embedded text}. For example, \begin{aligned} H_{\mu,v,r}=(h_{\mu,v,r} (0),h_{\mu,v,r} (1),\dots,h_{\mu,v,r} (B-1) ) \\ \mbox{where, } h_{\mu,v,r}(i)=\sum_{(x,y)\in R_r}\delta(LGBP_{\mu,v}(x,y)-i),i=0,1,\dots,B-1 \end{aligned}  15. Combining multiple image files into a single figure a) approach using tabular \documentclass[a4paper,12pt]{article} \usepackage{graphicx} \usepackage{subcaption} \begin{document} \begin{figure}[htb] \centering \begin{tabular}{@{}cccc@{}} \includegraphics[width=.23\textwidth]{example-image-a} & \includegraphics[width=.23\textwidth]{example-image-b} & \includegraphics[width=.23\textwidth]{example-image-c} & \includegraphics[width=.23\textwidth]{example-image} \\ \includegraphics[width=.23\textwidth]{example-image-a} & \includegraphics[width=.23\textwidth]{example-image-b} & \includegraphics[width=.23\textwidth]{example-image-c} & \includegraphics[width=.23\textwidth]{example-image} \\ \includegraphics[width=.23\textwidth]{example-image-a} & \includegraphics[width=.23\textwidth]{example-image-b} & \includegraphics[width=.23\textwidth]{example-image-c} & \includegraphics[width=.23\textwidth]{example-image} \\ \multicolumn{4}{c}{\includegraphics[width=.23\textwidth]{example-image-a}} \end{tabular} \caption{This is some figure side by side} \end{figure} \end{document}  output: b) using subcaption that provides a subfigure command. \documentclass[a4paper,12pt]{article} \usepackage{graphicx} \usepackage{subcaption} \begin{document} \begin{figure}[htb] \centering \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image-a} \caption{A subfigure}\label{fig:1a} \end{subfigure}% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image-b} \caption{A subfigure}\label{fig:1b} \end{subfigure}% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image-c} \caption{A subfigure}\label{fig:1c} \end{subfigure}% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image} \caption{A subfigure}\label{fig:1d} \end{subfigure}\\% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image-a} \caption{A subfigure}\label{fig:1e} \end{subfigure}% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image-b} \caption{A subfigure}\label{fig:1f} \end{subfigure}% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image-c} \caption{A subfigure}\label{fig:1g} \end{subfigure}% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image} \caption{A subfigure}\label{fig:1h} \end{subfigure}\\% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image-a} \caption{A subfigure}\label{fig:1i} \end{subfigure}% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image-b} \caption{A subfigure}\label{fig:1j} \end{subfigure}% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image-c} \caption{A subfigure}\label{fig:1k} \end{subfigure}% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image} \caption{A subfigure}\label{fig:1l} \end{subfigure}\\% \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=.99\textwidth]{example-image} \caption{A subfigure}\label{fig:1m} \end{subfigure}% \caption{This is lot of figures arranged side by side in matrix form with captions for each and a main caption}\label{fig:1} \end{figure} \end{document}  output: c) Using new subfig (subfigure is obsolete): \documentclass[a4paper,12pt]{article} \usepackage{graphicx} \usepackage{subfig} \begin{document} \begin{figure}[htb] \centering \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image-a}}\hfill \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image-b}}\hfill \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image-c}}\hfill \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image}}\\ \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image-a}}\hfill \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image-b}}\hfill \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image-c}}\hfill \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image}}\\ \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image-a}}\hfill \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image-b}}\hfill \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image-c}}\hfill \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image}}\\ \subfloat[A subfigure]{% \includegraphics[width=.24\textwidth]{example-image}} \caption{This is lot of figures arranged side by side in matrix form with captions for each and a main caption}\label{fig:1} \end{figure} \end{document}  16. Inserting n number of blank lines Use \vspace*{n * \baselineskip} % empty line  Where $n=\{1,2,3..\}$ (an integer) # Installing scikit-learn for Virtualenv Python 2.7.5 on 64-bit Ubuntu 13.10 1. Install dependencies using apt-get: sudo apt-get install build-essential python-dev libatlas-dev libatlas3-base liblapack-dev gfortran libpng12-dev libfreetype6-dev  2. Install dependent python modules using virtualenv pip/easy_install: ~/workspace/python-2.7.5-venv/bin/pip install numpy ~/workspace/python-2.7.5-venv/bin/pip install scipy ~/workspace/python-2.7.5-venv/bin/pip install matplotlib (optional, for doc)  3. Install scikit-learn ~/workspace/python-2.7.5-venv/bin/pip install scikit-learn  4. Test installation source ~/workspace/python-2.7.5-venv/bin/activate
(python-2.7.5-venv)\$python
>>import sklearn


# How to get back Gnome Classic Desktop on Ubuntu 13.10

1. Install gnome-session-fallback:

sudo apt-get install gnome-session-fallback


2.Log out
3. At login screen, select ‘Gnome Flashback (Without Effect’)
4. login (‘Gnome Flashback’ desktop session doesn’t support the alt+Tab window
switching feature)