projekty
/
imago.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
edge detection
[imago.git]
/
imago.py
diff --git
a/imago.py
b/imago.py
index
1d364a5
..
94f90a0
100755
(executable)
--- a/
imago.py
+++ b/
imago.py
@@
-4,19
+4,36
@@
import Image
import im_debug
import sys
import Image
import im_debug
import sys
+from filter import filter
+
+class Usage(Exception):
+ def __init__(self, msg):
+ self.msg = msg
def main(argv=None):
"""Main function of the program."""
def main(argv=None):
"""Main function of the program."""
- if argv is None:
- argv = sys.argv[1]
+ try:
+ if argv is None:
+ try:
+ argv = sys.argv[1]
+ except IndexError:
+ raise Usage('no arguments given')
+ except Usage, err:
+ print >>sys.stderr, err.msg
+ print >>sys.stderr, "for help use --help"
+ return 2
#TODO exception on empty argument
#TODO exception on file error
image = Image.open(argv)
#TODO exception on empty argument
#TODO exception on file error
image = Image.open(argv)
- im_debug.show(image, "
O
riginal image")
+ im_debug.show(image, "
o
riginal image")
im_l = image.convert('L')
im_debug.show(im_l, "ITU-R 601-2 luma transform")
im_l = image.convert('L')
im_debug.show(im_l, "ITU-R 601-2 luma transform")
+ im_edges = filter(im_l)
+ im_debug.show(im_edges, "edge detection")
+
if __name__ == '__main__':
if __name__ == '__main__':
- main()
+ main() #sys.exit(main())
+