* filter/common/objects_photo.hh,
* filter/object_groups_v_thickness.hh: New.
---
scribo/ChangeLog | 7 ++
scribo/filter/common/objects_photo.hh | 98 ++++++++++++++++++++++++++++
scribo/filter/object_groups_v_thickness.hh | 97 +++++++++++++++++++++++++++
3 files changed, 202 insertions(+), 0 deletions(-)
create mode 100644 scribo/filter/common/objects_photo.hh
create mode 100644 scribo/filter/object_groups_v_thickness.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 53bec20..15ea49e 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,12 @@
2009-09-15 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Add new filters in Scribo.
+
+ * filter/common/objects_photo.hh,
+ * filter/object_groups_v_thickness.hh: New.
+
+2009-09-15 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
* estim/object_groups_v_thickness.hh: New routine. Estimate
object group thickness.
diff --git a/scribo/filter/common/objects_photo.hh
b/scribo/filter/common/objects_photo.hh
new file mode 100644
index 0000000..53da0a8
--- /dev/null
+++ b/scribo/filter/common/objects_photo.hh
@@ -0,0 +1,98 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_FILTER_COMMON_OBJECTS_PHOTO_HH
+# define SCRIBO_FILTER_COMMON_OBJECTS_PHOTO_HH
+
+/// \file
+///
+/// \brief Common objects filters to use in photos.
+
+
+# include <scribo/core/object_image.hh>
+
+# include <scribo/filter/objects_small.hh>
+# include <scribo/filter/objects_thin.hh>
+# include <scribo/filter/objects_thick.hh>
+
+
+namespace scribo
+{
+
+ namespace filter
+ {
+
+ namespace common
+ {
+
+
+ /*! \brief Common objects filters to use in photos.
+
+ \param[in] objects An object image.
+
+ \return A filtered object image.
+ */
+ template <typename L>
+ object_image(L)
+ objects_photo(const object_image(L)& objects);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L>
+ object_image(L)
+ objects_photo(const object_image(L)& objects)
+ {
+ trace::entering("scribo::filter::common::objects_photo");
+
+ mln_precondition(objects.is_valid());
+
+
+ object_image(L) filtered_objects
+ = scribo::filter::objects_small(objects, 6);
+
+ filtered_objects
+ = scribo::filter::objects_thin(filtered_objects, 1);
+
+// filtered_objects
+// = scribo::filter::objects_thick(filtered_objects,
+// math::min(input.ncols(),
+// input.nrows()) / 5);
+
+ trace::exiting("scribo::filter::common::objects_photo");
+ return filtered_objects;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace scribo::filter::common
+
+ } // end of namespace scribo::filter
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_FILTER_COMMON_OBJECTS_PHOTO_HH
diff --git a/scribo/filter/object_groups_v_thickness.hh
b/scribo/filter/object_groups_v_thickness.hh
new file mode 100644
index 0000000..f16f1db
--- /dev/null
+++ b/scribo/filter/object_groups_v_thickness.hh
@@ -0,0 +1,97 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef SCRIBO_FILTER_OBJECT_GROUPS_V_THICKNESS_HH
+# define SCRIBO_FILTER_OBJECT_GROUPS_V_THICKNESS_HH
+
+/// \file
+///
+/// \brief Filter groups having their object mean thickness too low.
+
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/object_groups.hh>
+# include <scribo/estim/object_groups_v_thickness.hh>
+
+
+namespace scribo
+{
+
+ namespace filter
+ {
+
+ using namespace mln;
+
+
+ /*! \brief Filter groups having their object mean thickness too low.
+
+ \param[in] groups Object group information.
+ \param[in] thickness Object group mean thickness must be greater
+ or equal to this value.
+
+ \return Filtered object group information.
+
+ */
+ template <typename L>
+ object_groups<L>
+ object_groups_v_thickness(const object_groups<L>& groups, float
thickness);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename L>
+ object_groups<L>
+ object_groups_v_thickness(const object_groups<L>& groups, float thickness)
+ {
+ trace::entering("scribo::filter::object_groups_v_thickness");
+
+ mln_precondition(groups.is_valid());
+ mln_precondition(thickness >= 0);
+
+ mln::util::array<float>
+ group_thickness = estim::object_groups_v_thickness(groups);
+
+ object_groups<L> output(groups);
+ output(0) = 0;
+ for (unsigned i = 1; i < output.size(); ++i)
+ if (group_thickness[groups[i]] < thickness)
+ output(i) = 0;
+
+ trace::exiting("scribo::filter::object_groups_v_thickness");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace scribo::filter
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_FILTER_OBJECT_GROUPS_V_THICKNESS_HH
--
1.5.6.5
Show replies by date