Commit e6d3dff1 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Merge branch '24' into 'master'

Mention about bob.io.base.peek in user guide.

Closes #24

See merge request !29
parents e824734e ab512120
Pipeline #10495 passed with stages
in 11 minutes and 59 seconds
......@@ -14,22 +14,27 @@
temp_dir = tempfile.mkdtemp(prefix='bob_doctest_')
os.chdir(temp_dir)
from bob.io.base import test_utils
path_to_image = test_utils.datafile('grace_hopper.png', 'bob.io.image')
============
User Guide
============
By importing this package, you can use |project| native array reading and
writing routines to load and save files using various image formats, using the simple plug-in technology for :py:mod:`bob.io.base`, i.e., :py:func:`bob.io.base.load` and :py:func:`bob.io.base.save`.
writing routines to load and save files using various image formats, using the
simple plug-in technology for :py:mod:`bob.io.base`, i.e.,
:py:func:`bob.io.base.load` and :py:func:`bob.io.base.save`.
.. code-block:: python
.. doctest::
>> import bob.io.base
>> import bob.io.image #under the hood: loads Bob plugin for image files
>> x = bob.io.base.load('myfile.jpg')
>>> import bob.io.base
>>> import bob.io.image # under the hood: loads Bob plugin for image files
>>> img = bob.io.base.load(path_to_image)
In the following example, an image generated randomly using the method `NumPy`
:py:func:`numpy.random.random_integers`, is saved in lossless PNG format. The image
must be of type ``uint8`` or ``uint16``:
:py:func:`numpy.random.random_integers`, is saved in lossless PNG format. The
image must be of type ``uint8`` or ``uint16``:
.. doctest::
......@@ -41,13 +46,20 @@ must be of type ``uint8`` or ``uint16``:
The loaded image files can be 3D arrays (for RGB format) or 2D arrays (for
greyscale) of type ``uint8`` or ``uint16``.
In order to visualize the loaded image you can use :py:func:`bob.io.image.imshow`:
You can also get information about images without loading them using
:py:func:`bob.io.base.peek`:
.. doctest::
>>> bob.io.base.peek(path_to_image)
(dtype('uint8'), (3, 600, 512), (307200, 512, 1))
In order to visualize the loaded image you can use
:py:func:`bob.io.image.imshow`:
.. doctest::
>>> from bob.io.base import test_utils
>>> path = test_utils.datafile('grace_hopper.png', 'bob.io.image')
>>> img = bob.io.base.load(path)
>>> img = bob.io.base.load(path_to_image)
>>> bob.io.image.imshow(img) # doctest: +SKIP
.. plot::
......@@ -60,7 +72,9 @@ In order to visualize the loaded image you can use :py:func:`bob.io.image.imshow
img = bob.io.base.load(path)
bob.io.image.imshow(img)
Or you can just get a view (not copy) of your image that is :py:mod:`matplotlib.pyplot` compatible:
Or you can just get a view (not copy) of your image that is
:py:mod:`matplotlib.pyplot` compatible using
:py:func:`bob.io.image.to_matplotlib`:
.. doctest::
......
......@@ -12,7 +12,8 @@
.. todolist::
This module provides a plugin for :py:mod:`bob.io.base` that allows |project|
This package is a part of `Bob`_.
It provides a plugin for :py:mod:`bob.io.base` that allows |project|
to read and write images using its native API (:py:func:`bob.io.base.load` and
:py:func:`bob.io.base.save`).
......@@ -25,7 +26,8 @@ At present, this plugin provides support for the following types of images:
* BMP (color only)
* Netpbm images (binary - PBM, gray - PGM, color - PPM)
Additionally, we provide the pure C++ interface to read and write these kind of images, see :doc:`cpp_api`.
Additionally, we provide the pure C++ interface to read and write these kind of
images, see :doc:`cpp_api`.
Documentation
-------------
......
.. vim: set fileencoding=utf-8 :
.. Andre Anjos <andre.anjos@idiap.ch>
.. Tue 20 Mar 2012 08:57:32 CET
..
.. Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
.. This file contains all links we use for documentation in a centralized place
.. Place here references to all citations in lower case
.. _argparse: http://code.google.com/p/argparse/
.. _blitz++: http://www.oonumerics.org/blitz
.. _bob's idiap guide: https://gitlab.idiap.ch/bob/bob/wikis/Using-Bob-at-Idiap
.. _bob's website: https://www.idiap.ch/software/bob
.. _boost: http://www.boost.org
.. _buildbot: http://trac.buildbot.net
.. _buildout: http://pypi.python.org/pypi/zc.buildout/
.. _c++: http://www2.research.att.com/~bs/C++.html
.. _cmake: http://www.cmake.org
.. _doxygen: http://www.doxygen.org
.. _dvipng: http://savannah.nongnu.org/projects/dvipng/
.. _ffmpeg: http://ffmpeg.org
.. _libav: http://libav.org
.. _fftw: http://www.fftw.org/
.. _fink: http://www.finkproject.org
.. _git: http://git-scm.com/
.. _github: http://github.com/
.. _google perftools: http://code.google.com/p/google-perftools
.. _hdf5: http://www.hdfgroup.org/HDF5
.. _idiap: http://www.idiap.ch
.. _ipython: http://ipython.scipy.org
.. _lapack: http://www.netlib.org/lapack
.. _latex: http://www.latex-project.org/
.. _libjpeg: http://libjpeg.sourceforge.net/
.. _libpng: http://libpng.org/pub/png/libpng.html
.. _libsvm: http://www.csie.ntu.edu.tw/~cjlin/libsvm/
.. _libtiff: http://www.remotesensing.org/libtiff/
.. _giflib: http://giflib.sourceforge.net/
.. _macports installation instructions: http://www.macports.org/install.php
.. _macports: http://www.macports.org
.. _matio: http://matio.sourceforge.net
.. _matlab: http://www.mathworks.ch/products/matlab/
.. _matplotlib: http://matplotlib.sourceforge.net
.. _numpy: http://numpy.scipy.org
.. _nose: http://nose.readthedocs.org
.. _opencv: http://opencv.willowgarage.com/
.. _pil: http://www.pythonware.com/products/pil/
.. _pillow: https://pypi.python.org/pypi/Pillow/
.. _python: http://www.python.org
.. _pypi: http://pypi.python.org
.. _qt4: http://qt.nokia.com/
.. _satellite packages: https://www.idiap.ch/software/bob/packages
.. _scipy: http://www.scipy.org
.. _setuptools: http://trac.edgewall.org/wiki/setuptools
.. _sphinx: http://sphinx.pocoo.org
.. _sqlalchemy: http://www.sqlalchemy.org/
.. _sqlite: http://www.sqlite.org/
.. _submit a new bug report: https://www.idiap.ch/software/bob/issues
.. _torch 3 vision: http://torch3vision.idiap.ch
.. _torch 3: http://www.torch.ch
.. _torch 5: http://torch5.sourceforge.net
.. _torch: https://github.com/andresy/torch
.. _vlfeat launchpad webpage: https://launchpad.net/~gezakovacs/+archive/vlfeat
.. _vlfeat: http://www.vlfeat.org/
.. Place here references to licenses
.. _apache-2.0: http://www.opensource.org/licenses/Apache-2.0
.. _artistic-2.0: http://www.opensource.org/licenses/Artistic-2.0
.. _bsd-2-clause: http://www.opensource.org/licenses/BSD-2-Clause
.. _bsd-3-clause: http://www.opensource.org/licenses/BSD-3-Clause
.. _bsl-1.0: http://www.opensource.org/licenses/BSL-1.0
.. _gpl-2.0: http://www.opensource.org/licenses/GPL-2.0
.. _gpl-3.0: http://www.opensource.org/licenses/GPL-3.0
.. _hdf5 license: ftp://ftp.hdfgroup.org/HDF5/current/src/unpacked/COPYING
.. _lgpl-2.1: http://www.opensource.org/licenses/LGPL-2.1
.. _libpng license: http://www.libpng.org/pub/png/src/libpng-LICENSE.txt
.. _mit: http://www.opensource.org/licenses/MIT
.. _python-2.0: http://www.opensource.org/licenses/Python-2.0
.. _bob: https://www.idiap.ch/software/bob
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment