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

90 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.
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
import towhee
3 years ago
towhee.glob('./dog.jpg') \
.image_decode.cv2() \
3 years ago
.show()
```
*Write a same pipeline with explicit inputs/outputs name specifications:*
```python
3 years ago
import towhee
3 years ago
towhee.glob['path']('./dog.jpg') \
.image_decode.cv2['path', 'img']() \
3 years ago
.select['img']() \
3 years ago
.show()
```
3 years ago
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*
3 years ago
​ Image file path.
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