cv2
copied
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
Updated 3 months ago
image-decode
Image Decode Implementation with CV2
author: Kaiyuan Hu, Rentong Guo
Description
An image decode operator implementation with OpenCV.
Code Example
Load a image from path './src_dog.jpg'.
the src picture:
Write the pipeline in simplified style:
from towhee 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(p2(f.read())).show()
Factory Constructor
Create the operator via the following factory method:
ops.image_decode.cv2()
mode: str
BGR or RGB, default is BGR
Interface
An image decode operator takes an image path as input. It decodes the image back to ndarray.
Parameters:
img: str
Local file path/http url/image bytes.
Returns: towhee.types.Image (a sub-class of numpy.ndarray)
The decoded image data as numpy.ndarray.
More Resources
- Scalar Quantization and Product Quantization - Zilliz blog: A hands-on dive into scalar quantization (integer quantization) and product quantization with Python.
- How to Get the Right Vector Embeddings - Zilliz blog: A comprehensive introduction to vector embeddings and how to generate them with popular open-source models.
- Understanding Computer Vision - Zilliz blog: Computer Vision is a field of Artificial Intelligence that enables machines to capture and interpret visual information from the world just like humans do.
- The guide to clip-vit-base-patch32 | OpenAI: clip-vit-base-patch32: a CLIP multimodal model variant by OpenAI for image and text embedding.
- Using Vector Search to Better Understand Computer Vision Data - Zilliz blog: How Vector Search improves your understanding of Computer Vision Data
- Demystifying Color Histograms: A Guide to Image Processing and Analysis - Zilliz blog: Mastering color histograms is indispensable for anyone involved in image processing and analysis. By understanding the nuances of color distributions and leveraging advanced techniques, practitioners can unlock the full potential of color histograms in various imaging projects and research endeavors.
- Understanding ImageNet: A Key Resource for Computer Vision and AI Research: The large-scale image database with over 14 million annotated images. Learn how this dataset supports advancements in computer vision.
- Image Embeddings for Enhanced Image Search - Zilliz blog: Image Embeddings are the core of modern computer vision algorithms. Understand their implementation and use cases and explore different image embedding models.
Jael Gu
0b81ebb49c
| 26 Commits | ||
---|---|---|---|
.gitattributes |
1.1 KiB
|
3 years ago | |
.gitignore |
1.2 KiB
|
3 years ago | |
README.md |
3.5 KiB
|
3 months ago | |
__init__.py |
730 B
|
2 years ago | |
dog.png |
66 KiB
|
2 years ago | |
image_decode_cv2.py |
2.6 KiB
|
2 years ago | |
requirements.txt |
36 B
|
3 years ago | |
show_result.jpg |
26 KiB
|
3 years ago | |
src_dog.jpg |
26 KiB
|
2 years ago |