Fixed shebangs, added error checking

This commit is contained in:
Moshe Kaplan
2013-03-06 01:41:02 -05:00
parent c0ba0c9099
commit bd042d9cc3
48 changed files with 310 additions and 129 deletions

View File

@@ -1,4 +1,4 @@
#/usr/bin/env python
#!/usr/bin/env python
''' This is a sample for histogram plotting for RGB images and grayscale images for better understanding of colour distribution
@@ -55,11 +55,16 @@ if __name__ == '__main__':
import sys
if len(sys.argv)>1:
im = cv2.imread(sys.argv[1])
fname = sys.argv[1]
else :
im = cv2.imread('../cpp/lena.jpg')
fname = '../cpp/lena.jpg'
print "usage : python hist.py <image_file>"
im = cv2.imread(fname)
if im is None:
print 'Failed to load image file:', fname
sys.exit(1)
gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)