Revision: 56326
          http://sourceforge.net/p/brlcad/code/56326
Author:   mohitdaga
Date:     2013-07-30 14:37:57 +0000 (Tue, 30 Jul 2013)
Log Message:
-----------
Adding new file libicv/filter.c. This will contain filter utilities. Adding 
icv_get_kerenl(..) function. This willcontain library of different kernels.

Modified Paths:
--------------
    brlcad/trunk/include/icv.h
    brlcad/trunk/src/libicv/CMakeLists.txt

Added Paths:
-----------
    brlcad/trunk/src/libicv/filter.c

Modified: brlcad/trunk/include/icv.h
===================================================================
--- brlcad/trunk/include/icv.h  2013-07-30 13:56:58 UTC (rev 56325)
+++ brlcad/trunk/include/icv.h  2013-07-30 14:37:57 UTC (rev 56326)
@@ -336,7 +336,30 @@
                               unsigned int ynum,
                               unsigned int xnum);
 
+/** @file libicv/filter.c
+ *
+ * This file contains routines for image filtering. This is done
+ * mainly using the convolution of images. Both Gray Scale and RGB
+ * images are taken care.
+ *
+ */
 
+typedef enum {
+    ICV_FILTER_LOW_PASS,
+    ICV_FILTER_LAPLACIAN,
+    ICV_FILTER_HORIZONTAL_GRAD,
+    ICV_FILTER_VERTICAL_GRAD,
+    ICV_FILTER_HIGH_PASS,
+    ICV_FILTER_NULL,
+    ICV_FILTER_BOXCAR_AVERAGE,
+    ICV_FILTER_3_LOW_PASS,
+    ICV_FILTER_3_HIGH_PASS,
+    ICV_FILTER_3_BOXCAR_AVERAGE,
+    ICV_FILTER_3_ANIMATION_SMEAR,
+    ICV_FILTER_3_NULL
+}ICV_FILTER;
+
+
 /** @} */
 /* end image utilities */
 

Modified: brlcad/trunk/src/libicv/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libicv/CMakeLists.txt      2013-07-30 13:56:58 UTC (rev 
56325)
+++ brlcad/trunk/src/libicv/CMakeLists.txt      2013-07-30 14:37:57 UTC (rev 
56326)
@@ -12,6 +12,7 @@
   rot.c
   color_space.c
   crop.c
+  filter.c
   )
 
 BRLCAD_ADDLIB(libicv "${LIBICV_SOURCES}" "libbu;libbn;${PNG_LIBRARY}")

Added: brlcad/trunk/src/libicv/filter.c
===================================================================
--- brlcad/trunk/src/libicv/filter.c                            (rev 0)
+++ brlcad/trunk/src/libicv/filter.c    2013-07-30 14:37:57 UTC (rev 56326)
@@ -0,0 +1,82 @@
+/*                        F I L T E R . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2013 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libicv/filter.c
+ *
+ * This file contains routines for image filtering. This is done
+ * mainly using the convolution of images. Both Gray Scale and RGB
+ * images are taken care.
+ */
+
+#include "icv.h"
+
+#define KERN_DEFAULT 3
+
+HIDDEN void
+icv_get_kernel(ICV_FILTER filter_type, double *kern, double *offset) {
+    switch(filter_type) {
+          case ICV_FILTER_LOW_PASS :
+           kern[0] = 3.0/42.0; kern[1] = 5.0/42.0; kern[2] = 3.0/42.0;
+           kern[3] = 5.0/42.0; kern[4] = 10.0/42.0; kern[5] = 5.0/42.0;
+           kern[6] = 3.0/42.0; kern[7] = 5.0/42.0; kern[8] = 3.0/42.0;
+           *offset = 0;
+           break;
+       case ICV_FILTER_LAPLACIAN :
+           kern[0] = -1.0/16.0; kern[1] = -1.0/16.0; kern[2] = -1.0/16.0;
+           kern[3] = -1.0/16.0; kern[4] = 8.0/16.0; kern[5] = -1.0/16.0;
+           kern[6] = -1.0/16.0; kern[7] = -1.0/16.0; kern[8] = -1.0/16.0;
+           *offset = 0.5;
+           break;
+       case ICV_FILTER_HORIZONTAL_GRAD :
+           kern[0] = 1.0/6.0; kern[1] = 0; kern[2] = -1.0/6.0;
+           kern[3] = 1.0/6.0; kern[4] = 0; kern[5] = -1.0/6.0;
+           kern[6] = 1.0/6.0; kern[7] = 0; kern[8] = -1.0/6.0;
+           *offset = 0.5;
+           break;
+       case ICV_FILTER_VERTICAL_GRAD :
+           kern[0] = 1.0/6.0; kern[1] = 1.0/6.0; kern[2] = 1.0/6.0;
+           kern[3] = 0; kern[4] = 0; kern[5] = 0;
+           kern[6] = -1.0/6.0; kern[7] = -1.0/6.0; kern[8] = -1.0/6.0;
+           *offset = 0.5;
+           break;
+       case ICV_FILTER_HIGH_PASS :
+           kern[0] = -1.0; kern[1] = -2.0; kern[2] = -1.0;
+           kern[3] = -2.0; kern[4] = 13.0; kern[5] = -2.0;
+           kern[6] = -1.0; kern[7] = -2.0; kern[8] = -1.0;
+           *offset = 0;
+           break;
+       case ICV_FILTER_BOXCAR_AVERAGE :
+           kern[0] = 1.0/9; kern[1] = 1.0/9; kern[2] = 1.0/9;
+           kern[3] = 1.0/9; kern[4] = 1.0/9; kern[5] = 1.0/9;
+           kern[6] = 1.0/9; kern[7] = 1.0/9; kern[8] = 1.0/9;
+           *offset = 0;
+           break;
+       case ICV_FILTER_NULL :
+           kern[0] = 0; kern[1] = 0; kern[2] = 0;
+           kern[3] = 0; kern[4] = 0; kern[5] = 0;
+           kern[6] = 0; kern[7] = 0; kern[8] = 0;
+           *offset = 0;
+           break;
+       default :
+           bu_log("Filter Type not Implemented.\n");
+           bu_free(kern, "Freeing Kernel, Wrong filter");
+           kern = NULL;
+    }
+    return;
+}


Property changes on: brlcad/trunk/src/libicv/filter.c
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to