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

82 lines
939 B

# Image Decode Implementation with CV2
*author: Kaiyuan Hu, Rentong Guo*
3 years ago
<br />
## Description
An image decode operator implementation with OpenCV.
3 years ago
<br />
3 years ago
## Code Example
Load a image from path './dog.jpg'.
*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('./dog.jpg')).show()
```
3 years ago
<img src="./show_result.jpg" 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.
**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