Revision: 57837
http://sourceforge.net/p/brlcad/code/57837
Author: mohitdaga
Date: 2013-09-23 17:23:05 +0000 (Mon, 23 Sep 2013)
Log Message:
-----------
Add tester functions for icv_saturate api
Modified Paths:
--------------
brlcad/trunk/src/libicv/tests/CMakeLists.txt
Added Paths:
-----------
brlcad/trunk/src/libicv/tests/icv_saturate.c
Modified: brlcad/trunk/src/libicv/tests/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libicv/tests/CMakeLists.txt 2013-09-23 17:17:57 UTC
(rev 57836)
+++ brlcad/trunk/src/libicv/tests/CMakeLists.txt 2013-09-23 17:23:05 UTC
(rev 57837)
@@ -5,6 +5,7 @@
BRLCAD_ADDEXEC(tester_icv_fade icv_fade.c libicv libbu NO_INSTALL)
BRLCAD_ADDEXEC(tester_icv_size_up icv_size_up.c libicv libbu NO_INSTALL)
BRLCAD_ADDEXEC(tester_icv_size_down icv_size_down.c libicv libbu NO_INSTALL)
+BRLCAD_ADDEXEC(tester_icv_saturate icv_saturate.c libicv libbu NO_INSTALL)
# Local Variables:
# tab-width: 8
Added: brlcad/trunk/src/libicv/tests/icv_saturate.c
===================================================================
--- brlcad/trunk/src/libicv/tests/icv_saturate.c
(rev 0)
+++ brlcad/trunk/src/libicv/tests/icv_saturate.c 2013-09-23 17:23:05 UTC
(rev 57837)
@@ -0,0 +1,119 @@
+/* I C V _ S A T U R A T E . 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 icv_saturate.c
+ *
+ * Brief description
+ *
+ */
+
+#include "common.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "bio.h"
+#include "bu.h"
+#include "icv.h"
+
+void usage()
+{
+ bu_log("\
+ [-h] [-f fraction ]\n\
+ [-p -d -m] \n\
+ [-o out_file] [file] > [out_file]\n");
+
+ bu_log("#Image Options\n\
+ \t -d for dpix image\n\
+ \t -m for ppm image\n\
+ \t -p for pix image\n");
+
+}
+
+int main(int argc, char* argv[])
+{
+ char *out_file = NULL;
+ char *in_file = NULL;
+ char c;
+ int inx=0, iny=0;
+ icv_image_t *bif;
+ double fraction = 0;
+ ICV_IMAGE_FORMAT format=ICV_IMAGE_AUTO;
+
+ if (argc<2) {
+ usage();
+ return 1;
+ }
+
+ while ((c = bu_getopt(argc, argv, "f:o:bpdmh?")) != -1) {
+ switch (c) {
+ case 'o':
+ out_file = bu_optarg;
+ break;
+ case 'f' :
+ fraction = atof(bu_optarg);
+ break;
+ case 'b' :
+ format = ICV_IMAGE_BW;
+ break;
+ case 'p' :
+ format = ICV_IMAGE_PIX;
+ break;
+ case 'd' :
+ format = ICV_IMAGE_DPIX;
+ break;
+ case 'm' :
+ format = ICV_IMAGE_PPM;
+ break;
+ case 'h':
+ default:
+ usage();
+ return 1;
+
+ }
+ }
+ if (bu_optind >= argc) {
+ if (isatty(fileno(stdin))) {
+ usage();
+ return 1;
+ }
+ }
+ else {
+ in_file = argv[bu_optind];
+ bu_optind++;
+ }
+
+ bif = icv_read(in_file, format, inx, iny);
+ if(icv_saturate(bif, fraction) < 0)
+ return 1;
+ icv_write(bif,out_file, format);
+ icv_destroy(bif);
+
+ return 0;
+
+}
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Property changes on: brlcad/trunk/src/libicv/tests/icv_saturate.c
___________________________________________________________________
Added: svn:eol-type
## -0,0 +1 ##
+native
\ No newline at end of property
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.
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits