* fabien/mln/upsampling/hq2x.hh,
* fabien/mln/upsampling/hq3x.hh,
* fabien/mln/upsampling/hq4x.hh: Add support for image domains not
starting from (0,0).
Initialize image extension correctly
---
milena/sandbox/ChangeLog | 30 +++++++++++++++++--------
milena/sandbox/fabien/mln/upsampling/hq2x.hh | 20 ++++++++++++-----
milena/sandbox/fabien/mln/upsampling/hq3x.hh | 20 ++++++++++++-----
milena/sandbox/fabien/mln/upsampling/hq4x.hh | 20 ++++++++++++-----
4 files changed, 62 insertions(+), 28 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index d76c826..caf71c7 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,13 @@
+2009-09-15 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Make hq*x algorithms more generic and handle image extensions.
+
+ * fabien/mln/upsampling/hq2x.hh,
+ * fabien/mln/upsampling/hq3x.hh,
+ * fabien/mln/upsampling/hq4x.hh: Add support for image domains not
+ starting from (0,0).
+ Initialize image extension correctly.
+
2009-09-13 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Save work in progress for histo and hsl. Everything is updated.
@@ -274,7 +284,7 @@
Finish the experiment for Laurent.
* levillain/constrained-connectivity.cc: Complete the processing
- chain.
+ chain.
Add a copyright header.
Translate the documentation into English.
s/ima/input/g.
@@ -394,7 +404,7 @@
(print_color),
(fill_image_with_4colors),
(is_equivalent),
- (test_init_point),
+ (test_init_point),
(is_equal),
(is_center_initialized),
(test_init_center) : New test functions.
@@ -411,7 +421,7 @@
2009-08-17 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Improve documentation.
-
+
* green/histo1d/histo1d.hh : Improve documentation aspect.
2009-08-17 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
@@ -425,7 +435,7 @@
Some tries with segmentation using graph (still segfault)..
* edwin/exec/score.hh: New.
* edwin/exec/zi.cc,
- * edwin/exec/zi.hh:
+ * edwin/exec/zi.hh:
Use min-tree based method instead of WST to group components.
2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
@@ -505,7 +515,7 @@
* green/LearnMilena: Remove.
* green/Otsu: Remove.
* green/Stats: Remove.
-
+
2009-08-04 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Integrate LRDE code writting rules in the Stats code.
@@ -513,7 +523,7 @@
* green/Stats/Makefile.am : Remove Makefile.
* green/Stats/Stats.cc : Remove source.
* green/Stats : Remove directory.
-
+
* green/stats : New directory.
* green/stats/Makefile.am : New Makefile.
* green/stats/stats.cc : New source.
@@ -525,7 +535,7 @@
* green/LearnMilena/Makefile.am : Remove Makefile.
* green/LearnMilena/LearnMilena.cc : Remove source.
* green/LearnMilena : Remove directory.
-
+
* green/learn_milena : New directory.
* green/learn_milena/Makefile.am : New Makefile.
* green/learn_milena/learn_milena.cc : New source.
@@ -537,7 +547,7 @@
* green/HelloMilena/Makefile.am : Remove Makefile.
* green/HelloMilena/HelloMilena.cc : Remove source.
* green/HelloMilena : Remove directory.
-
+
* green/hello_milena : New directory.
* green/hello_milena/Makefile.am : New Makefile.
* green/hello_milena/hello_milena.cc : New source.
@@ -550,7 +560,7 @@
* green/HelloWorld/HelloWorld.cc : Remove source.
* green/HelloWorld/Print.cc : Remove source.
* green/HelloWorld : Remove directory.
-
+
* green/hello_world : New directory.
* green/hello_world/Makefile.am : New Makefile.
* green/hello_world/hello_world.cc : New source.
@@ -631,7 +641,7 @@
* icdar/2009/pscomp: New directory.
* icdar/2009/pscomp/iz.cc: New.
- Compute an IZ image along with distances between objects.
+ Compute an IZ image along with distances between objects.
* icdar/2009/pscomp/rect_filter.cc: New.
Algebraic filtering with a combinaison of bounding box width
and height.
diff --git a/milena/sandbox/fabien/mln/upsampling/hq2x.hh
b/milena/sandbox/fabien/mln/upsampling/hq2x.hh
index e4d10d0..78ed271 100644
--- a/milena/sandbox/fabien/mln/upsampling/hq2x.hh
+++ b/milena/sandbox/fabien/mln/upsampling/hq2x.hh
@@ -24,6 +24,11 @@
/// Reference can be found at:
///
http://web.archive.org/web/20070624082212/www.hiend3d.com/hq2x.html
+# include <mln/extension/adjust_duplicate.hh>
+# include <mln/geom/max_col.hh>
+# include <mln/geom/max_row.hh>
+# include <mln/geom/min_col.hh>
+# include <mln/geom/min_row.hh>
# include <mln/geom/ncols.hh>
# include <mln/geom/nrows.hh>
# include <mln/value/rgb8.hh>
@@ -224,7 +229,7 @@ namespace mln
}
- //FIXME: In Milena, nrows != row max
+
template <typename T>
inline
mln_concrete(image2d<T>)
@@ -232,9 +237,9 @@ namespace mln
{
trace::entering("upsampling::impl::hq2x_");
- int nrows = geom::nrows(input);
- int ncols = geom::ncols(input);
- mln_concrete(image2d<T>) output(nrows * 2, ncols * 2);
+ mln_domain(image2d<T>) bbox(input.domain().pmin() * 4,
+ input.domain().pmax() * 4);
+ mln_concrete(image2d<T>) output(bbox);
int LUT16to32[65536];
int RGBtoYUV[65536];
@@ -264,9 +269,9 @@ namespace mln
//
// w5 is the current point.
- for (int j = 0; j < ncols; j++)
+ for (int j = geom::min_col(input); j <= geom::max_col(input); j++)
{
- for (int i = 0; i < nrows; i++)
+ for (int i = geom::min_row(input); i <= geom::max_row(input); i++)
{
w[1] = rgb8toShort(input.at_(i - 1, j - 1));
w[2] = rgb8toShort(input.at_(i - 1, j));
@@ -2965,6 +2970,9 @@ namespace mln
mln_concrete(I) output;
+ // Preparing extension.
+ extension::adjust_duplicate(input, 1);
+
output = impl::hq2x_(exact(input));
trace::exiting("upsampling::hq2x");
diff --git a/milena/sandbox/fabien/mln/upsampling/hq3x.hh
b/milena/sandbox/fabien/mln/upsampling/hq3x.hh
index 603aec8..15c1e65 100644
--- a/milena/sandbox/fabien/mln/upsampling/hq3x.hh
+++ b/milena/sandbox/fabien/mln/upsampling/hq3x.hh
@@ -24,6 +24,11 @@
/// Reference can be found at:
///
http://web.archive.org/web/20070624082212/www.hiend3d.com/hq3x.html
+# include <mln/extension/adjust_duplicate.hh>
+# include <mln/geom/max_col.hh>
+# include <mln/geom/max_row.hh>
+# include <mln/geom/min_col.hh>
+# include <mln/geom/min_row.hh>
# include <mln/geom/ncols.hh>
# include <mln/geom/nrows.hh>
# include <mln/value/rgb8.hh>
@@ -210,7 +215,7 @@ namespace mln
}
- //FIXME: In Milena, nrows != row max
+
template <typename T>
inline
mln_concrete(image2d<T>)
@@ -218,9 +223,9 @@ namespace mln
{
trace::entering("upsampling::impl::hq3x_");
- int nrows = geom::nrows(input);
- int ncols = geom::ncols(input);
- mln_concrete(image2d<T>) output(nrows * 3, ncols * 3);
+ mln_domain(image2d<T>) bbox(input.domain().pmin() * 3,
+ input.domain().pmax() * 3);
+ mln_concrete(image2d<T>) output(bbox);
int LUT16to32[65536];
int RGBtoYUV[65536];
@@ -250,9 +255,9 @@ namespace mln
//
// w5 is the current point.
- for (int j = 0; j < ncols; j++)
+ for (int j = geom::min_col(input); j <= geom::max_col(input); j++)
{
- for (int i = 0; i < nrows; i++)
+ for (int i = geom::min_row(input); i <= geom::max_row(input); i++)
{
w[1] = rgb8toShort(input.at_(i - 1, j - 1));
w[2] = rgb8toShort(input.at_(i - 1, j));
@@ -3923,6 +3928,9 @@ namespace mln
mln_concrete(I) output;
+ // Preparing extension.
+ extension::adjust_duplicate(input, 1);
+
output = impl::hq3x_(exact(input));
trace::exiting("upsampling::hq3x");
diff --git a/milena/sandbox/fabien/mln/upsampling/hq4x.hh
b/milena/sandbox/fabien/mln/upsampling/hq4x.hh
index d42fbe3..c77ef6a 100644
--- a/milena/sandbox/fabien/mln/upsampling/hq4x.hh
+++ b/milena/sandbox/fabien/mln/upsampling/hq4x.hh
@@ -24,6 +24,11 @@
/// Reference can be found at:
///
http://web.archive.org/web/20070624082212/www.hiend3d.com/hq4x.html
+# include <mln/extension/adjust_duplicate.hh>
+# include <mln/geom/max_col.hh>
+# include <mln/geom/max_row.hh>
+# include <mln/geom/min_col.hh>
+# include <mln/geom/min_row.hh>
# include <mln/geom/ncols.hh>
# include <mln/geom/nrows.hh>
# include <mln/value/rgb8.hh>
@@ -330,7 +335,7 @@ namespace mln
}
- //FIXME: In Milena, nrows != row max
+
template <typename T>
inline
mln_concrete(image2d<T>)
@@ -338,9 +343,9 @@ namespace mln
{
trace::entering("upsampling::impl::hq4x_");
- int nrows = geom::nrows(input);
- int ncols = geom::ncols(input);
- mln_concrete(image2d<T>) output(nrows * 4, ncols * 4);
+ mln_domain(image2d<T>) bbox(input.domain().pmin() * 4,
+ input.domain().pmax() * 4);
+ mln_concrete(image2d<T>) output(bbox);
int LUT16to32[65536];
int RGBtoYUV[65536];
@@ -370,9 +375,9 @@ namespace mln
//
// w5 is the current point.
- for (int j = 0; j < ncols; j++)
+ for (int j = geom::min_col(input); j <= geom::max_col(input); j++)
{
- for (int i = 0; i < nrows; i++)
+ for (int i = geom::min_row(input); i <= geom::max_row(input); i++)
{
w[1] = rgb8toShort(input.at_(i - 1, j - 1));
w[2] = rgb8toShort(input.at_(i - 1, j));
@@ -5403,6 +5408,9 @@ namespace mln
mln_concrete(I) output;
+ // Preparing extension.
+ extension::adjust_duplicate(input, 1);
+
output = impl::hq4x_(exact(input));
trace::exiting("upsampling::hq4x");
--
1.5.6.5