nvjpeg
copied
junjie.jiang
2 years ago
1 changed files with 89 additions and 1 deletions
@ -1,2 +1,90 @@ |
|||
# nvjpeg |
|||
# Image Decode Implementation with NVJpeg and CV2 |
|||
|
|||
*author: Junjie Jiang* |
|||
|
|||
|
|||
|
|||
<br /> |
|||
|
|||
|
|||
|
|||
## Description |
|||
|
|||
An image decode operator implementation with OpenCV and NvJpeg. |
|||
The decoder will use GPU to decode jpeg images. |
|||
|
|||
Only supports linux. |
|||
|
|||
<br /> |
|||
|
|||
|
|||
|
|||
## Code Example |
|||
|
|||
Load a image from path './dog.jpg'. |
|||
|
|||
*Write the pipeline in simplified style:* |
|||
|
|||
```python |
|||
import towhee |
|||
|
|||
towhee.glob('./dog.jpg') \ |
|||
.image_decode.nvjpeg() \ |
|||
.show() |
|||
``` |
|||
|
|||
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|||
|
|||
```python |
|||
import towhee |
|||
|
|||
towhee.glob['path']('./dog.jpg') \ |
|||
.image_decode.nvjpeg['path', 'img']() \ |
|||
.select['img']() \ |
|||
.show() |
|||
``` |
|||
|
|||
|
|||
|
|||
<img src="./show_result.jpg" height="150px"/> |
|||
|
|||
|
|||
|
|||
<br /> |
|||
|
|||
|
|||
|
|||
## Factory Constructor |
|||
|
|||
Create the operator via the following factory method: |
|||
|
|||
***image_decode.nvjpeg()*** |
|||
|
|||
|
|||
|
|||
<br /> |
|||
|
|||
|
|||
|
|||
## Interface |
|||
|
|||
An image decode operator takes an image path as input. It decodes the image back to ndarray. |
|||
|
|||
|
|||
|
|||
**Parameters:** |
|||
|
|||
**img**: *str* |
|||
|
|||
Image file path. |
|||
|
|||
|
|||
|
|||
**Returns**: *towhee.types.Image (a sub-class of numpy.ndarray)* |
|||
|
|||
The decoded image data as numpy.ndarray. |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Loading…
Reference in new issue