Skip to content

Commit 58af91f

Browse files
authored
Merge pull request #64 from JannisBush/master
Fix BGR/RGB bug in tensorflow_ros
2 parents a959d6c + 0d404cd commit 58af91f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tensorflow_ros/src/tensorflow_ros/object_recognizer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ def classify(self, np_image):
5454
if np_image.ndim != 3: # x, y, channel
5555
raise ValueError("Shape of image is {sp}. Cannot classify this, shape must be (?, ?, 3). "
5656
"First 2 dimensions can are not constrained, "
57-
"but image must have 3 channels (R,G,B)".format(sp=np_image.shape))
58-
57+
"but image must have 3 channels (B,G,R)".format(sp=np_image.shape))
58+
59+
# Actually we want the image in RGB therefore we transform it
60+
np_image = np_image[:,:,::-1]
61+
5962
# Open tf session
6063
with self.session.as_default() as sess: # Be able to call this function from any thread
6164
# Open Image and perform prediction

0 commit comments

Comments
 (0)