libeblearntools
|
00001 /*************************************************************************** 00002 * Copyright (C) 2010 by Pierre Sermanet * 00003 * pierre.sermanet@gmail.com * 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Redistribution under a license not approved by the Open Source 00014 * Initiative (http://www.opensource.org) must display the 00015 * following acknowledgement in all advertising material: 00016 * This product includes software developed at the Courant 00017 * Institute of Mathematical Sciences (http://cims.nyu.edu). 00018 * * The names of the authors may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00023 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00024 * DISCLAIMED. IN NO EVENT SHALL ThE AUTHORS BE LIABLE FOR ANY 00025 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00026 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00027 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00028 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00030 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 ***************************************************************************/ 00032 00033 #ifndef PATCH_DATASET_H_ 00034 #define PATCH_DATASET_H_ 00035 00036 #include "dataset.h" 00037 00038 namespace ebl { 00039 00047 template <class Tdata> class patch_dataset : public dataset<Tdata> { 00048 public: 00049 00051 // constructors 00052 00059 patch_dataset(const char *name, const char *inroot, const char *outdir, 00060 uint max_folders = 1); 00061 00063 virtual ~patch_dataset(); 00064 00066 // data 00067 00069 virtual bool add_data(idx<Tdata> &d, const t_label label, 00070 const string *class_name, 00071 const char *filename = NULL, 00072 const rect<int> *r = NULL, 00073 pair<int,int> *center = NULL, 00074 const rect<int> *visr = NULL, 00075 const rect<int> *cropr = NULL, 00076 const vector<object*> *objs = NULL, 00077 const jitter *jittforce = NULL); 00078 00079 protected: 00080 00084 void save_patches(vector<idx<Tdata> > &patches, const string &outdir, 00085 uint max_folders, const string &filename, 00086 double scale, const t_label label); 00087 00088 protected: 00089 uint max_folders; // maximum number of patch directories 00090 // base class members to be used /////////////////////////////// 00091 using dataset<Tdata>::inroot; 00092 using dataset<Tdata>::allocated; 00093 using dataset<Tdata>::display_extraction; 00094 using dataset<Tdata>::display_result; 00095 using dataset<Tdata>::outdims; 00096 using dataset<Tdata>::outdir; 00097 using dataset<Tdata>::sleep_display; 00098 using dataset<Tdata>::sleep_delay; 00099 using dataset<Tdata>::print_stats; 00100 using dataset<Tdata>::data_cnt; 00101 using dataset<Tdata>::extension; 00102 using dataset<Tdata>::scales; 00103 using dataset<Tdata>::max_data; 00104 using dataset<Tdata>::max_data_set; 00105 using dataset<Tdata>::save_mode; 00106 using dataset<Tdata>::original_bbox; 00107 using dataset<Tdata>::nopadded; 00108 }; 00109 00110 } // end namespace ebl 00111 00112 #include "patch_dataset.hpp" 00113 00114 #endif /* PATCH_DATASET_H_ */