Friday, February 25, 2011

Copy Paste between Emacs and other applications

If you are using GNU Emacs in an X-windows environment like Gnome, you would have noticed that sometimes copy-pasting from Emacs to other applications or vice versa does not work.
To fix this, edit your .emacs file (located in your home folder) and add the following lines:
;; Send primary selection to clipboard so copy-paste works with other X-applications
(global-set-key "\C-w" 'clipboard-kill-region)
(global-set-key "\M-w" 'clipboard-kill-ring-save)
(global-set-key "\C-y" 'clipboard-yank)

OpenCV 2.2 on Ubuntu 10.10

*Update: For OpenCV 2.4 on Ubuntu 12.04 see my latest post.

OpenCV (Open Source Computer Vision) is a library of programming functions for real time computer vision. It is released under a BSD license, it is free for both academic and commercial use. It has C++, C, Python and soon Java interfaces running on Windows, Linux, Android and Mac.

This is how to build and install OpenCV 2.2 on Ubuntu 10.10.

First, install the dependencies from the repositories:
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev
Download the source code:
Extract, create the build directory:
tar xfv OpenCV-2.2.0.tar.bz2
rm OpenCV-2.2.0.tar.bz2
cd OpenCV-2.2.0
Configure, make and install:
cmake ..
sudo make install
To configure the library, edit the following file (might be empty):
sudo gedit /etc/
and add the line
Then run:
sudo ldconfig
Finally, edit the file:
sudo gedit /etc/bash.bashrc
and add the following lines at the end:
Most of the above was find here.

Older versions? Take a look at the following links:

OpenCV 2.1 on Ubuntu 10.04 (pretty much the same as above, but with TBB)
OpenCV 2.0 on Ubuntu 9.10

For OpenCV 2.3.1 see this post.

Saturday, February 19, 2011

Completely Disable Touchpad in Ubuntu

To temporarily disable the touchpad while typing just go to
System > Preferences > Touchpad
and check
Disable touchpad while typing
but if you want to completely disable it, you can do the following
In a terminal type:
xinput list | grep -i touchpad
to determine the device ID (in my case, 14). Then disable by typing:
xinput set-prop 14 "Device Enabled" 0
To enable it, type:
xinput set-prop 14 "Device Enabled" 1

From the Ubuntu Documentation: Synaptics Touchpad

Tuesday, February 15, 2011

Ogre3D Applications and Emacs

This is the first application of the Ogre3D tutorial, set up for compiling by calling
make -k
from Emacs. This is useful when you have a shortcut for M-x compile say, F1, so you want to be able to call make from the directory where all your source files are located. The Makefile in the root directory just removes old cmake files, then runs cmake inside build directory and creates the Makefile to build the project. Then builds and executes.

  • Cmake output is redirected to the file /build/cmake.output
  • The executable (OgreApp) is located in build/dist/build
  • The execution log is in build/dist/bin/OgreApp.log
Now you can edit the source files of your Ogre3D application, then hit F1 (or whatever key you've assigned compile to) and build/execute by just pressing one key.

You can download all files from here.