Open source Photosynth: PixelStruct 0.2 released

PixelStruct 0.2 has been released. This version has two main changes from the previous version. Firstly, several new transition modes are available, allowing near seamless transition between photos. Secondly, various bugs have been fixed, allowing larger image sets to be viewed, such as the following 715-image reconstruction of Notre Dame.

For more information, including download links, please see the project homepage.


Converting videos to 3GP in Ubuntu Intrepid 8.10 with FFmpeg

The default installation of FFmpeg in Ubuntu Intrepid 8.10 doesn't support conversion to 3GP. According to this, installing ubuntu-restricted-extras should fix this, but that didn't work in my case. So, you may need to manually install the required packages:

sudo aptitude install \
libavcodec-unstripped-51 \
libavdevice-unstripped-52 \
libavformat-unstripped-52 \
libavutil-unstripped-49 \
libpostproc-unstripped-51 \
libswscale-unstripped-0

Then, to convert a video, you can either go the command-line route:

ffmpeg -i input.mpg \
-vcodec h263 -s qcif -r 15 -b 100k \
-acodec libfaac -ac 1 -ar 32000 -ab 64k \
output.3gp

Which will convert to input.mpg to output.3gp with:

  • H.263 video codec
  • QCIF video resolution (176x144)
  • 15fps
  • 100 kb/s video bitrate
  • AAC audio codec (through libfaac)
  • 1 audio channel
  • 32000 Hz audio sampling frequency
  • 64 kb/s audio bitrate

Alternatively, if you prefer using a GUI, you can try Mobile Media Converter (direct link to v.1.4.1 .deb), which seems to work pretty well, and also supports downloading videos directly from YouTube.


Command-line scanning

First you need to find the ID of the required device:

scanimage -L

Output:

device `v4l:/dev/video0' is a Noname Acer CrystalEye webcam virtual device
device `net:linux-box.local:hpaio:/usb/Photosmart_C4100_series?serial=XXXXXXXXXXXXXX' is a Hewlett-Packard Photosmart_C4100_series all-in-one

In this case the device ID is net:linux-box.local:hpaio:/usb/Photosmart_C4100_series?serial=XXXXXXXXXXXXXX Then, for colour scanning:

scanimage -d "net:linux-box.local:hpaio:/usb/Photosmart_C4100_series?serial=XXXXXXXXXXXXXX" \
--mode Color --resolution 300dpi | pnmtopng - > image.png

Or for greyscale scanning:

scanimage -d "net:linux-box.local:hpaio:/usb/Photosmart_C4100_series?serial=XXXXXXXXXXXXXX" \
--mode Gray --resolution 300dpi | pnmtopng - > image.png

Batch resizing a directory of images in Linux with ImageMagick

To replace all JPEGs in a directory with resized versions:

mogrify -resize 720x576 *.jpg

Note that this will retain the aspect ratio, such that the image is scaled so it will fit inside a box of the given dimensions. To force the image to be stretched to the given dimensions instead:

mogrify -resize 720x576! *.jpg

[novell.com]


Converting images to grayscale in Linux with ImageMagick

To convert a single image ‘image.jpg’ to a grayscale version ‘image-bw.jpg’:

convert image.jpg -colorspace Gray image-bw.jpg

To convert an entire directory in images to grayscale:

mkdir bw && for i in *.jpg; do convert $i -colorspace Gray bw/$i; done

The grayscale images will be placed in a subdirectory named ‘bw’. To convert something other than JPEGs, just change *.jpg to the appropriate file extension. For more information, see here.


Creating a glossary in LaTeX

Note that this uses the deprecated ‘glossary’ package. At the moment I’m using the ‘nomencl’ package, which LyX has built-in support for.

First, add to your preamble something like this:

\usepackage[style=list]{glossary} % can be obtained from http://www.ctan.org/tex-archive/macros/latex/contrib/glossary/
\makeglossary
\newacronym{GNU}{GNU's Not Unix}{description={A computer operating system composed entirely of free software.}}
\storeglosentry{linux}{name={Linux}, description={Any Unix-like computer operating system that uses the Linux kernel.}}

And add the following lines where you want the glossary to appear:

\printglossary
\addcontentsline{toc}{chapter}{Glossary} % remove this line if you don't want a table of contents entry for the glossary

Then, where you want to reference glossary entries:

\gls{linux} % displays name field of the linux entry (in this case "Linux")
\useGlosentry{linux}{GNU/Linux} % displays "GNU/Linux"
\GNU % displays "GNU's Not Unix (GNU)" the first time this is used
\GNU % displays "GNU" all subsequent times
% NB: remember to use \GNU\ if want to retain the space after the acronym

To generate the glossary, run:

makeindex 'file.glo' -s 'file.ist' -t 'file.glg' -o 'file.gls' # replace 'file' with the appropriate name for your files

If you use Kile, and want to generate the glossary from the menu, first do the following:

  • Settings
  • Configure Kile...
  • Tools
  • Build
  • New Tool...
  • MakeGlossary
  • Next
  • MakeIndex
  • Finish
  • General
  • Command: makeindex
  • Options: '%S.glo' -s '%S.ist' -t '%S.glg' -o '%S.gls'
  • Advanced
  • Source extension: glo
  • Target extension: gls
  • Menu
  • Add tool to Build menu: Compile
  • OK

And then to generate the glossary do Build>Compile>MakeGlossary.


Spellchecking LaTeX documents

To spellcheck a LaTeX document, run the following command (replacing ‘file.tex’ with the name of your document):

aspell -a -t < 'file.tex' | grep "&" | sort -u

Creating flowcharts with PGF/TikZ in LaTeX

First, add to your preamble:

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

% styles for flowcharts
\tikzstyle{decision} = [diamond, draw, text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, text width=5em, text centered, rounded corners, minimum height=4em]

Then, create flowcharts with something like the following:

\begin{figure}
 \begin{center}
  \begin{tikzpicture}[node distance=2.5cm, auto, >=stealth]
   % nodes
   \node[block] (a)                                     {A};
   \node[block] (b)  [right of=a]                       {B};
   \node[decision,text width=2.8cm]
                (c)  [right of=b, node distance=3.3cm]  {C?};
   \node[block] (d)  [right of=c, node distance=3.6cm]  {D};
   \node[block] (e)  [below of=a, node distance=4cm]    {E};
   \node[block] (f)  [right of=e]                       {F};
   \node[block] (g)  [right of=f]                       {G};
   \node[block] (h)  [right of=g]                       {H};

   % edges
   \draw[->] (a) -- (b);
   \draw[->] (b) -- (c);
   \draw[->] (c) -- node[above] {yes} (d);
   \draw[->] (c.north) to [out=170,in=45] node[above] {no} (b.north);
   \draw[->] (d.south) to [out=210,in=20] (e.north);
   \draw[->] (e) -- (f);
   \draw[->] (f) -- (g);
   \draw[->] (g) -- (h);
  \end{tikzpicture}
  \caption{Flowchart}
  \label{flowchart}
 \end{center}
\end{figure}

This will produce something like the following:

Flowchart


Creating slideshows with LaTeX

LaTeX Beamer is fantastic for this task. This page provides a good introduction to the package. Usually, to produce the actual slideshow, you wou would begin your document with something like the following:

\documentclass{beamer}
\mode{
 \usetheme{Berlin}
 \usecolortheme{crane}
}

Of course, Berlin and crane can be changed to themes of your choice. A gallery of themes can be found here, and examples of color themes can be found in section 17 (page 162 as of version 3.07) of the beamer manual. However, if you would like to print the slideshow as a handout (multiple slides on a single page), you can change the lines given above to:

\documentclass[handout]{beamer}
\mode{
 \usetheme{default}
 \usecolortheme{seagull}
}
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper,landscape,border shrink=5mm]

And, if you would like to compress everything to an article format, use the following instead:

\documentclass{article}
\usepackage{beamerarticle}

Creating A1 posters with LaTeX

Firstly, after downloading and installing the textpos package, begin the document with:

\documentclass{a0poster}
\usepackage[landscape,a1paper]{geometry}
\usepackage[absolute]{textpos}
\textblockorigin{0cm}{0cm}

Then, to position blocks of text on the page, use the textblock* environment, such as:

\begin{textblock*}{270mm}(530mm,13mm) % 270mm wide, 530mm left of and 13mm below top-left corner of page
 \section*{Hello World}
 The quick brown fox jumps over the lazy dog.
\end{textblock*}

In order to aid in positioning textblocks, temporarily adding the following to your preamble may be helpful:

\usepackage[colorgrid,texcoord]{eso-pic} % add a grid to the page