Revision: 56501
          http://sourceforge.net/p/brlcad/code/56501
Author:   mohitdaga
Date:     2013-08-03 14:39:07 +0000 (Sat, 03 Aug 2013)
Log Message:
-----------
Adding nintrep :  nearest neighbour method to interpolate an image.

Modified Paths:
--------------
    brlcad/trunk/src/libicv/decimate.c

Modified: brlcad/trunk/src/libicv/decimate.c
===================================================================
--- brlcad/trunk/src/libicv/decimate.c  2013-08-03 13:03:08 UTC (rev 56500)
+++ brlcad/trunk/src/libicv/decimate.c  2013-08-03 14:39:07 UTC (rev 56501)
@@ -89,6 +89,47 @@
     return;
 }
 
+HIDDEN void nintrep(icv_image_t* bif, int out_width, int out_height)
+{
+    double xstep, ystep;
+    int i,j;
+    int x,y;
+    int widthstep;
+    double *in_r, *in_c; /*<< Pointer to row and col of input buffers*/
+    double *out_data, *out_p;
+    xstep = (double) (bif->width-1) / (double) (out_width) - 1.0e-06;
+    ystep = (double) (bif->height-1) / (double) (out_height) - 1.0e-06;
+
+    out_p = out_data = bu_malloc(out_width*out_height*sizeof(double), "intrep 
: out_data");
+
+    widthstep= bif->width*bif->channels;
+
+    for (j=0; j<out_height; j++) {
+        y = (int) (j*ystep);
+
+        in_r = bif->data + y*widthstep;
+
+        for (i = 0; i < out_width; i++) {
+            x =  (int) (i*xstep);
+
+            in_c = in_r + x*bif->channels;
+
+            VMOVEN(out_p, in_c, bif->channels);
+            out_p += bif->channels;
+        }
+    }
+
+    bu_free(bif->data, "intrep : in_data");
+
+    bif->data = out_data;
+
+    bif->width = out_width;
+    bif->height = out_height;
+
+    return;
+
+}
+
 /*
  * Local Variables:
  * tab-width: 8

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