projects
/
platform
/
upstream
/
caffe.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
870f13a
)
FIX web_demo upload was not processing grayscale correctly
author
Sergey Karayev
<sergeykarayev@gmail.com>
Tue, 26 Aug 2014 07:44:56 +0000
(
00:44
-0700)
committer
Sergey Karayev
<sergeykarayev@gmail.com>
Tue, 26 Aug 2014 07:44:56 +0000
(
00:44
-0700)
examples/web_demo/exifutil.py
patch
|
blob
|
history
diff --git
a/examples/web_demo/exifutil.py
b/examples/web_demo/exifutil.py
index
8c07aa8
..
01918b2
100644
(file)
--- a/
examples/web_demo/exifutil.py
+++ b/
examples/web_demo/exifutil.py
@@
-23,7
+23,13
@@
def open_oriented_im(im_path):
if exif is not None and 274 in exif:
orientation = exif[274]
im = apply_orientation(im, orientation)
- return np.asarray(im).astype(np.float32) / 255.
+ img = np.asarray(im).astype(np.float32) / 255.
+ if img.ndim == 2:
+ img = img[:, :, np.newaxis]
+ img = np.tile(img, (1, 1, 3))
+ elif img.shape[2] == 4:
+ img = img[:, :, :3]
+ return img
def apply_orientation(im, orientation):