From: Sergey Karayev Date: Tue, 26 Aug 2014 07:44:56 +0000 (-0700) Subject: FIX web_demo upload was not processing grayscale correctly X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9516115f722fb3f95882553d8077bf1ab4a670ef;p=platform%2Fupstream%2Fcaffe.git FIX web_demo upload was not processing grayscale correctly --- diff --git a/examples/web_demo/exifutil.py b/examples/web_demo/exifutil.py index 8c07aa8..01918b2 100644 --- 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):