File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/python
2+
3+ #######################################################
4+ # Copyright (c) 2015, ArrayFire
5+ # All rights reserved.
6+ #
7+ # This file is distributed under 3-clause BSD license.
8+ # The complete license agreement can be obtained at:
9+ # http://arrayfire.com/licenses/BSD-3-Clause
10+ ########################################################
11+
12+ import arrayfire as af
13+ import sys
14+ import os
15+
16+ if __name__ == "__main__" :
17+
18+ if (len (sys .argv ) == 1 ):
19+ raise RuntimeError ("Expected to the image as the first argument" )
20+
21+ if not os .path .isfile (sys .argv [1 ]):
22+ raise RuntimeError ("File %s not found" % sys .argv [1 ])
23+
24+ if (len (sys .argv ) > 2 ):
25+ af .set_device (int (sys .argv [2 ]))
26+
27+ af .info ()
28+
29+ hist_win = af .Window (512 , 512 , "3D Plot example using ArrayFire" )
30+ img_win = af .Window (480 , 640 , "Input Image" )
31+
32+ img = af .cast (af .load_image (sys .argv [1 ]), af .Dtype .u8 )
33+ hist = af .histogram (img , 256 , 0 , 255 )
34+
35+ while (not hist_win .close ()) and (not img_win .close ()):
36+ hist_win .hist (hist , 0 , 255 )
37+ img_win .image (img )
You can’t perform that action at this time.
0 commit comments