Skip to content

Commit b14b7bd

Browse files
committed
Normalize everything to RGB over BGR, v1.0.7
1 parent 2c87142 commit b14b7bd

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

edge_impulse_linux/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ def get_features_from_image(self, img, crop_direction_x='center', crop_direction
122122
pixels = np.array(cropped).flatten().tolist()
123123

124124
for ix in range(0, len(pixels), 3):
125-
b = pixels[ix + 0]
125+
r = pixels[ix + 0]
126126
g = pixels[ix + 1]
127-
r = pixels[ix + 2]
127+
b = pixels[ix + 2]
128128
features.append((r << 16) + (g << 8) + b)
129129

130130
return features, cropped

examples/image/classify-image.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ def main(argv):
4747
print('Failed to load image', args[1])
4848
exit(1)
4949

50+
# imread returns images in BGR format, so we need to convert to RGB
51+
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
52+
5053
# get_features_from_image also takes a crop direction arguments in case you don't have square images
5154
features, cropped = runner.get_features_from_image(img)
5255

examples/image/classify-video.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def getFrame(sec):
6666

6767
while img.size != 0:
6868

69+
# imread returns images in BGR format, so we need to convert to RGB
70+
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
71+
6972
# get_features_from_image also takes a crop direction arguments in case you don't have square images
7073
features, cropped = runner.get_features_from_image(img)
7174

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = edge_impulse_linux
3-
version = 1.0.6
3+
version = 1.0.7
44
author = EdgeImpulse Inc.
55
author_email = hello@edgeimpulse.com
66
description = Python runner for real-time ML classification

0 commit comments

Comments
 (0)