Commit 399d19ab authored by André Anjos's avatar André Anjos 💬

All compiles file; All tests passing

parent 38baf284
......@@ -17,7 +17,6 @@ before_install:
- sudo add-apt-repository -y ppa:biometrics/bob.preview
- sudo apt-get update -qq
- sudo apt-get install -qq --force-yes bob-dev libjpeg8-dev libnetpbm10-dev libpng12-dev libtiff4-dev libgif-dev
- sudo apt-get install -qq python-imaging
- if [ -n "${NUMPYSPEC}" ]; then sudo apt-get install -qq libatlas-dev libatlas-base-dev liblapack-dev gfortran; fi
- if [ -n "${NUMPYSPEC}" ]; then pip install --upgrade pip setuptools; fi
- if [ -n "${NUMPYSPEC}" ]; then pip install --find-links http://wheels.astropy.org/ --find-links http://wheels2.astropy.org/ --use-wheel numpy$NUMPYSPEC sphinx nose; fi
......@@ -26,8 +25,8 @@ install:
- "python bootstrap.py"
- "CFLAGS=-coverage ./bin/buildout"
script:
- "./bin/python -c 'from xbob.io.base import get_config; print(get_config())'"
- "./bin/coverage run --source=xbob.io.base ./bin/nosetests -sv"
- "./bin/python -c 'from xbob.io.image import get_config; print(get_config())'"
- "./bin/coverage run --source=xbob.io.image ./bin/nosetests -sv"
- "./bin/sphinx-build -b doctest doc sphinx"
- "./bin/sphinx-build -b html doc sphinx"
after_success:
......
......@@ -4,7 +4,7 @@
[buildout]
parts = scripts
eggs = xbob.io.matlab
eggs = xbob.io.image
extensions = xbob.buildout
mr.developer
auto-checkout = *
......
This diff is collapsed.
......@@ -17,8 +17,7 @@
#include <boost/algorithm/string.hpp>
#include <string>
#include <bob/io/CodecRegistry.h>
#include <bob/core/logging.h>
#include <bob/io/File.h>
// The following documentation is mostly coming from wikipedia:
// http://en.wikipedia.org/wiki/BMP_file_format
......
......@@ -7,8 +7,8 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#ifndef BOB_IO_MATLAB_FILE_H
#define BOB_IO_MATLAB_FILE_H
#ifndef BOB_IO_IMAGE_FILE_H
#define BOB_IO_IMAGE_FILE_H
#include <boost/shared_ptr.hpp>
#include <bob/io/File.h>
......@@ -38,4 +38,4 @@ boost::shared_ptr<bob::io::File> make_netpbm_file (const char* path, char mode);
boost::shared_ptr<bob::io::File> make_png_file (const char* path, char mode);
boost::shared_ptr<bob::io::File> make_bmp_file (const char* path, char mode);
#endif /* BOB_IO_MATLAB_FILE_H */
#endif /* BOB_IO_IMAGE_FILE_H */
......@@ -17,6 +17,8 @@
#include <boost/algorithm/string.hpp>
#include <string>
#include <bob/io/File.h>
extern "C" {
#include <gif_lib.h>
}
......@@ -646,6 +648,6 @@ class ImageGifFile: public bob::io::File {
std::string ImageGifFile::s_codecname = "bob.image_gif";
boost::shared_ptr<bob::io::File> make_giff_file (const char* path, char mode) {
boost::shared_ptr<bob::io::File> make_gif_file (const char* path, char mode) {
return boost::make_shared<ImageGifFile>(path, mode);
}
......@@ -18,6 +18,8 @@
#include <boost/algorithm/string.hpp>
#include <string>
#include <bob/io/File.h>
#include <jpeglib.h>
// Default JPEG quality
......
......@@ -81,8 +81,7 @@ static PyObject* create_module (void) {
}
}
else {
PyErr_Format(PyExc_RuntimeError, "LibJPEG compiled with " << BITS_IN_JSAMPLE <<
" bits depth (instead of 8). JPEG images are hence not supported.");
PyErr_Format(PyExc_RuntimeError, "libjpeg compiled with `%d' bits depth (instead of 8). JPEG images are hence not supported.", BITS_IN_JSAMPLE);
PyErr_Print();
}
......
......@@ -17,6 +17,8 @@
#include <boost/algorithm/string.hpp>
#include <string>
#include <bob/io/File.h>
extern "C" {
// This header must come last, as it brings a lot of global stuff that messes up other headers...
#include <pam.h>
......@@ -315,7 +317,7 @@ class ImageNetpbmFile: public bob::io::File {
public: //api
ImageNetpbmFile(const std::string& path, char mode):
ImageNetpbmFile(const char* path, char mode):
m_filename(path),
m_newfile(true) {
......@@ -341,8 +343,8 @@ class ImageNetpbmFile: public bob::io::File {
virtual ~ImageNetpbmFile() { }
virtual const std::string& filename() const {
return m_filename;
virtual const char* filename() const {
return m_filename.c_str();
}
virtual const bob::core::array::typeinfo& type_all() const {
......@@ -357,8 +359,8 @@ class ImageNetpbmFile: public bob::io::File {
return m_length;
}
virtual const std::string& name() const {
return s_codecname;
virtual const char* name() const {
return s_codecname.c_str();
}
virtual void read_all(bob::core::array::interface& buffer) {
......@@ -415,7 +417,7 @@ std::string ImageNetpbmFile::s_codecname = "bob.image_netpbm";
static bool netpbm_initialized = false;
boost::shared_ptr<bob::io::File> make_netpbm_file (const std::string& path, char mode) {
boost::shared_ptr<bob::io::File> make_netpbm_file (const char* path, char mode) {
if (!netpbm_initialized) {
pm_init("bob",0);
netpbm_initialized = true;
......
......@@ -17,7 +17,7 @@
#include <boost/algorithm/string.hpp>
#include <string>
#include <bob/io/CodecRegistry.h>
#include <bob/io/File.h>
extern "C" {
#include <png.h>
......
......@@ -8,7 +8,9 @@
"""Runs some image tests
"""
from . import load, test_utils
import os
import numpy
from xbob.io.base import load, write, test_utils
# These are some global parameters for the test.
PNG_INDEXED_COLOR = test_utils.datafile('img_indexed_color.png', __name__)
......@@ -20,3 +22,29 @@ def test_png_indexed_color():
assert img.shape == (3,22,32)
assert img[0,0,0] == 255
assert img[0,17,17] == 117
def transcode(filename):
tmpname = test_utils.temporary_filename(suffix=os.path.splitext(filename)[1])
try:
# complete transcoding test
image = load(filename)
# save with the same extension
write(image, tmpname)
# reload the image from the file
image2 = load(tmpname)
assert numpy.array_equal(image, image2)
finally:
if os.path.exists(tmpname): os.unlink(tmpname)
def test_netpbm():
transcode(test_utils.datafile('test.pgm', __name__)) #indexed, works fine
transcode(test_utils.datafile('test.pbm', __name__)) #indexed, works fine
transcode(test_utils.datafile('test.ppm', __name__)) #indexed, works fine
#transcode(test_utils.datafile('test.jpg', __name__)) #does not work because of re-compression
This diff is collapsed.
......@@ -17,6 +17,8 @@
#include <boost/algorithm/string.hpp>
#include <string>
#include <bob/io/File.h>
extern "C" {
#include <tiffio.h>
}
......
......@@ -57,7 +57,7 @@ static int dict_steal(PyObject* d, const char* key, PyObject* value) {
*/
static PyObject* libjpeg_version() {
boost::format f("%d (compiled with %d bits depth)");
f % JPEG_LIB_VERSION;
f % LIBJPEG_VERSION;
f % BITS_IN_JSAMPLE;
return Py_BuildValue("s", f.str().c_str());
}
......
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