libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd Makefile.in cvd/morphology.h cvd_src/mor...


From: Edward Rosten
Subject: [libcvd-members] libcvd Makefile.in cvd/morphology.h cvd_src/mor...
Date: Mon, 06 Dec 2010 16:40:34 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Edward Rosten <edrosten>        10/12/06 16:40:34

Modified files:
        .              : Makefile.in 
        cvd            : morphology.h 
Added files:
        cvd_src        : morphology.cc 

Log message:
        Move non-templated functions into their own source file.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/Makefile.in?cvsroot=libcvd&r1=1.94&r2=1.95
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/morphology.h?cvsroot=libcvd&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/morphology.cc?cvsroot=libcvd&rev=1.1

Patches:
Index: Makefile.in
===================================================================
RCS file: /cvsroot/libcvd/libcvd/Makefile.in,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -b -r1.94 -r1.95
--- Makefile.in 15 Feb 2010 10:40:46 -0000      1.94
+++ Makefile.in 6 Dec 2010 16:40:21 -0000       1.95
@@ -89,6 +89,7 @@
                        cvd_src/exceptions.o                            \
                        cvd_src/image_io.o                              \
                        cvd_src/bayer.o                                 \
+                       cvd_src/morphology.o                            \
                        cvd_src/colourspace_convert.o                   \
                        cvd_src/half_sample.o                           \
                        cvd_src/draw.o                                  \

Index: cvd/morphology.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/morphology.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- cvd/morphology.h    12 Nov 2010 14:07:31 -0000      1.6
+++ cvd/morphology.h    6 Dec 2010 16:40:27 -0000       1.7
@@ -10,6 +10,7 @@
 
 namespace CVD
 {
+       #ifndef DOXYGEN_IGNORE_INTERNAL
        namespace Internal
        {
                namespace MorphologyHelpers
@@ -27,17 +28,10 @@
                        }
                        
                        //Split a list of ImageRefs up in to rows.
-                       vector<vector<ImageRef> > row_split(const 
vector<ImageRef>& v, int y_lo, int y_hi)
-                       {
-                               vector<vector<ImageRef> > rows(y_hi - y_lo + 1);
-
-                               for(unsigned int i=0; i < v.size(); i++)
-                                       rows[v[i].y - y_lo].push_back(v[i]);
-
-                               return rows;
-                       }
+                       inline vector<vector<ImageRef> > row_split(const 
vector<ImageRef>& v, int y_lo, int y_hi);
                }
        }
+       #endif
 
        /// Perform a morphological operation on the image.
        ///
@@ -615,58 +609,10 @@
 
        };
 
-       void morphology(const SubImage<byte>& in, const std::vector<ImageRef>& 
selem, const Morphology::Median<byte>& m, SubImage<byte>& out)
-       {
-               //If we happen to be given a 3x3 square, then perform
-               //median filtering using the hand coded functions.
-               if(selem.size() == 9)
-               {
-                       std::vector<ImageRef> s = selem;
-                       std::sort(s.begin(), s.end());
-                       ImageRef box[9] = {
-                               ImageRef(-1, -1),
-                               ImageRef( 0, -1),
-                               ImageRef( 1, -1),
-                               ImageRef(-1,  0),
-                               ImageRef( 0,  0),
-                               ImageRef( 1,  0),
-                               ImageRef(-1,  1),
-                               ImageRef( 0,  1),
-                               ImageRef( 1,  1)};
-
-                       if(std::equal(s.begin(), s.end(), box))
-                       {
-                               median_filter_3x3(in, out);
-
-                               //median_filter_3x3 does not do the edges, so 
do the 
-                               //edges with a cropped kernel.
-
-                               using median::median4;
-                               using median::median6_row;
-                               using median::median6_col;
-                               out[0][0]                         = median4(in, 
0, 0);
-                               out[0][in.size().x-1]             = median4(in, 
0, in.size().x-2);
-                               out[in.size().y-1][0]             = median4(in, 
in.size().y-2, 0);
-                               out[in.size().y-1][in.size().x-1] = median4(in, 
in.size().y-2, in.size().x-2);
-
-                               for(int i=1; i < in.size().x-1; i++)
-                                       out[0][i] = median6_row(in, 0, i-1);
-
-                               for(int i=1; i < in.size().x-1; i++)
-                                       out[in.size().y-1][i] = median6_row(in, 
in.size().y-2, i-1);
-
-                               for(int i=1; i < in.size().y-1; i++)
-                                       out[i][0] = median6_col(in, i-1, 0);
-
-                               for(int i=1; i < in.size().y-1; i++)
-                                       out[i][in.size().x-1] = median6_col(in, 
i-1, in.size().x-2);
-                       }
-                       else
-                               morphology<Morphology::Median<byte>, byte >(in 
, selem, m, out);
-               }
-               else
-                       morphology<Morphology::Median<byte>, byte >(in , selem, 
m, out);
-       }
+       #ifndef DOXYGEN_IGNORE_INTERNAL
+               //Overload for median filtering of byte images, to special-case 
3x3
+               void morphology(const SubImage<byte>& in, const 
std::vector<ImageRef>& selem, const Morphology::Median<byte>& m, 
SubImage<byte>& out);
+       #endif
 
 }
 

Index: cvd_src/morphology.cc
===================================================================
RCS file: cvd_src/morphology.cc
diff -N cvd_src/morphology.cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cvd_src/morphology.cc       6 Dec 2010 16:40:30 -0000       1.1
@@ -0,0 +1,74 @@
+#include <cvd/morphology.h>
+
+namespace CVD{
+       
+       namespace Internal{
+               namespace MorphologyHelpers{
+                       //Split a list of ImageRefs up in to rows.
+                       inline vector<vector<ImageRef> > row_split(const 
vector<ImageRef>& v, int y_lo, int y_hi)
+                       {
+                               vector<vector<ImageRef> > rows(y_hi - y_lo + 1);
+
+                               for(unsigned int i=0; i < v.size(); i++)
+                                       rows[v[i].y - y_lo].push_back(v[i]);
+
+                               return rows;
+                       }
+               }
+       }
+
+       void morphology(const SubImage<byte>& in, const std::vector<ImageRef>& 
selem, const Morphology::Median<byte>& m, SubImage<byte>& out)
+       {
+               //If we happen to be given a 3x3 square, then perform
+               //median filtering using the hand coded functions.
+               if(selem.size() == 9)
+               {
+                       std::vector<ImageRef> s = selem;
+                       std::sort(s.begin(), s.end());
+                       ImageRef box[9] = {
+                               ImageRef(-1, -1),
+                               ImageRef( 0, -1),
+                               ImageRef( 1, -1),
+                               ImageRef(-1,  0),
+                               ImageRef( 0,  0),
+                               ImageRef( 1,  0),
+                               ImageRef(-1,  1),
+                               ImageRef( 0,  1),
+                               ImageRef( 1,  1)};
+
+                       if(std::equal(s.begin(), s.end(), box))
+                       {
+                               median_filter_3x3(in, out);
+
+                               //median_filter_3x3 does not do the edges, so 
do the 
+                               //edges with a cropped kernel.
+
+                               using median::median4;
+                               using median::median6_row;
+                               using median::median6_col;
+                               out[0][0]                         = median4(in, 
0, 0);
+                               out[0][in.size().x-1]             = median4(in, 
0, in.size().x-2);
+                               out[in.size().y-1][0]             = median4(in, 
in.size().y-2, 0);
+                               out[in.size().y-1][in.size().x-1] = median4(in, 
in.size().y-2, in.size().x-2);
+
+                               for(int i=1; i < in.size().x-1; i++)
+                                       out[0][i] = median6_row(in, 0, i-1);
+
+                               for(int i=1; i < in.size().x-1; i++)
+                                       out[in.size().y-1][i] = median6_row(in, 
in.size().y-2, i-1);
+
+                               for(int i=1; i < in.size().y-1; i++)
+                                       out[i][0] = median6_col(in, i-1, 0);
+
+                               for(int i=1; i < in.size().y-1; i++)
+                                       out[i][in.size().x-1] = median6_col(in, 
i-1, in.size().x-2);
+                       }
+                       else
+                               morphology<Morphology::Median<byte>, byte >(in 
, selem, m, out);
+               }
+               else
+                       morphology<Morphology::Median<byte>, byte >(in , selem, 
m, out);
+       }
+
+
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]