--- /dev/null
+/*
+ * mlp-mnist is an implementation of a multi-layer neural network.
+ *
+ * Copyright (c) 2008 Idiap Research Institute, http://www.idiap.ch/
+ * Written by Francois Fleuret <francois.fleuret@idiap.ch>
+ *
+ * This file is part of mlp-mnist.
+ *
+ * mlp-mnist is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * mlp-mnist is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with mlp-mnist. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// $Id: images.h,v 1.1 2005-12-13 17:19:11 fleuret Exp $
+
+#ifndef IMAGES_H
+#define IMAGES_H
+
+#include <iostream>
+#include <fstream>
+#include <stdint.h>
+
+using namespace std;
+
+#include "features.h"
+
+class PixelMaps {
+public:
+ unsigned int _nb_ref;
+ unsigned char *_core;
+ PixelMaps(int size);
+ ~PixelMaps();
+ PixelMaps *add_ref();
+ void del_ref();
+};
+
+class ImageSet {
+ int _nb_pics, _nb_obj;
+ int _width, _height;
+ PixelMaps *_pixel_maps;
+ unsigned char **_pixels, *_labels;
+ bool *_used_picture;
+
+public:
+ ImageSet();
+ ~ImageSet();
+
+ inline int nb_pics() { return _nb_pics; }
+ inline int nb_obj() { return _nb_obj; }
+ inline int width() { return _width; }
+ inline int height() { return _height; }
+ inline unsigned char *pixels(int p) { return _pixels[p]; }
+ inline unsigned char pixel(int p, int x, int y) { return _pixels[p][x + y * _width]; }
+ inline unsigned char label(int p) { return _labels[p]; }
+
+ void reset_used_pictures();
+ int nb_unused_pictures();
+ int pick_unused_picture();
+
+ void load_mnist_format(char *picture_file_name, char *label_file_name);
+
+ void extract_unused_pictures(ImageSet &is, int nb);
+
+};
+
+#endif