diff --git a/README.md b/README.md
index 0fba965..7f4430f 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
## Description
-An image decode operator implementation with OpenCV. Return BGR image.
+An image decode operator implementation with OpenCV.
@@ -32,22 +32,31 @@ the src picture:
from towhee.dc2 import pipe, ops, DataCollection
+# decode image, in bgr channel order
p = (
pipe.input('url')
.map('url', 'image', ops.image_decode.cv2())
.output('image')
)
+# decode image, in rgb channel order
+p2 = (
+ pipe.input('url')
+ .map('url', 'image', ops.image_decode.cv2('rgb'))
+ .output('image')
+)
+
# decode from path
DataCollection(p('./src_dog.jpg')).show()
# decode from bytes
with open('./src_dog.jpg', 'rb') as f:
- DataCollection(p(f.read())).show()
+ DataCollection(p2(f.read())).show()
```
+
@@ -59,8 +68,11 @@ with open('./src_dog.jpg', 'rb') as f:
Create the operator via the following factory method:
-***image_decode.cv2()***
+***ops.image_decode.cv2()***
+
+**mode**: *str*
+BGR or RGB, default is BGR
@@ -69,7 +81,7 @@ Create the operator via the following factory method:
## Interface
-An image decode operator takes an image path as input. It decodes the image back to ndarray, use BGR channel order.
+An image decode operator takes an image path as input. It decodes the image back to ndarray.
@@ -77,7 +89,7 @@ An image decode operator takes an image path as input. It decodes the image back
**img**: *str*
- Local file path or http url.
+ Local file path/http url/image bytes.