logo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions

87 lines
1.0 KiB

# Image Decode Implementation with CV2
*author: Kaiyuan Hu, Rentong Guo*
3 years ago
<br />
## Description
An image decode operator implementation with OpenCV. Return BGR image.
3 years ago
<br />
3 years ago
## Code Example
Load a image from path './src_dog.jpg'.
the src picture:
<br />
<img src="./src_dog.jpg" height="150px"/>
3 years ago
*Write the pipeline in simplified style:*
3 years ago
```python
from towhee.dc2 import pipe, ops, DataCollection
3 years ago
p = (
pipe.input('url')
.map('url', 'image', ops.image_decode.cv2())
.output('image')
)
DataCollection(p('./src_dog.jpg')).show()
```
<br />
<img src="./dog.png" height="150px"/>
3 years ago
<br />
## Factory Constructor
Create the operator via the following factory method:
3 years ago
***image_decode.cv2()***
3 years ago
<br />
## Interface
An image decode operator takes an image path as input. It decodes the image back to ndarray, use BGR channel order.
**Parameters:**
**img**: *str*
​ Local file path or http url.
3 years ago
**Returns**: *towhee.types.Image (a sub-class of numpy.ndarray)*
3 years ago
​ The decoded image data as numpy.ndarray.
3 years ago