[python-arrayfire] 161/250: Adding histogram example to arrayfire
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:44 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.
commit 15f0f8ce0532ff5473c46e301f30b63b31d12a0c
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Wed Dec 9 16:08:52 2015 -0500
Adding histogram example to arrayfire
---
examples/graphics/histogram.py | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/examples/graphics/histogram.py b/examples/graphics/histogram.py
new file mode 100644
index 0000000..6f5768b
--- /dev/null
+++ b/examples/graphics/histogram.py
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+#######################################################
+# Copyright (c) 2015, ArrayFire
+# All rights reserved.
+#
+# This file is distributed under 3-clause BSD license.
+# The complete license agreement can be obtained at:
+# http://arrayfire.com/licenses/BSD-3-Clause
+########################################################
+
+import arrayfire as af
+import sys
+import os
+
+if __name__ == "__main__":
+
+ if (len(sys.argv) == 1):
+ raise RuntimeError("Expected to the image as the first argument")
+
+ if not os.path.isfile(sys.argv[1]):
+ raise RuntimeError("File %s not found" % sys.argv[1])
+
+ if (len(sys.argv) > 2):
+ af.set_device(int(sys.argv[2]))
+
+ af.info()
+
+ hist_win = af.Window(512, 512, "3D Plot example using ArrayFire")
+ img_win = af.Window(480, 640, "Input Image")
+
+ img = af.cast(af.load_image(sys.argv[1]), af.Dtype.u8)
+ hist = af.histogram(img, 256, 0, 255)
+
+ while (not hist_win.close()) and (not img_win.close()):
+ hist_win.hist(hist, 0, 255)
+ img_win.image(img)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git
More information about the debian-science-commits
mailing list