summaryrefslogtreecommitdiff
path: root/openCVTools.py
diff options
context:
space:
mode:
Diffstat (limited to 'openCVTools.py')
-rw-r--r--openCVTools.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/openCVTools.py b/openCVTools.py
index 484c3fa..d808dea 100644
--- a/openCVTools.py
+++ b/openCVTools.py
@@ -25,7 +25,7 @@ def imageStats(img):
Returns a few image statistics
'''
s = img.shape
- return f'Width: {s[1]}, Height: {s[0]}, Channels: {s[2]}'
+ return "Width: {}, Height: {}, Channels: {}, Type: {}".format(s[1], s[0], s[2] if len(s) >= 3 else 1, img[0][0][0].dtype if len(s) >= 3 else img[0][0].dtype)
@@ -37,9 +37,12 @@ def showImage(title, originalImg):
print(imageStats(originalImg))
img = originalImg.copy()
- img = img[:,:,::-1]
plt.figure(title)
- plt.imshow(img)
+ if len(img.shape) >= 3:
+ img = img[:,:,::-1]
+ plt.imshow(img)
+ else:
+ plt.imshow(img, cmap="gray")
plt.show()